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

Re: XML Schema Question

From: Ashok Malhotra <petsa@us.ibm.com>
Date: Thu, 11 Jan 2001 09:31:31 -0500
To: "Martin J. Duerst" <duerst@w3.org>
Cc: "Joseph M. Reagle Jr." <reagle@w3.org>, henry@w3.org, "Michael Sperberg-McQueen" <cmsmcq@w3.org>, xmlschema-dev@w3.org, Brian LaMacchia <bal@microsoft.com>, "Donald Eastlake" <dee3@torque.pothole.com>, <lde008@dma.isg.mot.com>
Message-ID: <OF557C9FC2.4FB92878-ON852569D1.004F68D4@pok.ibm.com>

At 01/01/09 18:15 -0500, Joseph M. Reagle Jr. wrote:
>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."

I've not been following this thread closely but it seems to me that
a substitutionGroup would provide the needed semantic.
Create a substitutionGroup with one of the optional items as
exemplar.  Put all the other items in the substitutionGroup.
Define the type to contain one or more or the exemplar.

This design will allow multiple occurrences of one of the optional items.
Is this a problem?


All the best, Ashok


"Martin J. Duerst" <duerst@w3.org>@w3.org on 01/11/2001 07:23:07 AM

Sent by:  xmlschema-dev-request@w3.org


To:   "Joseph M. Reagle Jr." <reagle@w3.org>, 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>
Subject:  Re: XML Schema Question



Joseph - If you need at least one of them overall, then it won't
work other than expanding it as you have done. There is something
called 'any', but that only allows occurrence constraints on each
of the parts (and only zero or one as a number, not even 'many'),
but not overall.

Regards,   Martin.

At 01/01/09 18:15 -0500, Joseph M. Reagle Jr. wrote:
>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">
>      <choice>
>        <sequence>
>          <element name="PGPKeyID" type="string" minOccurs="1"/>
>          <element name="PGPKeyPacket" type="ds:CryptoBinary" minOccurs
="0"/>
>          <any namespace="##other" processContents="lax" minOccurs="0"
>           maxOccurs="unbounded"/>
>        </sequence>
>        <sequence>
>          <element name="PGPKeyPacket" type="ds:CryptoBinary"/>
>          <any namespace="##other" processContents="lax" minOccurs="0"
>           maxOccurs="unbounded"/>
>        </sequence>
>      </choice>
>    </complexType>
>
>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 Thursday, 11 January 2001 09:34:08 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 11 January 2011 00:14:19 GMT