XML Developer Tip
(Receive this column in your inbox,
click Edit your Profile to subscribe.)
Validate your RSS
I've given the XML vocabulary known as RSS, or Rich Site Summary (sometimes also known as RDF Site Summary for those with a longer view of XML trends and technologies), a fair amount of play lately. This leads me not just to recommend, but to beg interested XML developers to also make use of Mark Pilgrim's online RSS validator to make sure that the feeds they build are well-formed XML. As to the whys and wherefores of this recommendation, it's because many of the RSS readers currently available--including the majority of those I've touted in previous tips--can only parse RSS feeds that are also well-formed XML. Otherwise, it's no go for would be consumers, who instead face a range of error messages that vary from frustrating to downright cryptic.
In XML terms, well-formedness means that elements are represented using proper tags (opening and closing, where required) and proper document structure. You'll also want to make sure that your RSS feeds represent special characters (like ampersands which should appear as & using standard character entities) properly; ditto for Unicode or other special characters not found in the basic alphabetic, numeric, and punctuation sets.
Validation does more than check for syntax and proper structure; it also makes sure that XML preambles and metadata are correct and meaningful, and can check a document instance against a DTD or XML Schema to make sure that beyond being well-formed it also adheres to the rules of the XML vocabulary in use (in this case, the RSS specification itself).
Working with a validator follows what we used to call the "edit-refresh-check" cycle in the days when explaining basic validation to HTML users was pretty avant garde. These days, people are pretty used to working with such tools, so I point out only that validation should be a next-to-final step in checking and testing work any time changes are made, because edits to XML documents (especially when quick and dirty plain text tools are used) can (and sometimes do) produce just the kinds of nit-picky little errors that validators are good at catching. The notion of a cycle derives from the need to repeat edit-refresh-check activities until the validator finds nothing to complain about and recognizes your RSS document as valid and correct.
Long story short: if you're building RSS you owe it to those who consume your feeds to make sure you're providing valid XML to them. To try out this nice tool, please visit: feeds.archive.org/validator/. To read a great description of the RSS validator's inner workings by its developer, Mark Pilgrim, check www.xml.com/pub/a/2003/02/26/dive-into-xml.html. Enjoy.
About the Author
Ed Tittel is a 20-plus year veteran of the computing industry, who's worked as a programmer, manager, systems engineer, instructor, writer, trainer, and consultant. He's also the series editor of Que Certification's Exam Cram 2 and Training Guide series, and writes and teaches regularly on Web markup languages and related topics.
For More Information:
- Looking for free research? Browse our comprehensive White Papers section by topic, author or keyword.
- Are you tired of technospeak? The Web Services Advisor column uses plain talk and avoids the hype.
- For insightful opinion and commentary from today's industry leaders, read our Guest Commentary columns.
- Hey Codeheads! Start benefiting from these time-saving XML Developer Tips and .NET Developer Tips.
- Visit our huge Best Web Links for Web Services collection for the freshest editor-selected resources.
- Visit Ask the Experts for answers to your Web services, SOAP, WSDL, XML, .NET, Java and EAI questions.
- Choking on the alphabet soup of industry acronyms? Visit our helpful Glossary for the latest industry lingo.
- Couldn't attend one of our Webcasts? Don't miss out. Visit our archive to watch at your own convenience.
- Discuss this article, voice your opinion or talk with your peers in the SearchWebServices Discussion Forums.