Interaction of explicit attributes and wildcards

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 UTC