Purpose |
This element allows a wildcard to be defined in TSD. It allows the occurrence of arbitrary elements (for instance the inclusion of any piece of well-formed XML code) together with the current element in the XML instance to be validated against the schema. The |
Parent element | xs:choice ,
xs:sequence |
Child elements | None |
Attributes | minOccurs ,
maxOccurs ,
processContents ,
namespace |
Name | Type | Description |
---|---|---|
minOccurs |
xs:nonNegativeInteger |
Together with the
maxOccurs attribute described below, this
attribute expresses multiplicity in TSD (and
XML
Schema) in xs:any elements within element
definitions. The value of a minOccurs attribute
in an xs:any element determines the minimum number of occurrences
of any elements. The value of
minOccurs must be a non-negative integer. The
default value for minOccurs is 1.
|
maxOccurs |
xs:nonNegativeInteger or
"unbounded"
|
Together with the
minOccurs attribute described above, this
attribute expresses multiplicity in TSD (and
XML
Schema) in an xs:any element within a content model.
The value of a maxOccurs attribute in an
xs:any declaration determines the maximum number of occurrences of
any elements. The value of
maxOccurs must either be a non-negative integer
or the value "unbounded". The default value for
maxOccurs is 1.
|
namespace |
|
The
|
processContents |
xs:NMTOKEN |
This attribute governs whether a strict or a simplified validation process is performed. It can have the values:
The default value is "strict". These validation methods differ in their behavior if they encounter elements without a corresponding definition of a global element. If "lax" is specified, the XML processor only validates the elements for which it can obtain schema information, but for elements where no corresponding definition of a global element is available, no errors are signalled. If "strict" is specified, each element must validate against a corresponding global element definition. If "skip" is used, the respective elements is not validated at all. |
This example shows a complex type definition with a choice element
containing an xs:any
element with
maxOccurs
and
processContents
attributes for processing with
strict validation:
<xs:complexType mixed = "true"> <xs:choice> <xs:any processContents = "strict" maxOccurs = "unbounded"></xs:any> </xs:choice> </xs:complexType>
To allow an arbitrary number of XML elements being defined as global elements, proceed as shown here:
<xs:element name="Comment"> <xs:complexType> <xs:sequence> . . . <xs:any namespace="##local" minOccurs="0" maxOccurs="unbounded"/> </xs:sequence> </xs:complexType> </xs:element>