Jump to content

XML XSD Validation


Guest mrkulagam

Recommended Posts

Guest mrkulagam

Hi,I am new to the XSD design. Can anyone help me on the below queries?1) Is it possible to assign both parent and child XML tags with same name?2)How the nested condition need to be handled in XSD file?My sample XML code is attached below <ParentNode relation="OR"> <Condition table="DIMProduct" column="Code" operator="IN"> <Value>avf</Value> </Condition> <ParentNode relation="AND"> <Condition table="DIMPro" column="Desc" operator="IN"> <Value>XYZ</Value> </Condition> <Condition table="DIMPro" column="Code" operator="IN"> <Value>145</Value> </Condition> </ParentNode> </ParentNode>The corresponding XSD code is<xs:element name="ParentNode"> <xs:complexType> <xs:sequence> <xs:element ref="ParentNode" minOccurs="0" maxOccurs="unbounded"/> <xs:element ref="Condition" minOccurs="0" maxOccurs="unbounded"/> </xs:sequence> <xs:attribute name="relation" type="RelationType" use="required"> <xs:annotation> <xs:documentation>Describes the logical condition: AND, OR, NOT</xs:documentation> </xs:annotation> </xs:attribute> </xs:complexType> </xs:element>While validating the XML with XSD file I am getting the below mentioned error."'ParentNode' has invalid child element 'ParentNode'. List of possible elements expected: 'Condition'."Thanks in advance.--raj

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...