Reputation: 1317
I need to make if/else condition in my xsd schema. Specifically pattern node. How I can do it?
<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">
Upvotes: 2
Views: 6101
Reputation: 111630
No, you cannot use if
within xs:pattern/@value
.
No, you cannot reference another element within xs:pattern/@value
.
What you can do:
More specific guidance than that is possible only with a more specific question that shows XML that should and should not be valid, that explains //todo
, etc.
Upvotes: 7