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

Re: all group

From: Avin Patel <vze49rz3@verizon.net>
Date: Thu, 2 Jan 2003 15:48:03 -0500
Message-ID: <012101c2b2a0$3f2a6650$643a42d1@Avin>
To: "xmlschema" <xmlschema-dev@w3.org>

Hi,
Thank you for reply.
What is difference between following 2 schemas:
1)
 <xsd:complexType name="Type1">
    <xsd:all>
       <xsd:element name="elem1" type="xsd:integer"/>
       <xsd:element name="elem2" type="Type2"/>
   </xsd:all>
 </xsd:complexType>

 <xsd:complexType name="Type2">
   <xsd:all>
        <xsd:element name="elem1" type="xsd:integer"/>
        <xsd:element name="elem2" type="xsd:boolean"/>
   </xsd:all>
 </xsd:complexType>

2)
 <xsd:complexType name="Type1">
    <xsd:all>
       <xsd:element name="elem1" type="xsd:integer"/>
       <xsd:element name="elem2" >
            <xsd:complexType>
               <xsd:all>
                   <xsd:element name="elem1" type="xsd:integer"/>
                   <xsd:element name="elem2" type="xsd:boolean"/>
               </xsd:all>
            </xsd:complexType>
   </xsd:all>
 </xsd:complexType>

XML data:
a)
Value for Schema definition 1:
 <Type1>
    <elem1>3</elem1>
     <elem2>
        <Type2>
            <elem1>4</elem1>
            <elem2>true</elem2>
        </Type2>
     </elem2>
</Type1>

b)
value for Schema definition 2, Can't be applicable to definition 1:
 <Type1>
    <elem1>3</elem1>
     <elem2>
            <elem1>4</elem1>
            <elem2>true</elem2>
      </elem2>
</Type1>

Are these value definition are correct. I mean definition 1 should have
<Type2> tag & definition 2 should not have any tag for Type2.

Thank you,
Avin Patel

----- Original Message -----
From: "Henry S. Thompson" <ht@cogsci.ed.ac.uk>
To: "Avin Patel" <vze49rz3@verizon.net>
Cc: "xmlschema" <xmlschema-dev@w3.org>
Sent: Monday, December 30, 2002 8:09 AM
Subject: Re: all group



"Avin Patel" <vze49rz3@verizon.net> writes:

> Hi All,
> I want to use all group in all group. As I know all group can't have one
of
> the following:
> 1)can't contain other group
> 2)can't be contained in other group
> 3)must be at top level of complex type
> 4)can't occur multiple time
>
> But I can always use all group in all group as following definition, is it
> correct:
>
> <xsd:complexType name="Type1">
>    <xsd:all>
>       <xsd:element name="elem1" type="xsd:integer"/>
>       <xsd:element name="elem2" type="Type2"/>
>   </xsd:all>
> </complexType>
>
> <xsd:complexType name="Type2">
>   <xsd:all>
>        <xsd:element name="elem1" type="xsd:integer"/>
>        <xsd:element name="elem2" type="xsd:boolean"/>
>   </xsd:all>
> </complexType>

Sure, but the result will be to allow

 <elem1>3</elem1>
 <elem2><elem1>4</elem1>
        <elem2>true</elem2>
 </elem2>

etc., which may not be what you wanted.

ht
--
  Henry S. Thompson, HCRC Language Technology Group, University of Edinburgh
          W3C Fellow 1999--2002, part-time member of W3C Team
     2 Buccleuch Place, Edinburgh EH8 9LW, SCOTLAND -- (44) 131 650-4440
    Fax: (44) 131 650-4587, e-mail: ht@cogsci.ed.ac.uk
     URL: http://www.ltg.ed.ac.uk/~ht/
 [mail really from me _always_ has this .sig -- mail without it is forged
spam]
Received on Thursday, 2 January 2003 15:48:32 GMT

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