Sorry for posting this here, but I suspect there are gurus in the php community who knows the answer. Googling has not gotten me anywhere.. I don't know.. maybe I'm asking the wrong questions...
Basically, it's an xpath problem: I need to query some itunes tags in an rss. They are typically named <itunes:[something]>. The problem is that the following xpath query is invalid "rss/channel/itunes:[something]". And it's the colon that breaks it... I've tried looking for some way to escape the colon, without success. Maybe I'm taking the wrong approach as using colon's in xml tags is a typical namespace thing.... Well, I'm out of ideas, so any help is appreciated...
Regards, tores
Xpath trouble
Moderator: General Moderators
Using "An Example Feed" from http://www.apple.com/itunes/store/podca ... c526931674 as sourceprints
Code: Select all
<?php
$dom = DOMDocument::load('test.xml');
$xpath = new DOMXPath($dom);
$nodeset = $xpath->query('//rss/channel/itunes:summary');
if ( 0<$nodeset->length ) {
echo $nodeset->item(0)->textContent;
}
echo "\n<hr />\n";
$nodeset = $xpath->query('//rss/channel/itunes:*');
foreach($nodeset as $node) {
echo $node->nodeName, "<br />\n";
}All About Everything is a show about everything. Each week we dive into any subject known to man and talk about it as much as we can. Look for our Podcast in the iTunes Music Store
<hr />
itunes:subtitle<br />
itunes:author<br />
itunes:summary<br />
itunes:owner<br />
itunes:image<br />
itunes:category<br />
itunes:category<br />