我有以下xsd元素:
<xs:element name="Runtime" type="xs:integer" minOccurs="0"/>
如何更改它以使其接受正整数或空?
<Runtime>1</Runtime>
<Runtime></Runtime> <-- This will currently fail -->
答案 0 :(得分:0)
一种选择是:
<xs:element name="Runtime">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:pattern value="\d{1,}|"/>
</xs:restriction>
</xs:simpleType>
</xs:element>