Question

Given this XML Schema snippet:

<xs:element name="data">
    <xs:complexType>
        <xs:sequence>
            <xs:element name="param" type="param" minOccurs="0" maxOccurs="unbounded" />
            <xs:element name="format" type="format" minOccurs="0" maxOccurs="unbounded" />
        </xs:sequence>
        <xs:attribute name="name" type="xs:string" />
    </xs:complexType>
</xs:element>

The intended result is valid <data> elements may contain 0 or more <param> elements followed by 0 or more <format> elements. Have I added the minOccurs/maxOccurs atttributes correctly, or should they be applied to the containing <xs:sequence>?

Correct or not, what would be the result of going one way or the other?

Was it helpful?

Solution

You have done it right and you can not add min/max occurs to sequence element. Using and XML editor that supports XML Schema might help you to validate your assumptions when you are in doubt. Here is a good free ware called XMLFox

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top