Given the following xml example:
<MyCustomXml>
<ClientId>SomeGuid</ClientId>
<Contact>[email protected]</Contact>
<Data>
<Item name="SomeName" type="String">
SomeValue
</Item>
<Item name="SubList" type="List">
<Data>
<Item name="AnotherItem" type="String">
Hello
</Item>
<Item name="Key2" type="String">
World
</Item>
<Item name="Sub2" type="List">
<Data>
<Item name="KeeyGoing" type="String">
The Sub list can keep going infinately
</Item>
</Data>
</Item>
</Data>
</Item>
</Data>
</MyCustomXml>
I created the following xsd for this xml
<?xml version="1.0" encoding="utf-8"?>
<xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="MyCustomXml" >
<xs:complexType>
<xs:all>
<xs:element name="ClientId" type="xs:string" minOccurs="0" maxOccurs="1"/>
<xs:element name="Contact" type="xs:string" minOccurs="0" maxOccurs="1" />
<xs:element ref="Data" minOccurs="0" maxOccurs="1" />
</xs:all>
</xs:complexType>
</xs:element>
<xs:element name="Data" substitutionGroup="Data">
<xs:complexType>
<xs:sequence>
<xs:element ref="Item" maxOccurs="unbounded" />
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="Item" substitutionGroup="Item">
<xs:complexType mixed="true">
<xs:sequence>
<xs:element ref="Data" minOccurs="0" />
</xs:sequence>
<xs:attribute name="name" type="xs:string" use="required" />
<xs:attribute name="type" use="required" />
</xs:complexType>
</xs:element>
</xs:schema>
Accoding to http://www.validome.org/grammar/validate/ the xsd is not valid. The following errors are:
Line 13 Column: 55
Error: Circular substitution group detected for element ':Data'.
Error Position:
Line 20 Column: 55
Error: Circular substitution group detected for element ':Item'.
Error Position:
How do I resolve the circular substitution? I tried changing the substitutionGroup but that did not work.