you can parse it like this when you have space url in the xml file usage $namespaceurl = your namespace value
<?php
$xml = '<item>
<title>Tom Tremendous: Brady rallies Patriots over Saints</title>
<description>
<p>With Gillette Stadium nearly half-empty, the fans figuring the New England Patriots had thrown away their last chance, Tom Brady delivered a drive to savor Sunday.</p>
</description>
<link>
http://news.yahoo.com/tom-tremendous-brady-rallies-patriots-over-saints-011721864--spt.html
</link>
<pubDate>Sun, 13 Oct 2013 21:17:21 -0400</pubDate>
<source url="http://www.ap.org/">Associated Press</source>
<guid isPermaLink="false">
tom-tremendous-brady-rallies-patriots-over-saints-011721864--spt
</guid>
<content url="http://l2.yimg.com/bt/api/res/1.2/J7A0cSqro3niTyUB7bbLJQ--/YXBwaWQ9eW5ld3M7Zmk9ZmlsbDtoPTg2O3E9NzU7dz0xMzA-/http://media.zenfs.com/en_us/News/ap_webfeeds/183a1f218a441f22400f6a7067003712.jpg" type="image/jpeg" width="130" height="86"/>
<text type="html">
</text>
<credit role="publishing company"/>
</item>';enter code here
$xmlDOc = new SimpleXmlElement($xml);
if(count($xmlDOc)){
$xmlDOc->registerXPathNamespace('media', '$namespaceurl');
$result = $xmlDOc->xpath("//media:text");
foreach ($result as $entry){
var_dump($entry);
}
}
if you don't have namespace in the xml doc use like ths
<?php
$xml = '<item>
<title>Tom Tremendous: Brady rallies Patriots over Saints</title>
<description>
<p>With Gillette Stadium nearly half-empty, the fans figuring the New England Patriots had thrown away their last chance, Tom Brady delivered a drive to savor Sunday.</p>
</description>
<link>
http://news.yahoo.com/tom-tremendous-brady-rallies-patriots-over-saints-011721864--spt.html
</link>
<pubDate>Sun, 13 Oct 2013 21:17:21 -0400</pubDate>
<source url="http://www.ap.org/">Associated Press</source>
<guid isPermaLink="false">
tom-tremendous-brady-rallies-patriots-over-saints-011721864--spt
</guid>
<content url="http://l2.yimg.com/bt/api/res/1.2/J7A0cSqro3niTyUB7bbLJQ--/YXBwaWQ9eW5ld3M7Zmk9ZmlsbDtoPTg2O3E9NzU7dz0xMzA-/http://media.zenfs.com/en_us/News/ap_webfeeds/183a1f218a441f22400f6a7067003712.jpg" type="image/jpeg" width="130" height="86"/>
<text type="html">
</text>
<credit role="publishing company"/>
</item>';
$xml = str_replace("<media:",'<md',$xml); //md is just differentiate
$xml = str_replace("</media:","</md",$xml)
$xmlDOc = new SimpleXmlElement($xml);
if(count($xmlDOc)){
$result = $xmlDOc->xpath("//mdtext");
foreach ($result as $entry){
var_dump($entry);
}
}