开发者

XSD: What's the difference between these two?

In the first one, I put the minOccurs and maxOccurs in the sequence element:

<xs:element name="Prerequisites" minOccurs="0" maxOccurs="1">
  <xs:complexType>
    <xs:sequence minOccurs="0" maxOccurs="unbounded">
      <xs:element name="Prerequisite" type="PrerequisiteType"/>              
    </xs:sequence>
  </xs:complexType>
</xs:element>

In the second one开发者_如何转开发, I put it in the contained element element:

  <xs:element name="Prerequisites" minOccurs="0" maxOccurs="1">
      <xs:complexType>
        <xs:sequence>
          <xs:element name="Prerequisite" type="PrerequisiteType" minOccurs="0" maxOccurs="unbounded"/>              
        </xs:sequence>
      </xs:complexType>
  </xs:element>


In this particular case there is no difference, i.e. both definitions describe the same language.

What you define in first example is the limit of the occurrences of the whole sequence, in the second case only of one element of the sequence.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜