How can I merge an untyped nested dataset to a typed nested dataset?

From: Jim Hunt (jimh_at_netwasp.com)
Date: 10/05/04


Date: 5 Oct 2004 09:13:03 -0700

I am using a typed DataSet. I want to load the country and network
data from the database. I can do this using a non-Typed DataSet using
two seperate queries and setting up a relationship between the two
resulting DataTables. I can also get it to return a Nested XML string
by setting the Netsted property to true. I am unable to merge this
untyped DataSet with a Typed one due to a known bug in the 1.1
Framework and blows up when the Nested property is accessed. I woudl
like to be able to do it manually as it's not a lot of data but I am
unable to manually create a typed DataRow. How can I do this? I've
also tried sucking the XML fromthe untyed DataSet into the Typed one
and this doesn't work either (the untyped one is in fact just a
fragment of the entire typed one). I've tried using Import and I've
tried using Merge - these just blow up because of this bug. I've been
tryog tor 2 days now and I just can't figure out from the MSDN
documentation a way of doing this

This is the schema used by the typed DataSet:

<?xml version="1.0" standalone="yes"?>
<xs:schema id="ResultData" xmlns="http://blah.com"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
  <xs:element name="ResultData" msdata:IsDataSet="true"
msdata:Locale="en-GB">
    <xs:complexType>
      <xs:choice maxOccurs="unbounded">
        <xs:element name="DataSet">
          <xs:complexType>
            <xs:sequence>
              <xs:element name="resultcode" type="xs:string"
minOccurs="0" />
              <xs:element name="networks" minOccurs="0"
maxOccurs="unbounded">
                <xs:complexType>
                  <xs:sequence>
                    <xs:element name="country" minOccurs="0"
maxOccurs="unbounded">
                      <xs:complexType>
                        <xs:sequence>
                          <xs:element name="network" minOccurs="0"
maxOccurs="unbounded">
                            <xs:complexType>
                              <xs:attribute name="id" type="xs:string"
/>
                              <xs:attribute name="name"
type="xs:string" />
                            </xs:complexType>
                          </xs:element>
                        </xs:sequence>
                        <xs:attribute name="id" type="xs:string" />
                        <xs:attribute name="name" type="xs:string" />
                      </xs:complexType>
                    </xs:element>
                  </xs:sequence>
                </xs:complexType>
              </xs:element>
            </xs:sequence>
          </xs:complexType>
        </xs:element>
      </xs:choice>
    </xs:complexType>
  </xs:element>
</xs:schema>

And here is an example of some XML

<ResultData xmlns="http://blah.com">
        <DataSet>
                <resultcode>0</resultcode>
                <networks>
                        <country id="227" name="UK">
                                <network id="10" name="O2" />
                                <network id="15" name="Vodafone" />
                        </country>
                        <country id="228" name="US">
                                <network id="31" name="T-Mobile" />
                                <network id="20" name="Vodafone" />
                        </country>
                </networks>
        </DataSet>
</ResultData>



Relevant Pages

  • Re: Clarification on XML parsing & namespaces (xml.dom.minidom)
    ... > bug, or correct behaviour? ... when I create an XML document ... > namespace exists as an xmlns attribute in the DOM (fair enough, ... Should I file a bug on ...
    (comp.lang.python)
  • Re: Escape Sequences
    ... Maybe the page is HTML instead of XML, but the basic behavior is still applicable. ... works fine in a regular .cs file in a normal project, and the more-complete code example you posted would definitely _not_ compile in a regular .cs file in a normal project. ... I would think your situation is definitive proof that the ASP.NET code you've got is not "C# code in every respect". ... I would expect the "by design" resolution of the bug to include an explanation describing why what you're seeing is intended behavior. ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Bug in SQLXML
    ... If so I can file a bug. ... Program Manager - SqlXml ... > with "FOR XML NESTED" clause. ...
    (microsoft.public.sqlserver.xml)
  • Re: Escape Sequences
    ... If so, then it looks to me as though maybe the editor is doing the right thing, and the tag is getting interpreted as XML even though it's in the quotes. ... The string is treated as a single string as expected. ... Barring someone else here who is more of an expert explaining whatever is going on, I guess the best thing to do is report is as a bug. ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: if I wanted to never use innerHTML, what else would I use?
    ... The fundamental problem with XHTML is the people trying to write it ... just as they try any other XML. ... but authoring webpages is something people do by hand - or by other ... How many people don't complain if a bug crashes their application? ...
    (comp.lang.javascript)

Loading