Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


anyAttribute via attributeGroup refs problem

From: "Christian Roth" <roth@-----------.-->
To: "XML Schema Development List" <xmlschema-dev@--.--->
Date: 11/11/2008 10:45:00 AM
Hello,

during schema development, I stumbled upon the following issue with
anyAttribute elements included via an attributeGroup reference into a
complexType:

-- instance.xml --
<root 
  xsi:noNamespaceSchemaLocation="schema.xsd"
  xmlns:ns1="ns1"
  xmlns:ns2="ns2"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  ns1:attr="val1" 
  ns2:attr="val2"
/>

-- schema.xsd --
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
  <xs:element name="root">
    <xs:complexType>
      <xs:attributeGroup ref="ns1-atts"/>
      <xs:attributeGroup ref="ns2-atts"/>
    </xs:complexType>
  </xs:element>
  
  <xs:attributeGroup name="ns1-atts">
      <xs:anyAttribute namespace="ns1" processContents="skip"/>
  </xs:attributeGroup>
  
  <xs:attributeGroup name="ns2-atts">
      <xs:anyAttribute namespace="ns2" processContents="skip"/>
  </xs:attributeGroup>
</xs:schema>


I expected the given schema to validate the instance document, however I
am presented with the following validation errors:

[Xerces] cvc-complex-type.3.2.2: Attribute 'ns1:attr' is not allowed to
appear in element 'root'.
[Xerces] cvc-complex-type.3.2.2: Attribute 'ns2:attr' is not allowed to
appear in element 'root'.

In my understanding, both of them are allowed via the anyAttribute
element allowing all attributes in the respective namespace name via wildcard.

When I comment out *one* of the attributeGroup references in the "root"
element's content model, the remaining namespace's attribute is no
longer reported as an error, just the namespace's attribute that has
been commented out (as expected).

Is this a problem with my schema file (and if so, why does it validate
both standalone and when performing the actual validation on an
instance) or a bug in the validator? I have tried Xerces and SaxonSA,
both with identical behaviour.

Regards,
Christian




transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent