XML Schema anyElement
Complete XML Schema Reference
Definition and Usage
The any element enables creators to extend XML documents with elements not specified by the schema.
Element Information
- Parent element: choice, sequence
Syntax
id=ID
maxOccurs=nonNegativeInteger|unbounded
minOccurs=nonNegativeInteger
namespace=namespace
processContents=lax|skip|strict
any attributes
>
(annotation?)
</any>
(The ? symbol declares that the element may occur zero or one time within any element.)
| Attributes | Description |
|---|---|
| id | Optional. Specifies a unique ID for the element. |
| maxOccurs | Optional. Specifies the minimum number of times the any element may occur in the parent element. The value can be an integer greater than or equal to zero. To specify that the any group is optional, set this attribute to zero. The default value is 1. |
| minOccurs | Optional. Specifies the minimum number of times the any element can occur in the parent element. The value can be any number >= 0. Default value is 1 |
| 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:
|
| processContents | Optional. An indicator that specifies how the application or XML processor should handle validation of an XML document against the elements specified by this any element. If the processContents attribute is not specified, it defaults to strict. If processContents is specified, it must be one of the following values:
|
| any attributes | Optional. Specifies any other attributes with non-schema namespaces. |
Example 1
The following example shows a declaration for the "person" element. By using the <any> element, creators can extend the content of "person" with any element (after <lastname>):
<xs:complexType>
<xs:sequence>
<xs:element name="firstname" type="xs:string"/>
<xs:element name="lastname" type="xs:string"/>
<xs:any minOccurs="0"/>
</xs:sequence>
</xs:complexType>
</xs:element>
Complete XML Schema Reference Other Extensions