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

Are attribute prohibitions in attribute groups pointless?

From: Kasimier Buchcik <K.Buchcik@4commerce.de>
Date: Tue, 27 Sep 2005 19:16:36 +0200
To: XML-SCHEMA <xmlschema-dev@w3.org>
Message-Id: <1127841396.1274.69.camel@librax>

Hi,

Potential bug in Libxml2 2.6.22 and Saxon 8.5.1:
attribute prohibitions defined in attribute groups
are significant with those processors.

Attribute uses for attribute groups:

"{attribute uses}The union of the set of attribute uses corresponding to
the <attribute> [children], if any, with the {attribute uses} of the
attribute groups ·resolved· to by the ·actual value·s of the ref
[attribute] of the <attributeGroup> [children], if any."

The question is: are attribute prohibitions in
<attributeGroup>s pointless?

Xerces-J 2.7.1 and XSV 2.10 seem to skip such attribute
prohibitions.

Test case (I double-checked the test this time ;-) ):

attr-gr-2.xsd
-------------
xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"	
	targetNamespace="urn:test:foo"
	xmlns:f="urn:test:foo"
	attributeFormDefault="qualified">

	<xs:attribute name="bar"/>

	<xs:complexType name="base">
		<xs:attribute name="bar"/>
	</xs:complexType>

	<xs:attributeGroup name="group">
		<xs:attribute name="bar" use="prohibited"/>
	</xs:attributeGroup>

	<xs:element name="foo">
		<xs:complexType>
			<xs:complexContent>
				<xs:restriction base="f:base">
					<xs:attributeGroup ref="f:group"/>
				</xs:restriction>
			</xs:complexContent>
		</xs:complexType>
	</xs:element>

</xs:schema>

attr-gr-2.xml
-------------
<foo xmlns="urn:test:foo" xmlns:f="urn:test:foo"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xsi:schemaLocation="urn:test:foo attr-gr-2.xsd"
	f:bar="lala"/>

XSV 2.10, Xerces-J 2.7.1:

No errors.

Saxon 8.5.1:

Validation error on line 6 column 16 of
file:/p:/libxml2-lab/tests/2005-09-27/attr-gr-2.xml:
  Attribute @bar is not allowed on element <foo>

Libxml2 2.6.22:

Element '{urn:test:foo}foo', attribute '{urn:test:foo}bar': The
attribute '{urn:test:foo}bar' is not allowed.


While Saxon and Libxml2 seem to have applied the attribute
prohibition, the other two processors have not.

Regards,

Kasimier
Received on Tuesday, 27 September 2005 17:16:58 GMT

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