我需要在我的xsd架构中创建if/else条件.特别是模式节点.我怎么能这样做?
<s:complexType name="parent">
<s:sequence>
<s:element name="elem1" type="s:string"/>
<s:element name="elem2">
<s:simpleType>
<s:restriction base="s:string">
<s:pattern value="if (elem1 == 3) //todo
else //todo"/>
</s:restriction>
</s:simpleType>
</s:element>
</s:sequence>
</s:complexType name="parent">
Run Code Online (Sandbox Code Playgroud)
不,你不能if在内部使用xs:pattern/@value.
不,你不能引用其中的另一个元素xs:pattern/@value.
你可以做什么:
比这更具体的指导只能通过一个更具体的问题来展示XML应该和不应该有效,解释//todo等等.