Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


RE: anyAttribute via attributeGroup refs problem

From: "Michael Kay" <mike@--------.--->
To: "'Christian Roth'" <roth@-----------.-->, "'XML Schema Development List'"
Date: 11/11/2008 11:11:00 AM
There is a very surprising rule here: when you reference two attribute
groups and they both contain attribute wildcards, you get the intersection
of the wildcards, not the union as you might expect. In this case of course
the intersection is empty.

As it happens the WG debated changing this rule (at some length) a couple of
weeks ago, and decided to make no change - partly for backwards
compatibility reasons, partly because someone thinks there are use cases
where it makes sense to take the intersection, partly because you can get
the union if you want it by defining two types, one of which extends the
other (when type T extends type S, the attribute wildcard is the union of
those defined on T and S).

Michael Kay
http://www.saxonica.com/


> -----Original Message-----
> From: xmlschema-dev-request@w... 
> [mailto:xmlschema-dev-request@w...] On Behalf Of Christian Roth
> Sent: 11 November 2008 10:43
> To: XML Schema Development List
> Subject: anyAttribute via attributeGroup refs problem
> 
> 
> 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