Results 1 to 8 of 8

Thread: [RESOLVED] Load xml string into dataset/datatable

Threaded View

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Nov 2000
    Location
    Minnesota
    Posts
    830

    [RESOLVED] Load xml string into dataset/datatable

    I have returned xml data in a variable and need to loop through the returned xml and pull certain data from select nodes.

    I was thinking the best way would be to load into a dataset (or datatable) and loop through that.

    I also have the xmlschema. What's the best way to code this?

    I thought I could do something like so but it gives me the following error:
    DataTable 'newdt' does not match to any DataTable in source.
    Code:
    Dim dtResults As New DataTable("newdt")
    dtResults.ReadXmlSchema("SearchResults.xsd")
    dtResults.ReadXml(sRetVal)
    SearchResults.xsd
    Code:
    <?xml version="1.0" encoding="UTF-8"?>
    <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
    <xs:element name="Resumes">
    <xs:complexType>
    <xs:sequence>
    <xs:element name="Resume" maxOccurs="1000">
    <xs:complexType>
    <xs:sequence>
    <xs:element name="id" type="xs:string"/>
    <xs:element name="City" type="xs:string" minOccurs="0"/>
    <xs:element name="State" type="xs:string" minOccurs="0"/>
    <xs:element name="Country" type="xs:string" minOccurs="0"/>
    </xs:sequence>
    </xs:complexType>
    </xs:element>
    </xs:sequence>
    </xs:complexType>
    </xs:element>
    </xs:schema>
    sample text need to loop through
    Code:
    <?xml version="1.0" encoding="utf-8"?>
    <Resumes xmlns="http://hj.yahooapis.com/v1/schema.rng" xmlns:yahoo="http://www.yahooapis.com/v1/base.rng" xml:lang="en-US" yahoo:start="1" yahoo:total="4" yahoo:count="4">
    <Resume yahoo:uri="http://hj.yahooapis.com/v1/Resume/MjAxxx" xml:lang="en-US" >
    <id>MjAxxx</id>
    <City>Prior Lake</City>
    <State>MN</State>
    <Country>USA</Country>
    </Resume>
    <Resume yahoo:uri="http://hj.yahooapis.com/v1/Resume/MjExxx" xml:lang="en-US" >
    <id>MjExxx</id>
    <City>Eagan</City>
    <State>MN</State>
    <Country>USA</Country>
    </Resume>
    <Resume yahoo:uri="http://hj.yahooapis.com/v1/Resume/MzExxx" xml:lang="en-US" >
    <id>MzExxx</id>
    <City>Burnsville</City>
    <State>MN</State>
    <Country>USA</Country>
    </Resume>
    <Resume yahoo:uri="http://hj.yahooapis.com/v1/Resume/ODExxx" xml:lang="en-US" >
    <id>ODExxx</id>
    <City>Eagan</City>
    <State>MN</State>
    <Country>USA</Country>
    </Resume>
    </Resumes>
    <!-- uncompressed/chunked Fri Mar 27 09:57:27 PDT 2009 -->
    Last edited by lleemon; Mar 30th, 2009 at 01:35 PM. Reason: Resolved

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width