W3C home > Mailing lists > Public > xmlschema-dev@w3.org > November 2004

Re: Understanding anyAttribute namespace="##any" and anyAttribute namespace="##local"

From: George Cristian Bina <george@oxygenxml.com>
Date: Tue, 02 Nov 2004 00:35:04 +0200
Message-ID: <4186BA18.40102@oxygenxml.com>
To: "W. Eliot Kimber" <ekimber@innodata-isogen.com>
CC: xmlschema-dev@w3.org

Hi Eliot,

There is an attribute called processContents on the xs:anyAttribute 
element. The default value for this attribute is "strict" which means 
that a full validation is performed on the attributes that will appear 
in the instance documents. If you add the 
xs:anyAttribute/@processContents attribute with the value set to skip 
for instance then your instance document should be reported as valid. 
Otherwise define your foo atribute in your schema file.

Hope that helps,

W. Eliot Kimber wrote:
> I'm trying to understand how anyAttribute works and I'm getting a result 
> that seems to be incorrect but I'm sure it's my lack of understanding.
> What I have in my schema is this declaration:
>   <xs:complexType name="metadata">
>     <xs:choice maxOccurs="unbounded" minOccurs="0">
>       <xs:element name="metadata" type="mtbitopic:metadata"/>
>       <xs:element name="metadataitem" type="mtbitopic:metadataitem"/>
>       <xs:any namespace="##other"/>
>     </xs:choice>
>     <xs:anyAttribute namespace="##local"/>
>   </xs:complexType>
> Note the "##local" for anyAttribute. The attributeFormDefault is set to 
> "unqualified".
> In my instance governed by this schema, I have this markup:
> <metadata foo="bar"/>
> However, when I validate the document, both oXygen and Stylus Studio 
> report that the attribute "foo" is not allowed for the element metadata.
> What basic but subtle aspect of XSD am I missing here.
> Also, is there a way to say that you want to allow any qualified or 
> unqualified attributes? It doesn't appear to be the case but I have such 
> a hard time decoding the spec itself that I'm not sure what the actual 
> syntax of the namespace= attribute is, so I'm going off what I've 
> learned from the various tutorials I could find online.
> Thanks,
> Eliot
Received on Monday, 1 November 2004 21:39:38 UTC

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