XML Schema anyAttribute
Element
Definition and Usage
The anyAttribute
element allows authors to extend XML documents with attributes not defined by the schema.
Element Information
- Parent elements: complexType, restriction (both simpleContent and complexContent), extension (both simpleContent and complexContent), attributeGroup
Syntax
(? symbol declares that the element can occur zero or one time within the anyAttribute
element.)
Attribute | Description |
---|---|
id | Optional. Specifies a unique ID for the element. |
namespace | Optional. Specifies the namespace containing the elements that can be used. If no namespace is specified, ##any is the default. If a namespace is specified, it must be one of the following values: ##any - Elements from any namespace can occur (default).<br>##other - Elements from any namespace other than the target namespace of the parent element can occur.<br>##local - Elements not qualified by a namespace can occur.<br>##targetNamespace - Elements from the target namespace of the parent element can occur.<br>A list of {URI references of namespaces, ##targetNamespace, ##local} - Elements from the namespaces listed, separated by spaces, can occur. The list can include URI references of namespaces, ##targetNamespace, and ##local. |
processContents | Optional. An indicator specifying how an application or XML processor should validate an XML document with elements specified by this any element. If the processContents attribute is not specified, it defaults to strict. If specified, it must be one of the following values: strict - The XML processor must obtain the schemas for the required namespaces and must validate all elements from those namespaces. (default)<br>lax - Same as strict; however, no errors occur if the schema cannot be obtained.<br>skip - The XML processor does not attempt to validate all elements from the specified namespaces. |
any attributes | Optional. Specifies any other attributes with non-schema namespaces. |
Example 1
The following example shows a declaration for the "person" element using the anyAttribute
element.