如何定义一个可以包含整数或什么都不包含的元素?
How do I define an element that can either contain an integer or nothing at all?
问题说明了一切!我想要一个 XSD 定义,可以创建这样的元素
<Element>12345</Element>
或者像这样
<Element></Element>
我该怎么做?
我已经尝试使用 nillable
属性并将元素的类型更改为 xs:string
,但没有成功。
我解决了关于 xs:minLength
值为 1 的 xs:simpleType
和基数 xs:string
创建 xs:restriction
的问题。
<xs:simpleType name="type">
<xs:restriction base="xs:string">
<xs:minLength value="0"/>
</xs:restriction>
</xs:simpleType>
问题说明了一切!我想要一个 XSD 定义,可以创建这样的元素
<Element>12345</Element>
或者像这样
<Element></Element>
我该怎么做?
我已经尝试使用 nillable
属性并将元素的类型更改为 xs:string
,但没有成功。
我解决了关于 xs:minLength
值为 1 的 xs:simpleType
和基数 xs:string
创建 xs:restriction
的问题。
<xs:simpleType name="type">
<xs:restriction base="xs:string">
<xs:minLength value="0"/>
</xs:restriction>
</xs:simpleType>