1

Here's what I have, and I don't understand what it does:

<xs:element name="T1RXXXXG2S" type="StrColumn" nillable="true" minOccurs="0" maxOccurs="9999"/>

where

<xs:complexType name="StrColumn">
        <xs:simpleContent>
            <xs:extension base="xs:string">
                <xs:attribute name="ROWNUM" type="rowInt" use="required"/>
            </xs:extension>
        </xs:simpleContent>
</xs:complexType>

and

<xs:simpleType name="rowInt">
        <xs:restriction base="xs:int">
            <xs:minInclusive value="1"/>
            <xs:maxInclusive value="999999"/>
        </xs:restriction>
</xs:simpleType>

Can somebody explain to me what does this extension do here and how it works?

kjhughes
  • 106,133
  • 27
  • 181
  • 240
JConstantine
  • 1,020
  • 7
  • 19

1 Answers1

1

According to your XSD fragments, a T1RXXXXG2S element must have string content and an attribute, ROWNUM, with an integer value in the range of 1 to 999999, inclusive on both ends.

The rarely used nillable="true" attribute on the T1RXXXXG2S element declaration means that T1RXXXXG2S may appear with an xsi:nil="true" attribute.

kjhughes
  • 106,133
  • 27
  • 181
  • 240
  • Why do we extend on `xs:string` datatype here? What does it practically mean that I have an `int` attribute of the `string` element? I'm new to `XSD` and kind of confused. What is `xsi`? – JConstantine Mar 12 '21 at 00:43
  • 1
    As I explained, the `xs:simpleContent/xs:extension` pattern allows you to specify that an element has simple content, in this case a string, and an attribute, in this case one named `ROWNUM` of integer type restricted to a certain range. The `xsi` namespace prefix is a whole separate matter: See [What is the difference between xsd and xsi?](https://stackoverflow.com/q/41035128/290085) and [xmlns, xmlns:xsi, xsi:schemaLocation, and targetNamespace?](https://stackoverflow.com/q/34202967/290085). – kjhughes Mar 12 '21 at 00:57