Question

So I have the following xsd types

    <xs:complexType name="nodeType">
        <xs:sequence>
            <xs:choice>
                <xs:element name="c0" type="c0type"/>
                <xs:element name="c1" type="c1type"/>
                <xs:element name="c2" type="c2type"/>
                <xs:element name="c3" type="c3type"/>
            </xs:choice>
        </xs:sequence>
    </xs:complexType>

    <xs:element name="root">
      <xs:complexType>
        <xs:sequence>
            <xs:element name="nodes">
                <xs:complexType>
                    <xs:sequence>
                        <xs:element name="node" type="nodeType" minOccurs="1" maxOccurs="unbounded"/>
                    </xs:sequence>
                </xs:complexType>
            </xs:element>
        </xs:sequence>
    </xs:complexType>
  </xs:element>

now the problem I face is that I need the 'node' element to exist at least once within the 'root' element and with the selected element of type 'c0type'.

any number of combinations of <node><c0 /></node>...<node><c3 /></node> can occur but at least 1 <node><c0 /><node> must exist

Is it possible to achieve this validation through xsd?

Thanks

Kieran

Was it helpful?

Solution

It is not possible using XSD 1.0.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top