Compartilhar via


<xsd:all> Element

Allows the elements in the group to appear (or not appear) in any order in the containing element.

<all
  id = ID 
  maxOccurs= 1: 1 
  minOccurs= (0 | 1): 1 
  {any attributes with non-schema Namespace...}>
Content: (annotation?, element*)
</all>

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 element can occur. The value must be 1.

    Optional.

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

    Optional.

Element Information

Number of occurrences

One time

Parent elements

group, restriction (simpleContent), extension (simpleContent), restriction (complexContent), extension (complexContent), complexType

Contents

annotation, element

Example

The following example defines a complex data type containing an all element with three elements for an XML instance documents such as the following example:

<?xml version="1.0"?>
<myElement myAttribute="1.1"> 
    <thing2>Some</thing2>
    <thing3>text</thing3>
    <thing1>for you</thing1>
</myElement>
<xs:element name="thing1" type="xs:string"/>
<xs:element name="thing2" type="xs:string"/>
<xs:element name="thing3" type="xs:string"/>

<xs:attribute name="myAttribute" type="xs:decimal"/>

<xs:complexType name="myComplexType">
 <xs:all>
  <xs:element ref="thing1"/>
  <xs:element ref="thing2"/>
  <xs:element ref="thing3"/>
 </xs:all>
 <xs:attribute ref="myAttribute"/>
</xs:complexType>

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