XML technologies / XML Schema / XML Schema element reference / xs:anyAttribute

(Excerpt from “XML Schema” by Eric van der Vlist)

Wildcard for arbitrary attributes.

<xs:anyAttribute
    id = xs:ID
    namespace = ( ( "##any" | "##other" ) | list of ( xs:anyURI | ( "##targetNamespace" | "##local" ) ) ) : "##any"
    processContents = ( "skip" | "lax" | "strict" ) : "strict"
    {beliebige Attribute mit einem Nicht-Schema-Namensraum}
    >
    Content: (xs:annotation?)
</xs:anyAttribute>

May occur within: xs:attributeGroup (global definition), xs:complexType (local definition), xs:complexType (global definition), xs:extension (complex content), xs:extension (simple content), xs:restriction (complex content), xs:restriction (simple content)

Description

xs:anyAttribute is a wildcard allowing an arbitrary attribute from one of several namespaces. This particle can appear wherever a local attribute declaration reference is allowed, within a definition of complexType or attributeGroup.

The list of permitted namespaces is specified with attribute namespace, a list of namespace URIs. Two values have special meanings: ##targetNamespace denotes the target namespace, and ##local denotes local elements without namespaces. Both can occur alongside ordinary URIs. Two other special values can replace the whole list: ##any denotes any namespace and is the default for attribute namespace, while ##other denotes any namespace except the target. If ##other is used in a schema without a target namespace, all namespaces are allowed and only unqualified attributes are forbidden.

The target namespace used to interpret special values ##targetNamespace and ##other is that, or its absence, of the schema containing wildcard xs:anyAttribute. Importing the schema into another does not change this.

Validator behavior for permitted attributes is specified with attribute processContents. If processContents is strict, the default, processors must validate against the attributes’ schemas and report an error for invalid attributes or unavailable schemas. If the value is skip, processors do not validate these attributes. If it is lax, the validator validates attributes when it can find a definition, otherwise skips them.

If the setting processContents skip applies, or equivalently if the value is lax and no schema was found for an attribute, further validation is skipped and accepted attributes may have any data type.

If the setting processContents strict applies, or equivalently if the value is lax and a schema was found, accepted attributes must be global attributes in their namespace’s schema.

Restrictions

Useful namespace combinations for open multinamespace vocabularies are missing, including any namespace known to the current validation context and its opposite, any namespace unknown to that context.

The behavior of special value ##other for unqualified attributes in schemas with target namespaces is contradictory in the W3C XML Schema recommendation and should be clarified in a future appendix. Despite a contrary passage, the likely interpretation disallows unqualified attributes when ##other is specified in these schemas.

Attributes

id
Element ID according to W3C XML Schema.

namespace
Permitted namespaces.

processContents
Validation mode for attributes accepted by this wildcard.

   

 

 

 

back to top