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

Re: XML Schema Question

From: Ashok Malhotra <petsa@us.ibm.com>
Date: Mon, 15 Jan 2001 16:38:58 -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: <OFB72C2934.0414B354-ON052569D5.003FC6BF@pok.ibm.com>

Martin is correct.  You derive an abstract type, say a, from AnyType.  Then
derive
x, y, and z from a and put x, y and z in the substitution group for a.
When you define the structure you specify that if must have exactly one a.
The semantics of the substitution group will then allow you to have exactly
one x or y or z.

If you want to have at least one of x, y or z, just define the structure to
have one
or more a.  The semantics of the substitution group will then allow one or
more
x, or y or z  in any combination.

I think this covers your use case.

All the best, Ashok


"Martin J. Duerst" <duerst@w3.org>@w3.org on 01/12/2001 11:43:46 AM

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


To:   "Joseph M. Reagle Jr." <reagle@w3.org>, Ashok
      Malhotra/Watson/IBM@IBMUS
cc:   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>
Subject:  Re: XML Schema Question



At 01/01/11 16:40 -0500, Joseph M. Reagle Jr. wrote:
>Hi Ashok. I don't think this would do the trick (they are all optional,
>but there must be one of them because it'd be silly to have their parent
>be empty), plus we couldn't meet the requirments of the SG since they are
>of different types!

You can still use Ashok's approach, I guess. Just make a parent type
that you declare abstract and keep as general as possible (i.e.
'anything goes').

Regards,   Martin.



>Regardless, we'll go othe "silly" route, I just wanted to make sure I
>wasn't missing some clever trick.
>
>At 09:31 1/11/2001 -0500, Ashok Malhotra wrote:
>
>>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?
>
>
>__
>Joseph Reagle Jr.
>W3C Policy Analyst                mailto:reagle@w3.org
>IETF/W3C XML-Signature Co-Chair   http://www.w3.org/People/Reagle/
>
Received on Monday, 15 January 2001 16:41:29 GMT

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