Easy Tutorial
❮ Schema Tutorial El Restriction ❯

XML Schema any Element



Definition and Usage

The any element allows creators to extend XML documents with elements not specified in the schema.

Element Information

Syntax

(? symbol declares that the element can occur zero or one time within any element.)

Attribute Description
id Optional. Specifies a unique ID for the element.
maxOccurs Optional. Specifies the maximum number of times the any element can occur within the parent element. The value can be any integer >= 0. To specify that the any group is optional, set this attribute to zero. Default value is 1.
minOccurs Optional. Specifies the minimum number of times the any element can occur within the parent element. The value can be any integer >= 0. Default value is 1.
namespace Optional. Specifies the namespace containing 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 outside 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 the XML document with elements specified by the 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 required schemas and must validate all elements from these 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 of the "person" element. By using the <any> element, creators can extend the content of "person" with any element (after <lastname>):


❮ Schema Tutorial El Restriction ❯