Re: Database schema from standards xsd

Boris Kolpackov writes:

> There are ways to specify in XML Schema whether elements should appear
> in a particular order or not (xs:sequence vs xs:all).

I'm afraid that's not correct.  Specifying "the sequence A, B, C" means 
that only the elements A, B and C are allowed, and only in that order. 
Specifying "all of A, B, C" does NOT necessarily mean order does not 
matter.  It merely means that all of the following are acceptable 
instances:

A B C
A C B
B A C
B C A
C A B
C B A

It is perfectly reasonable for an application to assign a different 
meaning to A B C than to C B A.  In such a case, a database mapping that 
failed to retain the order would result in bugs.  The schema workgroup at 
one point considered a request from the XML Query workgroup for a standard 
annotation that would indicate whether order was significant, but as we 
got closer to refining the specification, the Query workgroup indicated 
that their interest had diminished and the feature was dropped.

In general, the order of XML elements is significant regardless of what 
the schema says.  Sometimes, as with the sequence above, the correct order 
can be inferred from the schema, and so in principle need not be 
separately tracked on a per-instance basis.  Ironically, it is in the 
"all" case that the database is likely to have to track the order per 
instance.  Also, as Mike says, there are many obvious cases involving 
repeating elements in which order matters.

Noah

--------------------------------------
Noah Mendelsohn 
IBM Corporation
One Rogers Street
Cambridge, MA 02142
1-617-693-4036
--------------------------------------

Received on Thursday, 3 April 2008 22:29:00 UTC