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

Re: XML Schema Question

From: Joseph M. Reagle Jr. <reagle@w3.org>
Date: Wed, 10 Jan 2001 11:11:15 -0500
Message-Id: <4.3.2.7.2.20010110110743.02012d88@rpcp.mit.edu>
To: Simon Cox <Simon.Cox@dem.csiro.au>
Cc: xmlschema-dev@w3.org, Brian LaMacchia <bal@microsoft.com>
Aside from the order (which I don't care about) I think this is the instance 
of "permitting more than one instance of each child (wrong)".

This allows an instance designer to do a
<PGPData>
   <PGPKeyID/>
   <PGPKeyID/>
</PGPData>

nor do we want
<PGPData>
</PGPData>

We want one of the following 3 possibilities:

<PGPData>
   <PGPKeyID/>
   <PGPKeyKeyPacket/>
</PGPData>

<PGPData>
   <PGPKeyKeyPacket/>
</PGPData>

<PGPData>
   <PGPKeyID/>
</PGPData>




At 08:48 1/10/2001 +0800, Simon Cox wrote:
>Probably the best you can do is
>
><choice minOccurs="1" maxOccurs="unbounded">
>         <element name="a" ... />
>         <element name="b" ... />
>         ...
></choice>
>
>although this does not constrain the sequence order.
>
>
>"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/
>
>--
>Simon.Cox@dem.csiro.au    CSIRO Exploration & Mining
>T:+61(8) 9284 8443 F:+61(8) 9389 1906 M:0403 302 672
>http://www.ned.dem.csiro.au/research/visualisation/


__
Joseph Reagle Jr.
W3C Policy Analyst                mailto:reagle@w3.org
IETF/W3C XML-Signature Co-Chair   http://www.w3.org/People/Reagle/
Received on Wednesday, 10 January 2001 11:11:27 GMT

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