[Standards-JIG] sequence vs. choice in Jabber/XMPP schemas

Peter Saint-Andre stpeter at jabber.org
Wed Aug 17 19:22:33 UTC 2005


Trejkaz wrote:
> Quoting Peter Saint-Andre <stpeter at jabber.org>:
> 
>> 1. Keep using xs:sequence and require existing implementations to pay 
>> attention to the order of child elements.
> 
> 
> Ouch.  That's going to be hell for people working with DOM-like APIs 
> where it's
> not so easy to insert new elements into them in the expected order.  On the
> other hand, it's really easy for people generating their XML by string
> concatenation.

Agreed.

>> 2. Switch to xs:choice and care less about the number of allowable 
>> child elements.
> 
> 
> If anything, <xs:all> is probably a closer fit in most of these cases.

Yes, in some cases that's true. We'll use xs:all where we can, but the 
restrictions on xs:all are so severe that often we'll need to use xs:choice.

>> 3. Define two different sets of schemas: a strict one following (1) 
>> and a loose one following (2).
> 
> 
> XHTML did this in version 1.0, and practically nobody used the Strict 
> version as
> there was no incentive given to use it.  They ended up making 1.1 
> effectively
> strict, removing the non-strict version.

Or of course we could define both xs:schema and RELAX NG and people 
could use either one.

>> 4. Switch from W3C XML Schema to a different schema language, such as 
>> RELAX NG, Schematron, or Examplotron.
> 
> 
> RELAX NG is certainly much more powerful than W3C's XML schema.  They 
> even seem
> to have acknowledged this themselves, as the drafts for XHTML 2.0 are 
> entirely
> written in RELAX NG schema. :-)
> 
> It allows situations which we have that we can't currently represent.  For
> instance, we could specify that <status> and <show> elements don't occur 
> inside
> <presence> when type="subscribe"... and that's just the tip of the 
> iceberg, of
> course.
> 
> In addition to this, RELAX NG has a "Compact Syntax" which is just as 
> flexible
> as the normal syntax, but much easier to read and write.  It's easier to 
> read
> than DTDs, which were already a great deal easier to read than W3C XML 
> schemas.
> :-)
> 
> And of course, because RELAX NG is a superset of all other schema 
> functionality,
> there exist tools to transform it into other formats (approximating where
> necessary, of course.)
> 
> My main choice then, is (4).  And (2) is a reasonable fallback as long as
> <xs:all> is used in places where it makes more sense than <xs:choice>.

Well, I don't think it's reasonable to get rid of xs:schema entirely 
because a lot of deployments depend on it for validation (even though we 
tell them not to, but that's another story). But I would not be opposed 
to defining both xs:schema and RELAX NG, then letting people choose 
between them. I'm all for choice!

Peter

-- 
Peter Saint-Andre
Jabber Software Foundation
http://www.jabber.org/people/stpeter.shtml


More information about the Standards mailing list