3

I currently have this in an XSD:

<xs:element name="qty" maxOccurs="1" minOccurs="1" />

How can I add a rule that also only allows the value of Qty to be between 100 to 2000?

kjhughes
  • 106,133
  • 27
  • 181
  • 240
MTplus
  • 2,077
  • 4
  • 34
  • 51

1 Answers1

4

Use xs:restriction with xs:{min|max}{In|Ex}clusive:

  <xs:simpleType name="Quantity100to2000">
    <xs:restriction base="xs:integer">
      <xs:minExclusive value="100"/>
      <xs:maxExclusive value="2000"/>
    </xs:restriction> 
  </xs:simpleType>

  <xs:element name="qty" maxOccurs="1" minOccurs="1" type="Quantity100to2000"/>
kjhughes
  • 106,133
  • 27
  • 181
  • 240