http://onlamp.com/pub/a/php/2004/01/15/ ... tml?page=2
I would like to get a list of nodes of type item and then be able to loop through them, printing out the link, date and type ( all listed below ) .
here is my code so far:
Code: Select all
$s= new SimpleXMLElement($feed);
$s->registerXPathNamespace('rss', 'http://purl.org/rss/1.0/');
$items = $s->xpath('//rss:item');
foreach ($items as $item) {
echo $item->date.'<br>';
echo $item->link.'<br>';
echo $item->type.'<br>';
}
Here are the feed namespace definitions:
[text]
<rdf:rdf xmlns:admin="http://webns.net/mvcb/" xmlns:dcterms="http://purl.org/dc/terms/" xmlns:syn="http://purl.org/rss/1.0/modules/syndication/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:ev="http://purl.org/rss/1.0/modules/event/" xmlns="http://purl.org/rss/1.0/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
[/text]
The feed in made of many 'items'. Here is the structure of 1 item:
[text]
<item rdf:about="http://---.com/301940.html">
<title><![CDATA[--------------]]></title>
<link>
http://---.com/301940.html
<description>
<dc:date>2011-12-05T14:09:09-05:00</dc:date>
<dc:language>en-us</dc:language>
<dc:title></dc:title>
<dc:type>text</dc:type>
</item>
[/text]
I would appreciate any pointers.
Thanks in advance,
KC