XSD for Atom
Another question I’ve fielded several times over the last weeks: Is there any XSD for Atom?My first response: “What are you using the schema for?” I won’t go into all of the details of that dialog, but remember that you should always carefully consider the use of a schema before building one.So to the point…The Atom format spec provides a Relax-NG schema, to provide a normative description of the atom syntax. It is, however, not enough to validate XML against this schema as Relax-NG is not expressive enough to capture some of the other validity requirements for atom feeds or entries – namely the requirements listed in sections 4.1.1 and 4.1.2, respectively. XML Schema is also not expressive enough, in fact, I don’t believe any schema language is and that is why we have the feed validator (also available here – it’s opensource). That being said, a schema can be used for more than validation, and quite a lot of tooling (e.g. web services tooling) leverages XSD. Hence the question.I did a bit of digging and found what I think is the most recent (June) Atom xsd thread from the mailing lists. In particular this thread showed up in the Abdera user mailing list – Abdera is an opensource implementation of both RFC 4287 and RFC 5023 as well as several extensions, both approved and internet drafts. It is currently in incubation with Apache.In this particular thread Danny Ayers suggested Trang for conversion from the Relax-NG schema to xsd. I gave it a shot and while I haven’t used the resulting xsd for anything I did find that another internal project here at EMC using Atom did the same and are using that xsd.There doesn’t seem to be a defacto standard way of obtaining an xsd for the Atom format – this mechanism seems as good as any.UPDATE: Unfortunately I have since found that the schema produced by trang is not valid. The primary problem seems to be that it is hard to produce an XSD that allows for extension that is still deterministic. More on that shortly.
Share Your Thoughts