Currently I'm having a problem with generating class files from a xsd with repeating elements. I’m using the custom tool ‘MsDatasetGenerator’ in VS2005 SP1 witch create a typed dataset from the xsd for c#. I’m trying to parse the xml by this schema
<?xml version="1.0" encoding=\"utf-8\"?>
<xs:schema id="XSDobject" targetNamespace="http://tempuri.org/XSDobject.xsd" elementFormDefault="qualified" xmlns="http://tempuri.org/XSDobject.xsd" xmlns:mstns="http://tempuri.org/XSDobject.xsd" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="order">
<xs:complexType>
<xs:sequence>
<xs:element name="contact">
<xs:complexType>
<xs:sequence>
<xs:element name="name" type="xs:string" />
<xs:element name="phone" type="xs:string" />
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="buyer">
<xs:complexType>
<xs:sequence>
<xs:element name="contact">
<xs:complexType>
<xs:sequence>
<xs:element name="name" type="xs:string" />
<xs:element name="phone" type="xs:string" />
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
But I get following error “The same table 'contact' cannot be the child table in two nested relations.”
The XSD compiles correctly but it’s the typed dataset that can’t handle repeating tables. Now I have tested also the xsd.exe tool but it seems to generate the same code as the msdatasetgenerator. I also tried some third party code generator tools like XSD2Code, CodeXS, AltovaXmlSpy but also I can’t get it to work with nested elements.
Alternatively I could solve the problem with xslt transformation at the input and the output but it would cost me a lot of performance.
So now I’m asking if someone could help me with a good solution for VS2005, or know good xsd class generator that can handle this problem. It doesn’t have to be a typed dataset if it works as an array or a list it is also perfect as long it is easy to serializing and deserializing it.
Thanks in advance Freggel