W3C home > Mailing lists > Public > xmlschema-dev@w3.org > July 2002

RE: Is this valid?

From: Dare Obasanjo <dareo@microsoft.com>
Date: Mon, 22 Jul 2002 10:53:58 -0700
Message-ID: <8BD7226E07DDFF49AF5EF4030ACE0B7E06621E1C@red-msg-06.redmond.corp.microsoft.com>
To: "Jeni Tennison" <jeni@jenitennison.com>, <xmlschema-dev@w3.org>

I thought that but would like to know if the REC allows it given the rules in 
Specifically can 
  <xs:sequence minOccurs="0">
                    <xs:element name="a1"/>
                    <xs:element name="b1"/>
be restricted to 
 <xs:element name="b1"/>
given the wording [not intentions] of the REC? 

	-----Original Message----- 
	From: Jeni Tennison [mailto:jeni@jenitennison.com] 
	Sent: Mon 7/22/2002 10:47 AM 
	To: xmlschema-dev@w3.org; Dare Obasanjo 
	Subject: Re: Is this valid?

	Hi Dare,
	>     <xs:complexType name="A">
	>         <xs:sequence>
	>            <xs:element name="f"/>
	>            <xs:choice>
	>                <xs:choice minOccurs="1">
	>                    <xs:element name="a"/>
	>                   <xs:element name="b"/>
	>                 </xs:choice>
	>                 <xs:sequence minOccurs="0">
	>                     <xs:element name="a1"/>
	>                     <xs:element name="b1"/>
	>                 </xs:sequence>
	>             </xs:choice>
	>        </xs:sequence>
	>     </xs:complexType>
	>    <xs:complexType name="B">
	>         <xs:complexContent>
	>             <xs:restriction base="A">
	>             <xs:sequence>
	>                 <xs:element name="f"/>
	>                 <xs:choice>
	>                     <xs:element name="a"/>
	>                     <xs:element name="b1"/>
	>                 </xs:choice>
	>            </xs:sequence>
	>           </xs:restriction>
	>         </xs:complexContent>
	>     </xs:complexType>
	Just looking at it, I don't think so. Under a restriction, it
	shouldn't be possible to come up with a content model that's valid for
	the restricted type but isn't valid for the base type, and it is
	possible in this case:
	  <f />
	  <b1 />
	is valid for B, but isn't valid for A (in A, every b1 must be preceded
	by an a1).
	Jeni Tennison
Received on Monday, 22 July 2002 13:54:32 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 23:15:04 UTC