W3C home > Mailing lists > Public > xmlschema-dev@w3.org > December 2006

Interaction of explicit attributes and wildcards

From: Michael Kay <mike@saxonica.com>
Date: Fri, 8 Dec 2006 16:29:37 -0000
To: <xmlschema-dev@w3.org>
Message-ID: <00f501c71ae6$0df04980$6401a8c0@turtle>

According to several schema processors, (Saxon, Xerces, MS .NET), the
following instance:

<e att1="banana"/>

is valid against the following schema:

<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
elementFormDefault="qualified" attributeFormDefault="unqualified">

	<xs:complexType name="B">
		<xs:sequence/>
		<xs:attribute name="att1" use="optional" type="xs:decimal"/>
		<xs:anyAttribute namespace="##local"
processContents="skip"/>
	</xs:complexType>

	<xs:complexType name="R">
		<xs:complexContent>
			<xs:restriction base="B">
				<xs:attribute name="att1" use="prohibited"/>
				<xs:anyAttribute namespace="##local"
processContents="skip"/>
			</xs:restriction>
		</xs:complexContent>
	</xs:complexType>

	<xs:element name="e" type="R"/>
</xs:schema>

But change the element declaration to <xs:element name="e" type="B"/>, and
validation fails, saying that "banana" is not a valid xs:decimal (the same
set of schema processors agree on this).

Surely the element cannot be a valid instance of R unless it is also a valid
instance of B?

Michael Kay
http://www.saxonica.com/
Received on Friday, 8 December 2006 16:29:48 GMT

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