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

Re: Attribute prohibition with a "ref"

From: Kasimier Buchcik <K.Buchcik@4commerce.de>
Date: Tue, 27 Sep 2005 17:56:32 +0200
To: Kasimier Buchcik <K.Buchcik@4commerce.de>
Cc: XML-SCHEMA <xmlschema-dev@w3.org>
Message-Id: <1127836592.1274.42.camel@librax>

Hi,

Ah, sorry me, I missed to set form="qualified" in the
attribute declaration of the base type.
Changing this, I get the same results from all processors:
the schema is valid, and the attribute "bar" in the instance
is not valid.

So it seems that the form
<xs:attribute ref="myns:someAttr" use="prohibited"/>
is indeed allowed and processed correctly by the
processors.

Regards,

Kasimier

On Tue, 2005-09-27 at 17:44 +0200, Kasimier Buchcik wrote:
> Hi,
> 
> Does the spec mention how to handle the following
> piece of XML representation?
> 
> <xs:attribute ref="myns:someAttr" use="prohibited"/>
> 
> Libxml2 gets confused with this, so I want to fix this.
> 
> Test case:
> 
> attr-gr-1.xsd
> -------------
> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"	
> 	targetNamespace="urn:test:foo"
> 	xmlns:f="urn:test:foo">
> 
> 	<xs:attribute name="bar"/>
> 
> 	<xs:complexType name="base">
> 		<xs:attribute name="bar"/>

This should read:
  <xs:attribute name="bar" form="qualified"/>

> 	</xs:complexType>
> 
> 	<xs:element name="foo">
> 		<xs:complexType>
> 			<xs:complexContent>
> 				<xs:restriction base="f:base">
> 					<xs:attribute ref="f:bar" use="prohibited"/>
> 				</xs:restriction>
> 			</xs:complexContent>
> 		</xs:complexType>
> 	</xs:element>
> 
> </xs:schema>
> 
> attr-gr-1.xml
> -------------
> <foo xmlns="urn:test:foo"
> 	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> 	xsi:schemaLocation="urn:test:foo attr-gr-1.xsd"
> 	bar="lala"/>
> 
> 
> Xerces-J 2.7.1 and XSV 2.10: no errors.
> 
> Libxml2: No errors by accident due to a malfunction.
> 
> Saxon 8.5.1:
> 
> Error on line 13 of file:/p:/libxml2-lab/tests/2005-09-27/attr-gr-1.xsd:
>   Invalid restriction: attribute @bar is not defined in the base type
> Error on line 13 of file:/p:/libxml2-lab/tests/2005-09-27/attr-gr-1.xsd:
>   The attributes of complex type of element foo are not a restricted
> subset of the
>   attributes of the type base
> Warning: The schema is invalid
> 
> SQC:
> 
> ERROR
>  file = file:P:/libxml2-lab/tests/2005-09-27/attr-gr-1.xsd line 19
> column 20
> SEVERITY: 0
> ERROR TYPE: 2
> MESSAGE 
>  Attribute bar's use is prohibited, but the base type did not include an
> attribute named bar.
> 
> 
> >From the definition for {attribute uses} of complex types:
> 
> "...3.2 what would have been the {name} and {target namespace} of the
> {attribute declaration} of an attribute use in the set per clause 1
> above but for the ·actual value· of the use [attribute] of the relevant
> <attribute> among the [children] of <restriction> being prohibited."
> 
> Is it true that this does not say whether this 'imagined' 
> attribute declaration _must_ be locally declared? So one can
> use attribute references as well?
> 
> Additionally, there's no constraint in the spec, which does rule
> out all the other (useless) attributes of an <xs:attribute> if it
> comes as a prohibition, right?
> 
> Regards,
> 
> Kasimier
> 
Received on Tuesday, 27 September 2005 15:57:18 GMT

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