Hack 85 Validate RSS and Atom Documents

   

figs/beginner.gif figs/hack85.gif

Use an online validator to check your RSS and Atom documents.

You can check RSS 0.91, RSS 1.0, RSS 2.0, and Atom documents online using Mark Pilgrim and Sam Ruby's Feed Validator (http://feedvalidator.org). The project is hosted on SourceForge (http://sourceforge.net/projects/feedvalidator/). This hack will use Feed Validator to check an RSS or Atom document.

Go to http://feeds.archive.org/validator/ and in the text box, enter the URL http://www.wyeast.net/news.rss (0.91) as shown in Figure 6-4, or an Atom document, http://www.wyeast.net/atom.xml. (The scheme name http:// is already provided in the text box.) Click the Validate button. The file is processed and the results are posted to the browser (Figure 6-5).

Figure 6-4. Feed Validator in Firefox
figs/xmlh_0604.gif


Figure 6-5. Results of validating an RSS document with Feed Validator
figs/xmlh_0605.gif


If the validator generates errors, you can read more about these errors at http://feedvalidator.org/docs/. For example, if your RSS document is not well-formed, it will generate an XML parsing error, which you can read about at http://feedvalidator.org/docs/error/SAXError.html.

Figure 6-6. W3C RDF validator
figs/xmlh_0606.gif


If you want to parse an RSS 1.0 feed, you can validate it with the W3C RDF validator because it is written as RDF. Go to http://www.w3.org/RDF/Validator/ and enter the URL http://www.wyeast.net/wyeast.rss, as shown in Figure 6-6. (You can also paste RDF markup into the text box directly to validate it.) Click Parse URI. If the parse is successful, you will see results like those shown in Figure 6-7.

Figure 6-7. Results of parse in W3C RDF validator
figs/xmlh_0607.gif


6.7.1 See Also

  • Another face of Feed Validator is shown as RSS Validator: http://rss.scripting.com/

  • Yet another face of Feed Validator is Walidator: http://www.walidator.com/

  • Leigh Dodd's downloadable Schematron RSS validator: http://www.ldodds.com/rss_validator/

Michael Fitzgerald



XML Hacks
XML Hacks: 100 Industrial-Strength Tips and Tools
ISBN: 0596007116
EAN: 2147483647
Year: 2006
Pages: 156

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net