0

こんにちは、私はこの種の XML を持っています

このデータを検証する XML を書きたいと思います。

<?xml version="1.0" encoding="UTF-8"?>
<Entry attribute1="value1" attribute2="Value2">
    <subEntry tagX="xValue1" tagy="yValue"/>
</Entry>

しかし、検証しません

<?xml version="1.0" encoding="UTF-8"?>
<Entry attribute1="value1" attribute2="Value2">
    <subEntry tagX="xValue1" tagy="yValue"/>
    <subEntry tagX="xValue1" tagy="yValue"/>
</Entry>

subEntries の数を制限したい:

シーケンスの maxOccurs は subEntries の数をチェックしません。

XSD は次のとおりです。

<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">
    <xs:element name="Entry">
        <xs:complexType>
            <xs:sequence>
                <xs:element ref="subEntry"/>
            </xs:sequence>
            <xs:attribute1 name="dateEmission" type="xs:dateTime" use="required"/>
            <xs:attribute2 name="emetteur" type="xs:string" use="required"/>
        </xs:complexType>
    </xs:element>
    <xs:element name="Entry">
        <xs:complexType>
            <xs:attribute name="tagX" type="xs:string" use="required"/>
            <xs:attribute name="tagy" type="xs:decimal" use="optional"/>
        </xs:complexType>
    </xs:element>
</xs:schema>
4

1 に答える 1