Subject: | Atom feed genereated from the example in the synopsis does not validate |
Hi,
this code based on the example in the synopsis generates some markup that does not validate:
[CODE]
#!/usr/bin/perl
use strict;
use warnings;
use XML::Atom::Feed;
use XML::Atom::Entry;
my $feed = XML::Atom::Feed->new;
$feed->title('My Weblog');
$feed->id('tag:example.com,2006:feed-id');
my $entry = XML::Atom::Entry->new;
$entry->title('First Post');
$entry->id('tag:example.com,2006:entry-id');
$entry->content('Post Body');
$feed->add_entry($entry);
$feed->add_entry($entry, { mode => 'insert' });
print $feed->as_xml;
[/CODE]
The markup I get is:
[MARKUP]
<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://purl.org/atom/ns#">
<title>My Weblog</title>
<id>tag:example.com,2006:feed-id</id>
<entry>
<title>First Post</title>
<id>tag:example.com,2006:entry-id</id>
<content mode="xml">
<div xmlns="http://www.w3.org/1999/xhtml">Post Body</div>
</content>
</entry>
</feed>
[/MARKUP]
I'm attaching the code. Here is the feed validator:
http://validator.w3.org/feed/#validate_by_input
Regards,
-- Shlomi Fish
Subject: | gen_atom_feed.pl |
#!/usr/bin/perl
use strict;
use warnings;
use XML::Atom::Feed;
use XML::Atom::Entry;
my $feed = XML::Atom::Feed->new;
$feed->title('My Weblog');
$feed->id('tag:example.com,2006:feed-id');
my $entry = XML::Atom::Entry->new;
$entry->title('First Post');
$entry->id('tag:example.com,2006:entry-id');
$entry->content('Post Body');
$feed->add_entry($entry);
$feed->add_entry($entry, { mode => 'insert' });
print $feed->as_xml;