使用DataSet ReadXmlSchema的DuplicateNameException

时间:2017-03-30 14:11:22

标签: c# xml datatable xsd

当我尝试使用ReadXmlSchema读取XSD文件时,我得到 DuplicateNameException

this.Schema = new DataSet();
this.Schema.ReadXmlSchema(this.SchemaFile);

错误:

  

System.Data.DuplicateNameException:名为' Tipo'已经   属于这个DataTable。

完整的xsd文件: https://gist.github.com/kiquenet/86090779650975b7426a7f798174eef6#file-respuesta-xsd

堆栈跟踪:

   en System.Data.DataColumnCollection.RegisterColumnName(String name, DataColumn column)
   en System.Data.DataColumnCollection.BaseAdd(DataColumn column)
   en System.Data.DataColumnCollection.AddAt(Int32 index, DataColumn column)
   en System.Data.XSDSchema.HandleElementColumn(XmlSchemaElement elem, DataTable table, Boolean isBase)
   en System.Data.XSDSchema.HandleParticle(XmlSchemaParticle pt, DataTable table, ArrayList tableChildren, Boolean isBase)
   en System.Data.XSDSchema.HandleParticle(XmlSchemaParticle pt, DataTable table, ArrayList tableChildren, Boolean isBase)
   en System.Data.XSDSchema.HandleParticle(XmlSchemaParticle pt, DataTable table, ArrayList tableChildren, Boolean isBase)
   en System.Data.XSDSchema.HandleComplexType(XmlSchemaComplexType ct, DataTable table, ArrayList tableChildren, Boolean isNillable)
   en System.Data.XSDSchema.InstantiateTable(XmlSchemaElement node, XmlSchemaComplexType typeNode, Boolean isRef)
   en System.Data.XSDSchema.HandleTable(XmlSchemaElement node)
   en System.Data.XSDSchema.HandleParticle(XmlSchemaParticle pt, DataTable table, ArrayList tableChildren, Boolean isBase)
   en System.Data.XSDSchema.HandleParticle(XmlSchemaParticle pt, DataTable table, ArrayList tableChildren, Boolean isBase)
   en System.Data.XSDSchema.HandleComplexType(XmlSchemaComplexType ct, DataTable table, ArrayList tableChildren, Boolean isNillable)
   en System.Data.XSDSchema.InstantiateTable(XmlSchemaElement node, XmlSchemaComplexType typeNode, Boolean isRef)
   en System.Data.XSDSchema.HandleTable(XmlSchemaElement node)
   en System.Data.XSDSchema.LoadSchema(XmlSchemaSet schemaSet, DataSet ds)
   en System.Data.DataSet.ReadXmlSchema(XmlReader reader, Boolean denyResolving)
   en System.Data.DataSet.ReadXmlSchema(String fileName)

有任何修复建议或获取有关错误原因的更多信息吗?

0 个答案:

没有答案