W3C home > Mailing lists > Public > xmlschema-dev@w3.org > January 2001

XML Schema Question

From: Joseph M. Reagle Jr. <reagle@w3.org>
Date: Tue, 09 Jan 2001 18:15:56 -0500
Message-Id: <>
To: henry@w3.org, "Michael Sperberg-McQueen" <cmsmcq@w3.org>
Cc: xmlschema-dev@w3.org, Brian LaMacchia <bal@microsoft.com>, "Donald Eastlake" <dee3@torque.pothole.com>, <lde008@dma.isg.mot.com>
Is there a more elegant schema representation for the semantic of, "you can have a sequence of the following, and while I don't care which you have (they are all optional) you must have at least one of them."

For instance, the following works (though is there a more elegant version for the schema?):

<!ELEMENT PGPData ((PGPKeyID, PGPKeyPacket?) | (PGPKeyPacket) %PGPData.ANY;) >


   <complexType name="PGPDataType"> 
         <element name="PGPKeyID" type="string" minOccurs="1"/> 
         <element name="PGPKeyPacket" type="ds:CryptoBinary" minOccurs="0"/> 
         <any namespace="##other" processContents="lax" minOccurs="0" 
         <element name="PGPKeyPacket" type="ds:CryptoBinary"/> 
         <any namespace="##other" processContents="lax" minOccurs="0" 

but it can get ugly for larger structures, or I keep it simple and end up permitting more than one instance of each child (wrong)

   <!ELEMENT X509Data ((X509IssuerSerial | X509SKI | X509SubjectName |
                        X509Certificate)+ | X509CRL %X509.ANY;)>

or permitting empty content (wrong)

   <!ELEMENT X509Data ((X509IssuerSerial?, X509SKI?, X509SubjectName?, 
                        X509Certificate?) | X509CRL %X509.ANY;)>

Joseph Reagle Jr.   
W3C Policy Analyst                mailto:reagle@w3.org
IETF/W3C XML-Signature Co-Chair   http://www.w3.org/People/Reagle/
Received on Tuesday, 9 January 2001 19:36:20 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 7 January 2015 14:55:50 UTC