1

次の xsd ファイル (単純な例) があり、そこからいくつかの値を抽出します。

<xs:element name="ACES">
    <xs:complexType>
      <xs:sequence>
        <xs:element ref="ADVANCE-PAYMENT-AMOUNT-DEPOSITEDS"/>
      </xs:sequence>
    </xs:complexType>
</xs:element>

<xs:element name="ADVANCE-PAYMENT-AMOUNT-DEPOSITEDS">
<xs:complexType>
  <xs:sequence>
    <xs:element ref="ADVANCE-PAYMENT-AMOUNT-DEPOSITED" minOccurs="0" maxOccurs="unbounded"/>
  </xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="ADVANCE-PAYMENT-AMOUNT-DEPOSITED" type="T_GENERAL_DATA_ONE"/>


<xs:complexType name="T_GENERAL_DATA_ONE">
    <xs:simpleContent>
        <xs:extension base="ST_LEGNTH_13">
            <xs:attribute name="Duration">
                <xs:simpleType>
                    <xs:restriction base="xs:string">
                        <xs:enumeration value="Jul-Jan"/>
                        <xs:enumeration value="Aug-Feb"/>
                        <xs:enumeration value="Sep-Mar"/>
                    </xs:restriction>
                </xs:simpleType>
            </xs:attribute>
            <xs:attribute name="Description">
                <xs:simpleType>
                    <xs:restriction base="xs:string">
                        <xs:enumeration value="Total"/>
                    </xs:restriction>
                </xs:simpleType>
            </xs:attribute>
        </xs:extension>
    </xs:simpleContent>
</xs:complexType>

<xs:simpleType name="ST_LEGNTH_13">
    <xs:restriction base="xs:string">
        <xs:maxLength value="16"/>
        <xs:pattern value="\d{0,13}(\.[0]{1,2})?"/>
    </xs:restriction>
</xs:simpleType>

ここで見られるように、 System.Xml.Schema APIを使用して XSD ファイルから xs:enumeration と xs:maxLength の値を取得する方法を示すコードを探しています。

4

0 に答える 0