Microsoft XML Core Services (MSXML) 4.0 - XML Schemas

<group> Element

The <group> element enables you to specify constraints on a subset of child elements. This can be quite useful when specifying elements within a schema.

The <group> element accepts the order, minOccurs, and maxOccurs attributes.

For example, the following schema defines the <Item> element as containing a <group> element with two child elements, <product> and <backOrderedProduct>. Because this <group> element sets its order attribute to "one", only one of these child elements can appear in the <group> element. This prevents the <group> element from having both a <product> and a <backOrderedProduct>elements.

Example

<ElementType name="Item">
    <group order="one">
        <element type="product" />
        <element type="backOrderedProduct" />
    </group>
    <element type="quantity"/>
    <element type="price"/>
</ElementType>

According to the preceding schema, the following document is a valid instance.

<Item>
  <product>CD</product>
  <quantity>100</quantity>
  <price>10</price>
</Item>
<Item>
  <product>FloppyDisk</product>
  <quantity>100</quantity>
  <price>1</price>
</Item>

See Also

content Attribute | minLength and maxLength Attribute | minOccurs and maxOccurs Attribute | | model Attribute (Open and Closed Content Models) | order Attribute

This HTML Help has been published using the chm2web software.