3

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?

Dan Lugg
  • 20,192
  • 19
  • 110
  • 174

1 Answers1

4

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

Aravind Yarram
  • 78,777
  • 46
  • 231
  • 327