Simple schemas make for complex documents
11:33, 25 Oct 2000 UTC | Eric van der Vlist

XMLhack Editorial. The W3C XML Schema Working Group has chosen to keep some of the restrictions of the SGML DTDs to facilitate the work of XML Schema tools implementers, taking the risk of complicating the life of XML schema authors and XML document end users.

XML 1.0 design goal number nine says "XML documents shall be easy to create".

One of the ways to achieve this goal is to avoid adding arbitrary constraints that are always perceived as annoying needles by document authors. This is why, for instance, the order of the attributes is not considered as significant.

Many XML vocabularies and applications do not need a specific order for some of their elements.

As an example, Netscape's RSS 0.91 defines a document element named "channel" under which you some elements describing the channel, followed by an optional "image" element, 1 to 15 "item" elements and an optional "textinput" element.

Except for the fact that DTD validation does a very poor job with unordered elements, there is no reason why the image element should be before the item elements, and the textinput element after them.

Imposing ordering, as is done in the current RSS 0.91 specification, is just adding an unneeded burden on XML authors, who are very often writing or generating these documents by hand. At the end of the day this kind of restrictions contribute to an overall image of complexity for XML technologies.

In this context, I am very disappointed to see that the XML Schema WG has rejected a request to improve the definition of unordered element groups and decided to align the functionality of the new Candidate Recommendation with DTDs on this respect.

The decision, which has been taken to facilitate the job of XML Schema tools implementers (an FSM cannot be used to validate unrestricted groups of unordered elements, since you cannot easily detect the end of the group) will seriously impact the ability to define XML Schemas for unordered element groups, leading XML Schema authors to impose arbitrary order constraints that will continue to be an obstacle for XML document authors.

To come back to RSS 0.91, which is a good example, it is impossible to define an XML Schema without constraining the order of the image, item and textinput elements (unless you accept not testing the number of occurrences of these elements).

See also: a recent discussion on xml-dev about this subject.

xmlhack: developer news from the XML community

Front page | Search | Find XML jobs

Related categories