在XML Schema中,如何创建元素Age
具有restriction
允许在元素内部写入最大值为 10、最小值为 1 的整数Age
还有元素Age
有属性?
<xsd:element name="Age">
<xsd:complexType>
here i want to have restriction to control max and min value inside Age element
<xsd:attribute name="type" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
没有警告的 XML 代码
<Age type="sth">
5
</Age>
带有警告的 XML 代码
<Age type="sth">
22
</Age>
这称为“内容简单的复杂类型”。这是一个例子:
<xs:complexType>
<xs:simpleContent>
<xs:extension base="one-to-ten">
<xs:attribute name="type" type="xs:string" use="required"/>
</
</
</
<xs:simpleType name="one-to-ten">
<xs:restriction base="xs:integer">
<xs:minInclusive value="1"/>
<xs:maxInclusive value="10"/>
</
</
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)