My schema looks like this:
<xs:schema xmlns="DAN" xmlns:xs="http://www.w3.org/2001/XMLSchema" targetNamespace="DAN" elementFormDefault="qualified" attributeFormDefault="unqualified" version="1.0">
<xs:complexType name="Stuff">
<xs:sequence>
<xs:element ref="Numbers" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
<xs:element name="BaseItem">
<xs:complexType>
<xs:sequence>
<xs:element name="OriginalStuff" type="Stuff"/>
<xs:element name="OptionalModifiedStuff" type="Stuff" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="Numbers">
<xs:complexType>
<xs:sequence maxOccurs="unbounded">
<xs:element name="Number" type="xs:double"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
When I run xsd.exe on it it generates a dataset without error; but at runtime when generating relationships it crashes with an ArgumentException "The same table 'Numbers' cannot be the child table in two nested relations.".
If I change it as below the generated code works, but at the user readable/code writer level I lose the information implicit from the naming of elements of why a single copy is required but there might be a second one.
<?xml version="1.0" encoding="UTF-8"?>
<!-- FileFormatVersion:1.0 -->
<xs:schema xmlns="DAN" xmlns:xs="http://www.w3.org/2001/XMLSchema" targetNamespace="DAN" elementFormDefault="qualified" attributeFormDefault="unqualified" version="1.0">
<xs:complexType name="Stuff">
<xs:sequence>
<xs:element ref="Numbers" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
<xs:element name="BaseItem">
<xs:complexType>
<xs:sequence>
<xs:element name="Stuff" type="Stuff" maxOccurs="2"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="Numbers">
<xs:complexType>
<xs:sequence maxOccurs="unbounded">
<xs:element name="Number" type="xs:double"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
Is there a way I can modify my schema so that I can maintain the information about intent in the original while still having a working DataSet generated?