它甚至可能吗?
>我知道可以根据正则表达式进行限制,但事实并非如此
>我知道可以将属性声明为由XPath计算的外键,但它似乎必须是唯一的
例:
<root children="2"> <child /> <child /> </root>
W3C Schema 1.0无法基于实例文档约束属性值.
Schematron是一个很好的工具,用于验证文档是否符合此类自定义验证方案.
例如:
<?xml version="1.0" encoding="UTF-8"?> <schema xmlns="http://purl.oclc.org/dsdl/schematron"> <pattern> <rule context="root[@children]"> <assert id="children-value" test="@children=count(child)" flag="error"> The root/@children value must be equal to the number of child elements. </assert> </rule> </pattern> </schema>
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。