Results 1 to 4 of 4

Thread: [RESOLVED] XML parsing - help needed

Threaded View

  1. #1

    Thread Starter
    PowerPoster BruceG's Avatar
    Join Date
    May 2000
    Location
    New Jersey (USA)
    Posts
    2,657

    Resolved [RESOLVED] XML parsing - help needed

    I know there are a lot of XML methods available and lots of code examples floating around, but for whatever reason I can't wrap my head around exactly what to do. Here's what I have.

    I am getting a string of XML data back from a web service. Let's say the string is called strData. The content of strData is structured like this:
    <dataset>
    <record><field1>blah</field1><field2>whatever</field2></record>
    <record><field1>something</field1><field2>somethingelse</field2></record>
    </dataset>

    So now of course I need to parse this XML to process the data. I am trying to write a little proof-of-concept test app to get this XML loaded into a dataset, defined simply as:

    Dim ds As New DataSet

    The question is what code / XML objects / methods do I need to populate this dataset, so that I can run the following code to see the field names and corresponding content, like so:
    Code:
           For Each aRow As DataRow In ds.Tables(0).Rows
                For Each aCol As DataColumn In ds.Tables(0).Columns
                    TextBox2.Text &= aCol.ColumnName & ": " & aRow(aCol) & vbNewLine
                Next
                TextBox2.Text &= vbNewLine
            Next
    Any help would be greatly appreciated!
    Thanks,
    Bruce
    Last edited by BruceG; Feb 19th, 2012 at 11:22 AM. Reason: resolved
    "It's cold gin time again ..."

    Check out my website here.

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