本文介绍了如何从XSD创建XML的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经使用xsd.exe创建了类文件,然后按照下面的链接中的说明创建了xml文件.

[ ^ ]

它工作正常,但只需要一个xsd文件.其给定错误为同一表不能是两个嵌套关系中的子表",因为一个父元素的子元素具有相同的名称.
尝试说明以下情况

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

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


它给出错误同一表"ChildDetails"不能是两个嵌套关系中的子表".
在网上检查后,我将必须按照以下链接所述手动重命名元素名称
http://social.msdn.microsoft.com/Forums/zh-CN/xmlandnetfx/线程/22f98352-83b9-4638-a306-34a36a11e4d6 [ ^ ]

".NET 2.0(Visual Studio 2005)中的DataSet类仍然具有不支持名称相同的不同嵌套表的局限性.因此,在将XML(和模式)加载到DataSet中之前,您将必须引入XML转换来对其进行预处理."

一直试图在xsd.exe生成的Class文件中更改元素名称,但仍使用原始元素名称生成.

任何帮助将不胜感激.


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.

推荐答案


这篇关于如何从XSD创建XML的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-21 04:04