I need either element A or B or both. If i use choices, then it throws an exception Element ‘A’ cannot have character [children], because the type’s content type is element-only.
How to achieve the desired result.
<xsd:complexType>
<xsd:sequence>
<xsd:element name="A">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="C"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="B"/>
</xsd:sequence>
</xsd:complexType>
sample XML is
<start>
<A>
<C>hhg</C>
</A>
</start>
<start>
<A>
<C>hhg</C>
</A>
<B>fgeg</B>
</start>
<start>
<B>fergf</B>
</start>
Use
minOccurs="0", e.g.:For XML:
Appropriate XSD should be: