是否可以使用xml模式来表达其他模式的somme规则?
我读过XML Schema to validate XML Schemas?,它非常有趣,但我需要验证一些适用的规则;例如,在模式中,xs:schema元素是否有版本号?xs:attribute元素有use属性吗?等。
对于这一点有什么好的做法吗?
谢谢。
发布于 2010-12-22 20:16:54
这是一个近乎完美的Schematron应用程序。我不能给你一个完整的schematron来测试那种规则,但你可能会看到类似这样的东西:
<pattern id="attribute-checks">
<rule context="xs:attribute">
<assert test="@use">All xs:attribute elements must have a use attribute</assert>
</rule>
</pattern>Schematron允许您表达为任何xml文件(显然包括模式)驱动的规则,这些规则超出了简单的语法规则。您可以使用它们将验证扩展到业务规则级别。
https://stackoverflow.com/questions/4506266
复制相似问题