CMIS VIII: Futile to model Atom using XSD

The CMIS AtomPub bindings include a W3C schema for XML, aka XSD for Atom, in a file called atom.xsd. I wanted to warn potential users of that schema about the perils of validating against that schema.

First of all, Atom’s syntax has been specified using RNG. There are programmatic Atom validators to ascertain whether an Atom document meets the requirements of RFC4287. There  is a very good reason to not use XSD for modeling Atom – its open extension model.
If you have done any application programming with Atom formats, you would know that Atom allows foreign mark-up to be used anywhere (pretty much). That means you can arbitrarily interleave the elements from Atom’s namespace with those from a foreign namespace. XSD does not have any mechanism to allow this. For example, in the document below, the highlighted mark up could occur anywhere except after the entry close tag:

<feed xmlns="" xmlns:f=""> <title>Example Feed</title>
<link href=""/>
<name>John Doe</name>
<title>Atom-Powered Robots Run Amok</title>
<link href=""/>
<summary>Some text.</summary>

The only restriction on foreign markup is that it cannot occur directly under the feed element anywhere after the first entry element. I highlighted a problem in CMIS with this concept in a previous blog post that explains why hasMoreItems results in invalid Atom documents.

Leave a Reply

Your email address will not be published. Required fields are marked *