<xsd:anyAttribute> Element

Enables any attribute from the specified namespace(s) to appear in the containing complexType element or in the containing attributeGroup element.

<anyAttribute
  id = ID 
  namespace = ((##any | ##other) | List of (anyURI | (##targetNamespace | ##local))) : ##any 
  processContents = (lax | skip | strict): strict 
  {any attributes with non-schema Namespace...}>
Content: (annotation?)
</anyAttribute>

Attributes

  • id
    The ID of this element. The id value must be of type ID and be unique within the document containing this element.

    Optional.

  • namespace
    The namespace containing the attributes that can be used. If no namespace is specified, ##any is the default. If the namespace is specified, it must one of the following.

    ##any

    Attributes from any namespace can be present.

    ##other

    Attributes from any namespace that is not the target namespace of the parent element containing this anyAttribute element can be present.

    ##local

    Attributes that are not qualified with a namespace can be present.

    ##targetNamespace

    Attributes from the target namespace of the parent element containing this anyAttribute element can be present.

    List of {URI references, ##targetNamespace, ##local}

    Attributes from a space-delimited list of the namespaces can be present. The list can contain the following: URI references of namespaces, ##targetNamespace, and ##local.

    Optional.

  • processContents
    An indicator of how an application or XML processor should handle validation of XML documents against the attributes specified by this anyAttribute element. If no processContents attribute is specified, the default is strict. If processContents is specified, it must one of the following.

    strict

    The XML processor must obtain the schema for the required namespaces and validate any attribute from those namespaces.

    lax

    The XML processor attempts to obtain the schema for the required namespaces and validate any attribute from those namespaces; however, if the schema cannot be obtained, no errors will occur.

    skip

    The XML processor does not attempt to validate any attributes from the specified namespaces.

    Optional.

Element Information

Number of occurrences

Unlimited

Parent elements

complexType, restriction (simpleContent), extension (simpleContent), restriction (complexContent), extension (complexContent), attributeGroup

Contents

annotation

Example

The following example shows an element declaration for an element that contains a string and can have any attribute from the target namespace.

<xs:element name="stringElementWithAnyAttribute">
   <xs:complexType>
    <xs:simpleContent>
      <xs:extension base="xs:string">
       <xs:anyAttribute namespace="##targetNamespace"/>
      </xs:extension>
    </xs:simpleContent>
   </xs:complexType>
</xs:element>

Other Resources

For more information see the W3C XML Schema Part 1: Structures Recommendation at www.w3.org/TR/2001/REC-xmlschema-1-20010502/\#element-all.

See Also

Reference

XML Schemas (XSD) Reference
XML Schema Elements