作者热门文章
- xml - AJAX/Jquery XML 解析
- 具有多重继承的 XML 模式
- .net - 枚举序列化 Json 与 XML
- XML 简单类型、简单内容、复杂类型、复杂内容
看来我不能轻易地为这个简单的 XML 声明 XSD
<root>
<weekday name="Sunday">1</weekday>
</root>
其中 weekday 是从 1 到 7 的受限 int 并且具有 string 类型的名称属性
有什么建议吗?
感谢您的支持!
最佳答案
当然可以。您需要从简单类型(将整数限制在 1 到 7 之间)派生的复杂类型(添加 name 属性):
<xs:simpleType name="NumericWeekday">
<xs:restriction base="xs:int">
<xs:minInclusive value="1"/>
<xs:maxInclusive value="7"/>
</xs:restriction>
</xs:simpleType>
<xs:complexType name="Weekday">
<xs:simpleContent>
<xs:extension base="NumericWeekday">
<xs:attribute name="name" type="xs:string"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
我会留给你将 name 属性变成一个枚举。
关于xml - XSD:minInclusive 和属性在一起,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2584037/
看来我不能轻易地为这个简单的 XML 声明 XSD 1 其中 weekday 是从 1 到 7 的受限 int 并且具有 string 类型的名称属性 有什么建议吗? 感谢您的支持! 最佳
我想将 minInclusive 设置为 0.01。我尝试了以下一个但失败了。 有人可以建议怎么写吗? 如果不可能,是否有
我想将 minInclusive 设置为 0.01。我尝试了以下一个但失败了。 有人可以建议怎么写吗? 如果不可能,是否有
我有一个 xml 元素,其值范围是(本质上)1-20,所以我可以使用:minInclusive=1 和 maxInclusive=20 限制内在集。 但是,我还希望能够设置一个 -
我是一名优秀的程序员,十分优秀!