Hi,
I want to validate an xml which will be in the fol format :
< Root >
<Hierarchy> <!--Optional Tag -->
<Subjects> <!--Optional Tag -->
<Subject>
</Subject>
</Subjects>
<Hierarchy>
</Root>
As stated above the Hierarchy and Subject tag are optional. Following are valid xmls :
<Root><Subject>xyz</Subject></Root>
<Root><Subjects><Subject>xyz</Subject></Subjects></Root>
<Root><Hierarchy><Subjects><Subject>xyz</Subject>
</Subjects></Hierarchy></Root>
Adding minOccurs="0" to Hierarchy/Subjects element does not suffice the requirement since then it doesnot expect Subject element.
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="(URL address blocked: See forum rules)">
<xs:element name="ImportFile">
<xs:complexType>
<xs:sequence minOccurs="0" maxOccurs="1">
<xs:element name="Hierarchy">
<xs:complexType>
<xs:sequence minOccurs="0" maxOccurs="1">
<xs:element name="Subjects">
<xs:complexType>
<xs:sequence minOccurs="0" maxOccurs="unbounded">
<xs:element name="Subject"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>