• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1836
  • Last Modified:

XML to DataSet - Nested table /Multiple inheritence Error

Hi,

I am trying to load XML into a Dataset using DataSet.ReadXML( ) method.

Encountering the below error -

System.InvalidOperationException: Nested table ‘Address’ which inherits its namespace cannot have multiple parent tables in different namespaces
XML is retrieved from a third party and  these are a few notable points :
1 ) The "Address" type is present as child elements at various levels like Email, contact etc. While some of these child elements are of simple type & have "type=string" , the others refer to a "type=nis:Address" where nis:address is given by (as below) -
          <element name="Address">
            <complextype>
                  <sequence>
                        <element name="AddressTypeCode" type="nis:AddressTypeCodeType" />
                        <element name="Address" type="string" />
                        <element name="IsPreferred" type="nis:Boolean" />
                  </sequence>
                  <attribute use="required" ref="nis:referenceNumber" />
            </complextype>
      </element>

2) The third party says they are generating the XML under a single namespace and it works fine on a PHP parser. I am using C#.
3) I have tried the XmlReadMode.IgnoreSchema , though the error is not seen then , the dataset retreived is empty.
Any suggestion how I can work this around?
Best.,



0
charge22
Asked:
charge22
  • 2
  • 2
1 Solution
 
Bob LearnedCommented:
You might have to go in a different direction from DataSet.ReadXml.  What version of .NET are you using?
0
 
charge22Author Commented:
.Net Frame work  3.5 on VS 2008
0
 
Bob LearnedCommented:
Great!!  I am current looking at the LINQ-to-XSD project, where you can create classes from .xsd schema files:

LINQ to Everything - LINQ to XSD adds more LINQiness
http://www.hanselman.com/blog/LINQToEverythingLINQToXSDAddsMoreLINQiness.aspx
0
 
Tommy11bCommented:
Two questions,
01) can you attach an example file so I can take a shot at it?
02) Are you trying to read into a Typed or Untyped dataset?
0
 
charge22Author Commented:
Hello,

Thank you Tommy11b & TheLearnedOne for your help.This turned out to be a Data issue from third party vendor.Now sorted. Thank you again.

rgds
Deepti
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Network Scalability - Handle Complex Environments

Monitor your entire network from a single platform. Free 30 Day Trial Now!

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now