Tamino XML Server Version 9.7
 —  Tamino XML Schema Reference Guide  —

xs:any

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 processContents attribute specifies how this fragment of XML code is validated. The origin of the XML code can be specified using the namespace attribute.

Parent element xs:choice, xs:sequence
Child elements None
Attributes minOccurs, maxOccurs, processContents, namespace
Attributes
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
  • xs:anyURI

  • ##any

  • ##other

  • ##local

  • ##targetNamespace

The namespace attribute can only have the following values:

  • ##any
    Elements belonging to any namespace match xs:any. This is the default value.

  • ##other
    Elements belonging to any non-absent namespace except the current schema's targetNamespace match.

  • Item list
    A whitespace-separated list of items, each matching one of the following:

    • An arbitrary URI
      The item must be a valid URI with respect to the predefined type xs:anyURI. Only elements belonging to the respective namespace are accepted during validation.

    • ##local
      Only elements without a namespace are allowed.

    • ##targetNamespace
      Only elements belonging to the current schema's targetNamespace match.

    Only elements that are valid with respect to at least one of the items are accepted.

processContents xs:NMTOKEN

This attribute governs whether a strict or a simplified validation process is performed. It can have the values:

  • "strict"

  • "lax"

  • "skip"

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.

Example 1

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>

Example 2

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>

Top of page