Quantcast
Channel: Counting the total item in an ATOM feed - Stack Overflow
Viewing all articles
Browse latest Browse all 2

Counting the total item in an ATOM feed

$
0
0

I have a problem in counting the total items in this feed,

$xml = ('http://www.huffingtonpost.com/author/index.php?author=simon-cohen'); $xmlDoc = new DOMDocument();$xmlDoc -> load($xml);# Get and output "<item>" elements.$x = $xmlDoc -> getElementsByTagName('entry');# Count the total feed with xpath.$xpath = new DOMXPath($xmlDoc);$total_feed = $xpath->evaluate('count(//entry)');echo $total_feed;

result,

0

The content of this feed is like this,

<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en"><title>Simon Cohen</title><link href="http://huffingtonpost.com/author/index.php?author=simon-cohen"/><updated>2011-11-08T11:40:28-05:00</updated><author><name>Simon Cohen</name></author><id xmlns="http://www.w3.org/2005/Atom">http://www.huffingtonpost.com/author/index.php?author=simon-cohen</id><rights>Copyright 2008, HuffingtonPost.com, Inc.</rights><subtitle>HuffingtonPost Blogger Feed for Simon Cohen</subtitle><generator>Good old fashioned elbow grease.</generator><entry>...</entry><entry>...</entry></feed>

Viewing all articles
Browse latest Browse all 2

Latest Images

Trending Articles





Latest Images