xs:anyAttribute

Purpose

This element can be used to specify attribute wildcards in complex type definitions. It allows the occurrence of arbitrary attributes with the current element in the XML instance to be validated against the schema.

The details of the validation of this fragment of XML code are specified with the processContents attribute. The origin of the XML code can be specified using the namespace attribute.

Parent element xs:complexType, xs:extension
Child elements None
Attributes namespace, processContents
Attributes
Name Type Description
namespace

xs:anyURI or one of the special values ##any, ##other, ##local, ##targetNamespace

The namespace attribute can only have the following values:

  • ##any
    Attributes belonging to any namespace match xs:anyAttribute. This is the default value.

  • ##other
    Attributes belonging to any non-absent namespace other than the current schema's targetNamespace match xs:anyAttribute.

  • Item list
    A whitespace-separated list of items, each of which matches one of the following:

    • An arbitrary URI
      The item must be a valid URI with respect to the predefined type xs:anyURI. Only attributes belonging to the corresponding namespace are accepted during validation.

    • ##local
      Only attributes without a namespace are allowed.

    • ##targetNamespace
      Only attributes belonging to the current schema's targetNamespace match.

    Only attributes that are valid with respect to at least one of the items are accepted.

processContents xs:NMTOKEN

This attribute specifies whether strict or simplified validation is performed. It can have the values:

  • "strict"

  • "lax"

  • "skip"

The default value is "strict".

These validation methods differ in their behavior if they encounter attributes without a corresponding definition of a global attribute.

If "lax" is specified, the XML processor only validates the attributes for which it can obtain schema information, but for attributes where no corresponding definition of a global attribute is available, no errors are signalled.

If "strict" is specified, each attribute must validate against a corresponding global attribute definition.

If "skip" is chosen, the respective attributes are not validated at all.