views:

41

answers:

1

This is my RSS template that I load into my simplexml object. I want to change the

<?xml version="1.0" encoding="utf-8"?>
<rss xmlns:atom="http://www.w3.org/2005/Atom" version="2.0">
    <channel>
        <atom:link href="link" rel="self" type="application/rss+xml" />
        <title></title>
        <link></link>
        <description></description>
        <lastBuildDate></lastBuildDate>
    </channel>
</rss>

I'd like to change the href attribute in atom:link but I have no clue how to access it. I scoured through SO and found a bunch of information on how to access different namespaces but I can't figure out how to apply any of them to this specific example (mostly because I am pretty dense :)

I can modify my link attribute with the line of code below but how would I modify the attribute mentioned above?

$rss->channel->link = $rssLink;

Any help would be appreciated!

+1  A: 
$attrs = $rss->channel->children("atom", true)->link->attributes();
$attrs["href"] = "href_value";

Example here.

Artefacto
Thank you so much, I've been hammering at this for an hour or so :)
Gazillion