W3C home > Mailing lists > Public > xmlschema-dev@w3.org > August 2004

Re: restrictions on use of xs:all?

From: <noah_mendelsohn@us.ibm.com>
Date: Mon, 30 Aug 2004 12:31:31 -0400
To: "DuCharme, Bob (LNG-CHO)" <bob.ducharme@lexisnexis.com>
Cc: "'xmlschema-dev@w3.org'" <xmlschema-dev@w3.org>
Message-ID: <OF194F8219.871DB375-ON85256F00.005A6609@lotus.com>

Bob Ducharme writes:

>> Correct me if I'm wrong: because its use must be at the top level of a 
content model, we can define a content model like (a & b & c & d), but not 
(a, (b & c & d)), right? 

Right.  One way to think about it is that <xsd:all> provides for elements 
more or less the same rules one applies to attributes:  you can specify 
that you want the elements to occur exactly once (minOccurs="1" 
maxOccurs="1") or at most once (minOccurs="0" maxOccurs="1"), and in any 
order. 

A FAQ is why these limitations were made.  The short answer is:  because 
with these limitations, <xsd:all> can be implemented with much simpler 
techniques than a more generalized & as in your second example.  Indeed, 
the schema WG was initially reluctant to provide <xsd:all> at all, but 
agreed on the "exactly once/at most once at the top level" as a compromise 
that would be useful in many circumstances but tractable to implement.

Note that nothing in Schema can change the basic rules of XML Infoset, 
which is that element order is significant.  So, (A&B) validates:

<A/><B/>
<B/></A>

but it doesn't guarantee that the application can't learn anything useful 
from the order.  That's different from attributes, where the Infoset 
conveys no ordering information.  In practice, <xsd:all> is often used in 
situations where the application indeed does not care about the order of 
elements, but it can in principle be used anytime that all possible orders 
are legitimate.

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








"DuCharme, Bob (LNG-CHO)" <bob.ducharme@lexisnexis.com>
Sent by: xmlschema-dev-request@w3.org
08/30/2004 10:19 AM

 
        To:     "'xmlschema-dev@w3.org'" <xmlschema-dev@w3.org>
        cc:     (bcc: Noah Mendelsohn/Cambridge/IBM)
        Subject:        restrictions on use of xs:all?


I'm trying to get a better handle on exactly what is and what isn't 
allowed with xs:all. I used to think that elements that used it in their 
content model couldn't be nested inside of other elements, but I see now 
that this is wrong. 
 
Correct me if I'm wrong: because its use must be at the top level of a 
content model, we can define a content model like (a & b & c & d), but not 
(a, (b & c & d)), right? 
 
thanks,
 
Bob DuCharme
Received on Monday, 30 August 2004 16:33:02 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 5 February 2014 07:15:10 UTC