XSD: Define attributes based on the value of previous attribute

前端 未结 2 1192
误落风尘
误落风尘 2020-12-21 06:08

I\'m going to guess that this functionality doesn\'t exist, but I thought I\'d give it one last shot.

I\'ve got an XML structure I\'m trying to validate (I have no c

相关标签:
2条回答
  • 2020-12-21 06:14

    You are right, this functionality doesn't exist.

    It can be done in Schematron, but I don't know if it fits your project.

    0 讨论(0)
  • 2020-12-21 06:26

    The name for the feature you are describing is "co-occurrence constraints", and they aren't supported in XSD 1.0.

    You can do this in XSD 1.1 using the "conditional type assignment" syntax, where the type of an element depends on the values of its attributes; you can also do it using assertions. XSD 1.1 is now a final W3C Recommendation and is implemented in Xerces and Saxon.

    0 讨论(0)
提交回复
热议问题