You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@abdera.apache.org by Jim Alateras <ji...@comware.com.au> on 2007/09/11 15:50:45 UTC

validating a feed

Just wondering what the best way is to validate an atom feed. Currently 
I do the following

Abdera abdera = new Abdera();
Parser parser = abdera.getParser();
Document<Feed> feed = parser.parse(
  new StringReader(response.getEntity().getText()));

but it still seems to create a valid document even if i parse an RSS 
document, like the one below

<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" 
xmlns:georss="http://www.georss.org/georss" xmlns:taxo="http://purl.or
g/rss/1.0/modules/taxonomy/" 
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" 
xmlns:media="http://search.yahoo.com/mrss/" xml
ns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" 
xmlns:dc="http://purl.org/dc/elements/1.1/" 
xmlns:gml="http://www.opengis.net/gml"
  version="2.0">
   <channel>
     <title>SyslogRecord Feed</title>
 
<link>/syslogs?id=2&amp;fieldUnitAddress=6&amp;first=7&amp;count=1</link>
     <description>SyslogRecord Feed</description>
     <pubDate>Tue, 11 Sep 2007 13:48:08 GMT</pubDate>
     <dc:creator>Observant Ringo Web Application</dc:creator>
     <dc:date>2007-09-11T13:48:08Z</dc:date>
   </channel>
</rss>



cheers
</jima>

Re: validating a feed

Posted by James M Snell <ja...@gmail.com>.
There is next to no validation code in Abdera.  This was intentional in
order to provide as much performance as possible.  The burden is on the
developer to use Abdera to produce valid feeds and to check that what
was parsed is valid.  For validation, I'll typically run the output
through the feedvalidator (http://feedvalidator.org).

- James

Jim Alateras wrote:
> Just wondering what the best way is to validate an atom feed. Currently
> I do the following
> 
> Abdera abdera = new Abdera();
> Parser parser = abdera.getParser();
> Document<Feed> feed = parser.parse(
>  new StringReader(response.getEntity().getText()));
> 
> but it still seems to create a valid document even if i parse an RSS
> document, like the one below
> 
> <?xml version="1.0" encoding="UTF-8"?>
> <rss xmlns:content="http://purl.org/rss/1.0/modules/content/"
> xmlns:georss="http://www.georss.org/georss" xmlns:taxo="http://purl.or
> g/rss/1.0/modules/taxonomy/"
> xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
> xmlns:media="http://search.yahoo.com/mrss/" xml
> ns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#"
> xmlns:dc="http://purl.org/dc/elements/1.1/"
> xmlns:gml="http://www.opengis.net/gml"
>  version="2.0">
>   <channel>
>     <title>SyslogRecord Feed</title>
> 
> <link>/syslogs?id=2&amp;fieldUnitAddress=6&amp;first=7&amp;count=1</link>
>     <description>SyslogRecord Feed</description>
>     <pubDate>Tue, 11 Sep 2007 13:48:08 GMT</pubDate>
>     <dc:creator>Observant Ringo Web Application</dc:creator>
>     <dc:date>2007-09-11T13:48:08Z</dc:date>
>   </channel>
> </rss>
> 
> 
> 
> cheers
> </jima>
>