Link to home
Start Free TrialLog in
Avatar of charge22
charge22

asked on

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.,



Avatar of Bob Learned
Bob Learned
Flag of United States of America image

You might have to go in a different direction from DataSet.ReadXml.  What version of .NET are you using?
Avatar of charge22
charge22

ASKER

.Net Frame work  3.5 on VS 2008
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
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?
ASKER CERTIFIED SOLUTION
Avatar of charge22
charge22

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial