Re: Feature incompatiblity in XML Schema 1.0

"Matthew Fuchs" <matt@westbridgetech.com> writes:

> I believe this is (or ought to be) illegal because the restriction may allow
> content not legal in the parent.

I think under both the current REC and the proposed move to
extensional checking, the restriction in the final schema doc. is
broken, because the substitution group heads are mandated to be
treated as implicit <choice>s over their group membership, so you end
up trying to 'restrict' <y> with (<y>|<y-prime>), which is not
allowed.

What made you suspect it was OK?


> However, if it is legal, you win the grand
> prize - an example where static type checking, as I've defined it elsewhere,
> is broken.  Note my insertions below.

Doesn't obtain, since it isn't legal, but I'm still not happy about
your definition of static type checking, or any suggestion we should
enforce it.

ht
> 
> -----Original Message-----
> From: www-xml-schema-comments-request@w3.org
> [mailto:www-xml-schema-comments-request@w3.org]On Behalf Of Henry S.
> Thompson
> Sent: Thursday, December 05, 2002 1:52 AM
> To: Don Box
> Cc: www-xml-schema-comments@w3.org; Ashok Malhotra; Martin Gudgin; Allen
> Brown
> Subject: Re: Feature incompatiblity in XML Schema 1.0
> 
> 
> 
> You analysis is correct, but I don't understand the implicit
> evaluative component of your message - why is this a problem that
> needs to be fixed?  By making a declaration both local and qualified,
> the author has essentially staked a permanent claim on the association
> between those qualifided names and their types in that context.  You can
> override this, but to do so you have to usurp the author's namespace
> explicitly, either using <redefine>, or as follows:
> 
> a.xsd:
> <xs:schema targetNamespace="urn:a:aaa"
>   xmlns:xs="http://www.w3.org/2001/XMLSchema"
>   xmlns:a="urn:a:aaa" >
>   <xs:complexType name="Base" >
>     <xs:sequence>
>       <xs:element name="x" type="xs:int" form="qualified" />
>       <xs:element name="y" type="xs:int" minOccurs="0" form="qualified"/>
>     </xs:sequence>
>   </xs:complexType>
>   <xs:element name="BE" type="a:Base" />
> </xs:schema>
> 
> aprime.xsd:
> <xs:schema targetNamespace="urn:a:aaa"
>   xmlns:xs="http://www.w3.org/2001/XMLSchema"
>   xmlns:a="urn:a:aaa" >
>  <xs:include schemaLocation="a.xsd"/>
>  <xs:element name="y" type="xs:int"/>
>  <xs:element name="x" type="xs:int"/>
> </xs:schema>
> 
> <xs:schema targetNamespace="urn:b:bbb"
>   xmlns:a="urn:a:aaa"
>   xmlns:xs="http://www.w3.org/2001/XMLSchema">
>  <xs:import namespace="urn:a:aaa" schemaLocation="aprime.xsd"/>
>   <!-- MDF - note use of substitution groups -->
>   <xs:element name="y-prime" type="xs:int" substitutionGroup="a:y"/>
>   <xs:element name="x-prime" type="xs:int" substitutionGroup="a:x"/>
>   <!-- MDF -->
>   <xs:complexType name="Derived">
>     <xs:complexContent>
>       <xs:restriction base="a:Base" >
>         <xs:sequence>
>           <xs:element ref="a:x" />
>           <xs:element ref="a:y" minOccurs="1" />
>         </xs:sequence>
>       </xs:restriction>
>     </xs:complexContent>
>   </xs:complexType>
> </xs:schema>
> 
> As long as the local element decls you want to appropriate don't have
> anonymous type definitions, such a move is always possible.
> 
> MDF>  Because of the presence of substitution groups, the restriction would
> allow
> 
> <a:BE
> xsi:type="b:Derived"><b:x-prime>0</b:x-prime><b:y-prime>1</b:y-prime></a:BE>
> 
> which clearly is not valid for <a:BE>.  Once again, very nasty non-local
> effects become possible - the element subtypes could be in a third schema
> completely.  It's also very nasty for implementation - since there could be
> any number of layers, restrictions with qualified elements would need to be
> matched against all the ancestor types, not just the most local one - I'll
> be no one does this.  Therefore, if this is not illegal, it should be made
> so.
> 
> Matthew
> 
> 
> 

-- 
  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 Wednesday, 11 December 2002 03:48:40 UTC