【发布时间】:2020-05-20 20:40:20
【问题描述】:
我有点不确定我看到的关于如何声明/定义 simpleTypes 的不同示例。从我在两个网站上看到的情况来看,语法描述是相同的,但示例不同。
在https://www.w3schools.com/xml/el_simpletype.asp 我看到了:
<xs:element name="age">
<xs:simpleType>
<xs:restriction base="xs:integer">
<xs:minInclusive value="0"/>
<xs:maxInclusive value="100"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
但在https://docs.microsoft.com/en-us/previous-versions/dotnet/netframework-4.0/ms256050(v%3Dvs.100) 他们使用:
<xs:simpleType name="freezeboilrangeInteger">
<xs:restriction base="xs:integer">
<xs:minInclusive value="0"/>
<xs:maxInclusive value="100"/>
</xs:restriction>
</xs:simpleType>
这两种方式有什么不同吗?如果是这样,有什么区别?如果它们相同,应该使用哪一个/是最佳做法?
【问题讨论】:
标签: xml web-services xsd schema xmlschema