从命名空间获取xml标记的属性[重复]

Possible Duplicate:
PHP namespace simplexml problems

I have a portion of xml as :

<item>
    <source url="eurosport.com">Eurosport</source>
    <media:content url="http://media.zenfs.com/en_GB/Sports/Eurosport/900589-15042881-640-360.jpg" type="image/jpeg" width="130" height="86" />
</item>

I am using the SimpleXMLElement() to convert the textual xml data into a SimpleXML Element Object. By that I can has access to item as $item.

I am required to obtain the url of media:content and am not able to do it. Can anyone help me out?

P.S: Tried this, but it did not help ..

foreach ($item->{'media:content'}->attributes() as $key => $val) {
        return (string)$val; 
}

Use xPath() method of the SimpleXMLElement()

var_export($item->xpath('media:content'));

You need to use the ->children() method to select the correct namespace:

foreach ($item->children('media', true)->content->attributes() as $key => $val) {
        return (string)$val; 
}