Click here to get back home

XML::Atom::Feed - parsing at all?

 HomeNewsGroups | Search | About
 comp.lang.perl.modules    Post an article   get this group's latest topics as an RSS feed add this group's latest topics to your My MSN content add this group's latest topics to your My Yahoo content
Subject Author Date
XML::Atom::Feed - parsing at all? RJ Newt 01-20-2008
Posted by RJ Newt on January 20, 2008, 5:04 pm
Please log in for more thread options
I'm trying to parse up a feed but XML::Atom::Feed doesn't seem to
recognize that anything at all is in the XML string I'm feeding to
it. Here's a complete example of how it is not working:

#!/usr/bin/perl -w
use strict;
use XML::Atom::Feed;

# variables
my ($xml, $feed, @entries);

# feed example taken directly from RFC 4287
# see http://tools.ietf.org/html/rfc4287
$xml = <<'(RAW)';
<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">

<title>Example Feed</title>
<link href="http://example.org/"/>
<updated>2003-12-13T18:30:02Z</updated>
<author>
<name>John Doe</name>
</author>
<id>urn:uuid:60a76c80-d399-11d9-b93C-0003939e0af6</id>

<entry>
<title>Atom-Powered Robots Run Amok</title>
<link href="http://example.org/2003/12/13/atom03"/>
<id>urn:uuid:1225c695-cfb8-4ebb-aaaa-80da344efa6a</id>
<updated>2003-12-13T18:30:02Z</updated>
<summary>Some text.</summary>
</entry>

</feed>
(RAW)

$feed = XML::Atom::Feed->new($xml);
$feed or die $!;

@entries = $feed->entries();

print 'feed count: ', scalar(@entries), "\n";
print 'version: ', $feed->version, "\n";

Here's the output:
feed count: 0
version:

It appears to have no entries and no version. No errors are
displayed. Any ideas what I'm doing wrong?

Posted by Mumia W. on January 22, 2008, 1:25 am
Please log in for more thread options
On 01/20/2008 04:04 PM, RJ Newt wrote:
> I'm trying to parse up a feed but XML::Atom::Feed doesn't seem to
> recognize that anything at all is in the XML string I'm feeding to
> it. Here's a complete example of how it is not working:
> [...]
>
> print 'feed count: ', scalar(@entries), "\n";
> print 'version: ', $feed->version, "\n";
>
> Here's the output:
> feed count: 0
> version:
>

Your program works for me. Perhaps you don't have the right versions of
the modules that XML::Atom::Feed depends upon.


Similar ThreadsPosted
XML::DOM parsing pb March 9, 2006, 1:27 pm
XML Parsing too slow November 19, 2005, 7:29 am
HTML parsing March 21, 2005, 3:24 pm
CGI.pm parsing odity May 16, 2006, 10:01 am
Image data parsing October 27, 2004, 3:36 pm
Parsing OpenOffice Spreadsheets April 25, 2005, 7:23 pm
can't find xml-parsing module... May 27, 2006, 5:30 am
Lemur parsing module June 20, 2006, 10:44 pm
Parsing AVI header information June 8, 2008, 11:08 pm
Parsing Doctype Entitites using XML::XPath November 5, 2004, 10:13 am

Our other projects:

Art Dolls, Fairies and Mermaids - Sunnyfaces.net

Roy's Linux, Programming and Search Engines messages

1-Script XML SitemapXML Sitemap