I am trying to write XML Schema (XSD) for XML checking. There is an element that contains an enumeration value and child element. Its format is really odd but accepted by xml.
Can a XML element contain text and child elements at the same time?
my case:
<tree>
<node> enumeration Text (Text only allows "a", "b" and "c")
<subnode1 attribute1="xx"> optional text1 </subnode1>
</node1>
</tree>
I am trying to write the xml schema (XSD) to verify the format. The required element, node1, has Text with three restricted values. It will also contain a subnode1 inside it when the value of text equal to "c".
For example, the schema will pass the following cases:
<node1>a</node1>
or
<node1>b</node1>
or
<node1>c
<subnode1 attribute1="1">what ever you what</subnode1>
</node1>
how ever, it won't pass:
<node1>d</node1>
or
<node1>c</node1>
becase subnode1 is neccessary for the value "c"
How can I write the XML Schema element with an enumeration and child element?