RE: implementing redefines - additional test

I think, and Saxon thinks, that this is clearly an error:

Error at xs:simpleType on line 7 of file:/c:/temp/final7.xsd:
  Cannot refine the simple type base because it is not present in the
redefined schema

(It is problematic, of course, because the spec for redefine, like that for
include, is very muddled about whether you're loading a set of schema
components (a schema) or a schema document. It seems to be something in
between - you're loading a set of partially created schema components that
are still strongly linked to the schema document in which they were defined.
Until the spec sorts out this basic problem, it's going to be very hard to
specify redefine more precisely.)

Michael Kay 

> -----Original Message-----
> From: xmlschema-dev-request@w3.org 
> [mailto:xmlschema-dev-request@w3.org] On Behalf Of Kasimier Buchcik
> Sent: 12 August 2005 17:41
> To: XML-SCHEMA
> Subject: implementing redefines - additional test
> 
> 
> Hi,
> 
> this is a supplement to the mail:
> http://lists.w3.org/Archives/Public/xmlschema-dev/2005Aug/0018.html
> 
> An additional _very_ interesting test; I'm still using XSV 2.10-1 and
> Xerces-J 2.7.1:
> 
> base.xsd
> --------
> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
> 	<xs:simpleType name="base">
> 		<xs:restriction base="xs:integer">
> 			<xs:maxInclusive value="5"/>
> 		</xs:restriction>
> 	</xs:simpleType>
> </xs:schema>
> 
> dummy.xsd (just defines a type "dummy")
> ---------
> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">	
> 	<xs:simpleType name="dummy">
> 		<xs:restriction base="xs:string"/>
> 	</xs:simpleType>
> </xs:schema>
> 
> final7.xsd
> ----------
> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">		
> 	<xs:include schemaLocation="base.xsd"/>
> 	<xs:redefine schemaLocation="dummy.xsd">
>         	<!-- Note that we are redefining "base",
> 		     but "base" is not in "dummy.xsd".
> 		-->
> 		<xs:simpleType name="base">
> 			<xs:restriction base="base">
> 				<xs:maxInclusive value="4"/>
> 			</xs:restriction>
> 		</xs:simpleType>
> 	</xs:redefine>	
> 	<xs:element name="foo" type="base"/>
> </xs:schema>
> 
> instance.xml
> ------------
> <foo xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> 	xsi:noNamespaceSchemaLocation="final7.xsd">
> 	5
> </foo>
> 
> Validation of instance.xml with final7.xsd
> ------------------------------------------
> 
> Xerces-J:
> instance.xml:5,7: (Error) cvc-maxInclusive-valid: Value '5' is not
> facet-valid with respect to maxInclusive '4' for type 'base'.
> instance.xml:5,7: (Error) cvc-type.3.1.3: The value '5' of 
> element 'foo'
> is not valid.
> 
> XSV:
> instance.xml:1,22: element content failed type check: 5 >4
> 
> 
> Although we redefine "dummy.xsd", which neither contains, nor
> includes/imports the "base" type, this type was somehow redefined;
> then the value "5" in the instance was recognized to be invalid.
> Is this the expected behaviour or a bug? Need the redefined
> component not to be found when following the schema graph, starting
> with the explicitely mentioned redefined document?
> If the behaviour is expected, then what's the sense of the
> schemaLocation attribute of a <redefine>, if we just need to
> <include> the component to be able to redefine it?
> 
> Regards,
> 
> Kasimier
> 
> 

Received on Saturday, 13 August 2005 07:46:01 UTC