dimanche 15 mai 2016

XSD/XML Pattern syntax

I have a recipe method like this as an xml

<methods>
        <method step="1">
              <![CDATA[Finely chop the apples and then put them aside.]]>
        </method>
        <method step="2">
              <![CDATA[Start by mixing the flour and the eggs.]]>
        </method>

I want to restrict the step attribute to be [1,infinity). And it must be in the exact order of 1, 2, 3, etc...

I have tried writing the restriction like this:

<xs:simpleType name="method-type">
        <xs:restriction base="xs:positiveInteger">
            <xs:pattern value="1"></xs:pattern>
            <xs:minInclusive value="1"></xs:minInclusive>
        </xs:restriction>
    </xs:simpleType>

But I am unsure how to handle the pattern to an infinite amount of values

Aucun commentaire:

Enregistrer un commentaire