XSD: Define attributes based on the value of previous attribute

前端 未结 2 1194
误落风尘
误落风尘 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: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.

提交回复
热议问题