W3C home > Mailing lists > Public > xmlschema-dev@w3.org > August 2005

implementing redefines - additional test

From: Kasimier Buchcik <kbuchcik@4commerce.de>
Date: Fri, 12 Aug 2005 18:40:34 +0200
To: XML-SCHEMA <xmlschema-dev@w3.org>
Message-Id: <1123864834.16773.22.camel@librax>

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 Friday, 12 August 2005 16:40:38 GMT

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