W3C home > Mailing lists > Public > www-xml-schema-comments@w3.org > October to December 2009

[Bug 8119] defaultAttributes and complexType extension/restriction don't play nice

From: <bugzilla@wiggum.w3.org>
Date: Mon, 09 Nov 2009 20:27:30 +0000
To: www-xml-schema-comments@w3.org
Message-Id: <E1N7apm-00085h-NX@wiggum.w3.org>
http://www.w3.org/Bugs/Public/show_bug.cgi?id=8119





--- Comment #5 from Kevin Braun <kbraun@obj-sys.com>  2009-11-09 20:27:30 ---
> In the example in comment #0, there is a single attribute group definition
> component, with a single attribute use component in its {attribute uses}
> property...

> ...there is a *single* attribute use component, the union should *not* result 
> in 2 entries in "TypeB"'s {attribute uses}, and the relevant constraint 
> (clause 4 of section 3.4.6.1) is *not* violated.

> ... These 2 cases are different. 2 references to the same attribute group
> component result in a single attribute use; 2 locally declared attributes
> result in 2 distinct attribute use components.

Good point.  I missed this.

As a side note, here is a schema that would present the same case, I think. 
XSV and Xerces both report errors on it:
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">

   <xs:attributeGroup name="AttrGroup">
      <xs:attribute name="a_default" type="xs:string"/>
   </xs:attributeGroup>

   <xs:complexType name="TypeA">
      <xs:attributeGroup ref="AttrGroup"/>
   </xs:complexType>

   <xs:complexType name="TypeB">
      <xs:complexContent>
         <xs:extension base="TypeA">
            <xs:attributeGroup ref="AttrGroup"/>
         </xs:extension>
      </xs:complexContent>
   </xs:complexType>

</xs:schema>
XSV reports: 11:4: Invalid: attempt to extend with an attribute already
declared {{None}:a_default}
Xerces reports: [14,49]: ct-props-correct.4: Error for type 'TypeB'. Duplicate
attribute uses with the same name and target namespace are specified.  Name of
duplicate attribute use is 'a_default'.

Based on the above, I assume these implementations are incorrect; there is only
a single attribute use component involved.

Given the above, some of what I said would no longer be an issue.  You would
still have some cases of restriction where a default of
defaultAttributesApply="false" would be preferable, but it becomes less of an
issue.

Other than perhaps adopting Sandy's suggested revision of clause 4 of section
3.4.6.1, I think this can be closed.  Sorry for taking your time.


-- 
Configure bugmail: http://www.w3.org/Bugs/Public/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
Received on Monday, 9 November 2009 20:27:39 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Sunday, 6 December 2009 18:13:19 GMT