Hi I have an xml that looks like,
<ABC>
<DEF Value="123">
<XYZ>
<RootEle Text="Now" Date="SomeDate"/>
</XYZ>
</DEF>
<DEF AnotherValue="123">
<XYZ>
<AnotherRootEle AnotherText="NowOrNever" AnotherDate="SomeOtherDate"/>
</XYZ>
</DEF>
</ABC>
I need to write an xsd for this. But the xsd that I wrote does not hold good for the above xml.
<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" attributeFormDefault="unqualified">
<xsd:element name="ABC">
<xsd:complexType>
<xsd:sequence minOccurs="1" maxOccurs="1">
<xsd:element name="DEF">
<xsd:complexType>
<xsd:sequence minOccurs="1" maxOccurs="unbounded">
<xsd:element name="XYZ">
<xsd:complexType>
<xsd:sequence minOccurs="1" maxOccurs="1">
<xsd:element name="RootEle">
<xsd:complexType>
<xsd:attribute name="Text" use="optional">
<xsd:annotation>
<xsd:documentation>Text</xsd:documentation>
</xsd:annotation>
<xsd:simpleType>
<xsd:restriction base="xsd:string">
<xsd:maxLength value="40" />
</xsd:restriction>
</xsd:simpleType>
</xsd:attribute>
<xsd:attribute name="Date" use="optional">
<xsd:annotation>
<xsd:documentation>Date</xsd:documentation>
</xsd:annotation>
<xsd:simpleType>
<xsd:restriction base="xsd:string">
<xsd:maxLength value="40" />
</xsd:restriction>
</xsd:simpleType>
</xsd:attribute>
</xsd:complexType>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:sequence>
<xsd:attribute name="Value" use="optional">
<xsd:annotation>
<xsd:documentation>Name of the flow</xsd:documentation>
</xsd:annotation>
<xsd:simpleType>
<xsd:restriction base="xsd:string">
<xsd:maxLength value="40" />
</xsd:restriction>
</xsd:simpleType>
</xsd:attribute>
<xsd:attribute name="AnotherValue" use="optional">
<xsd:annotation>
<xsd:documentation>Name of interface</xsd:documentation>
</xsd:annotation>
<xsd:simpleType>
<xsd:restriction base="xsd:string">
<xsd:maxLength value="40" />
</xsd:restriction>
</xsd:simpleType>
</xsd:attribute>
</xsd:complexType>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:schema>
The above xsd holds good for the below xml but not for the one posted first i.e it is not working for Repeat Elements with different child elements.
<ABC>
<DEF Value="123">
<XYZ>
<RootEle Text="Now" Date="SomeDate"/>
</XYZ>
</DEF>
</ABC>
Any help with this ??