Freigeben über


<xsd:any> Element 

Enables any element from the specified namespace(s) to appear in the containing sequence or choice element.

<any
  id = ID 
  maxOccurs = (nonNegativeInteger | unbounded) : 1
  minOccurs = nonNegativeInteger : 1 
  namespace = "(##any | ##other) | List of (anyURI | (##targetNamespace |  ##local))) : ##any 
  processContents = (lax | skip | strict) : strict 
  {any attributes with non-schema Namespace...}>
Content: (annotation?)
</any> 

Attributes

  • id
    The ID of this element. The id value must be of type ID and be unique within the document containing this element.

    Optional.

  • maxOccurs
    The maximum number of times the any element can occur on the element. The value can be an integer greater than or equal to zero. To set no limit on the maximum number, use the string "unbounded". Default value is 1.

    Optional.

  • minOccurs
    The minimum number of times the any element can occur on the element. The value can be an integer greater than or equal to zero. To specify that this any group is optional, set this attribute to zero. Default value is 1.

    Optional.

  • namespace
    The namespaces containing the elements that can be used. If no namespace is specified, ##any is the default. If the namespace is specified, it must one of the following.

    ##any

    Elements from any namespace can be present.

    ##other

    Elements from any namespace that is not the target namespace of the parent element containing this element can be present.

    ##local

    Elements that are not qualified with a namespace can be present.

    ##targetNamespace

    Elements from the target namespace of the parent element containing this element can be present.

    List of {URI references, ##targetNamespace, ##local}

    Elements from a space-delimited list of the namespaces can be present. The list can contain the following: URI references of namespaces, ##targetNamespace, and ##local.

    Optional.

  • processContents
    An indicator of how an application or XML processor should handle validation of XML documents against the elements specified by this any element. If no processContents attribute is specified, the default is strict. If processContents is specified, it must one of the following.

    strict

    The XML processor must obtain the schema for the required namespaces and validate any element from those namespaces.

    lax

    The XML processor attempts to obtain the schema for the required namespaces and validate any element from those namespaces; however, if the schema cannot be obtained, no errors will occur.

    skip

    The XML processor does not attempt to validate any elements from the specified namespaces.

    Optional.

Element Information

Number of occurrences

Unlimited

Parent elements

choice, sequence

Contents

annotation

Example

The following example shows an element declaration for an element that must contain one or more elements from the XHTML namespace with content processing set to lax.

<xs:element name='htmlText'>
  <xs:complexType>
   <xs:sequence>
     <xs:any namespace='http://www.w3.org/1999/xhtml'
          minOccurs='1' maxOccurs='unbounded'
          processContents='lax'/>
   </xs:sequence>
  </xs:complexType>
</xs:element>

Other Resources

For more information see the W3C XML Schema Part 1: Structures Recommendation at www.w3.org/TR/2001/REC-xmlschema-1-20010502\#element-all.

See Also

Reference

XML Schemas (XSD) Reference
XML Schema Elements