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

Re: Duplicate attribute uses (Xerces bug?)

From: Kasimier Buchcik <kbuchcik@4commerce.de>
Date: Mon, 12 Sep 2005 16:00:50 +0200
To: George Cristian Bina <george@sync.ro>
Cc: XML-SCHEMA <xmlschema-dev@w3.org>
Message-Id: <1126533650.1272.62.camel@librax>


On Mon, 2005-09-12 at 16:29 +0300, George Cristian Bina wrote:
> Hmm, I think you are right... According with the spec the {attribute 
> uses} will be
> ***
> {attribute uses}	A union of sets of attribute uses as follows:
> 1 The set of attribute uses corresponding to the <attribute> [children], 
> if any.
> 2 The {attribute uses} of the attribute groups ·resolved· to by the 
> ·actual value·s of the ref [attribute] of the <attributeGroup> 
> [children], if any.
> 3 The {attribute uses} of the type definition ·resolved· to by the 
> ·actual value· of the base [attribute], unless the <restriction> 
> alternative is chosen, in which case some members of that type 
> definition's {attribute uses} may not be included, namely those whose 
> {attribute declaration}'s {name} and {target namespace} are the same as 
> one of the following:
> 3.1 The {name} and {target namespace} of the {attribute declaration} of 
> an attribute use in the set per clause 1 or clause 2 above;
> 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.
> ***
> a set consisting of one attribute use corresponding to
> <xsd:attribute name="boo"/>
> from the "type" complex type.
> Now, the error reported by Xerces is wrong but do you see a benefit of 
> allowing this? IMO a duplicate attribute element should be an error.

Yes, you are right; I see no benefit, although I would tend to generate
a warning instead of an error.

I reported XSV output incorrectly. Stylus Studio gave
me a: "Success - no validation error or warning conditions found."
But this was related to the validation of the instance. The exact
XSV output reads:

<schemaError char="5" line="14" phase="instance"             
   attempt to redeclare attribute {None}:boo, ignored</schemaError>

I see no rule for this as well, since we have:

"Note: The only substantive function of the value prohibited for the use
attribute of an <attribute> is in establishing the correspondence
between a complex type defined by restriction and its XML
representation. It serves to prevent inheritance of an identically named
attribute use from the {base type definition}. Such an <attribute> does
not correspond to any component, and hence there is no interaction with
either explicit or inherited wildcards in the operation of Complex Type
Definition Validation Rules (§3.4.4) or Constraints on Complex Type
Definition Schema Components (§3.4.6)."
It talks about inheritance if using the XML representation, not about
prohibitions interfering with an attribute declaration in the same
type component.

At the component level, we still have the derivation-ok-restriction 2
[1] constraint to check if both declarations are OK for the restriction.

So is a prohibition meant to say: "don't inherit it from the base type
and don't allow it on the current type"?

Hmm, after trying the following with XSV:

<xsd:complexType name="type-2">
	<xsd:attribute name="boo" use="prohibited"/>
	<xsd:attribute name="boo" use="prohibited"/>

for which I get the same schema error:

"attempt to redeclare attribute {None}:boo, ignored"

... it feels like XSV does not even check if this is a prohibition
or not. So I cannot use XSV as a reference here.

[1] http://www.w3.org/TR/xmlschema-1/#derivation-ok-restriction


Received on Monday, 12 September 2005 14:06:59 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 7 January 2015 14:56:08 UTC