Click here to Skip to main content
15,884,388 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have created class file using xsd.exe and then created xml file as given on the link below

Creating an XML file based on XSD[^]

Its working perfectly but for one xsd file. Its giving error as "The same table cannot be the child table in two nested relations " Its because child element of one parent element has same name.
Trying to illustrate the case below

HTML
<Parent>
  <Child1>
    <ChildDetails>
         <Name>
         <Age>
    </ChildDetails>
  </Child1>
   <Child2>
      <ChildDetails>
           <Name>
           <Age>
      </ChildDetails>
  </Child2>
</Parent>

It gives error "The same table “ChildDetails “cannot be the child table in two nested relations "
On checking on net understand I will have to rename the element name manually as mentioned on the following link
http://social.msdn.microsoft.com/Forums/en-US/xmlandnetfx/thread/22f98352-83b9-4638-a306-34a36a11e4d6[^]

“The DataSet class in .NET 2.0 (Visual Studio 2005) still has the limitation of not supporting different nested tables with the same name. Therefore you will have to introduce an XML transform to pre-process the XML (and schemas) before you load them up into the DataSet.”

Have been trying to change the element name in the Class file generated by xsd.exe but its still generating with the original element name.

Any help would be highly appreciated.
Posted
Updated 10-Feb-12 0:50am
v2

1 solution

Based on what you posted, it appears that <Name> and <Age> are not closed. That would result in the appearance of nested blocks, which your schema presumably does not permit.

You need to add either a closing tag, such as </Name>, or use attributes and have the tags self-close, such as <Name first="..." last="..." />
 
Share this answer
 
Comments
darshanadsouza 12-Feb-12 0:44am    
Thanks for the reply. But i have forgotten to close the tags in the post. The tags are present in the actual xsd.
darshanadsouza 13-Feb-12 7:17am    
Any suggestions please

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900