XML technologies / XML Schema / XML Schema element reference / xs:any
(Excerpt from “XML Schema” by Eric van der Vlist)
Wildcard for arbitrary elements.
<xs:any
id = xs:ID
maxOccurs = ( xs:nonNegativeInteger | "unbounded" ) : "1"
minOccurs = xs:nonNegativeInteger : "1"
namespace = ( ( "##any" | "##other" ) | list of ( xs:anyURI | ( "##targetNamespace" | "##local" ) ) ) : "##any"
processContents = ( "skip" | "lax" | "strict" ) : "strict"
{beliebige Attribute mit einem Nicht-Schema-Namensraum}
>
Content: (xs:annotation?)
</xs:any>May occur within: xs:choice (outside a group), xs:choice (within a group), xs:sequence (within a group), xs:sequence (outside a group)
Description
xs:any is a wildcard allowing any element from several namespaces. This particle can occur in choices (xs:choice) and sequences (xs:sequence), just like xs:element, with accepted elements’ occurrence count controlled by attributes minOccurs and maxOccurs of this particle.
The list of permitted namespaces is specified with attribute namespace, a list of namespace URIs. Two values have special meanings: ##targetNamespace denotes the target namespace, and ##local denotes local elements without namespaces. Both can occur alongside ordinary URIs. Two other special values can replace the whole list: ##any denotes any namespace and is the default for attribute namespace, while ##other denotes any namespace except the target. If ##other is used without a target namespace, all namespaces are allowed, and only unqualified elements are forbidden.
The target namespace used to interpret special values ##targetNamespace and ##other is that, or its absence, of the schema containing wildcard xs:any . Importing the schema into another does not change this.
Validator behavior for elements and their children is specified by attribute processContents. If processContents is strict, the default, processors must validate elements against their schemas and report an error for invalid elements or unavailable schemas. If the value is skip, processors do not validate elements. If it is lax, elements are validated if a definition is found, otherwise skipped.
If the setting processContents skip applies, or equivalently if the value is lax and no schema was found, further validation is skipped; elements may have any content. Attributes and descendants from any namespace are accepted regardless of attribute namespace.
If the setting processContents strict applies, or equivalently if the value is lax and a schema was found, accepted elements must be globally declared in their namespace’s schema or have a valid type specified in the instance through attribute xsi:type.
Restrictions
Useful namespace combinations for open multinamespace vocabularies are missing, including any namespace known to the current validation context and its opposite, any namespace unknown to that context.
Ordinary nondeterminism restrictions also apply to wildcards. In weighing benefits and risks, check attribute processContents. Conflicts may occur for globally declared elements in accepted namespaces if processContents strict is the active setting, or for any global or local element if processContents skip is the active setting.
The behavior of special value ##other for unqualified elements in schemas with target namespaces is contradictory in the W3C XML Schema recommendation and should be clarified in a future appendix. Despite a contrary passage, the likely interpretation excludes unqualified elements when ##other is specified in these schemas.
Attributes
id
Element ID according to W3C XML Schema.
maxOccurs
Maximum elements accepted by this wildcard.
minOccurs
Minimum elements accepted by this wildcard.
namespace
Permitted namespaces.
processContents
Validation mode for elements accepted by this wildcard.
Copyright © 2003 O'Reilly Verlag GmbH & Co. KG
You may print the online version for your private use.
Otherwise, this chapter from “XML Schema” is subject to the same conditions as the bound edition. The work, including all its parts, is protected by copyright. All rights reserved, including reproduction, translation, microfilming, and storage and processing in electronic systems.
O’Reilly Verlag GmbH & Co. KG, Balthasarstraße 81, 50670 Köln, kommentar(at)oreilly.de