xml ado

dpan

Active member
Joined
Nov 22, 2005
Messages
28
Programming Experience
Beginner
Ok I need some real help. I have been searching the web for 3 or 4 days tring to understand this. Ok I have an xml document and want to loop through it and use the data to create an html document with the data. However I need to make some changes to the strings before I create the html document. Please note I don't want to change anything in the xlm document.

here is my xml document:
VB.NET:
<root>
<WebSite>
  <WebSiteName>Webs1</WebSiteName>
  <Date>12-19-2000</Date>
     <URL>http://myweb.com</URL>
     <LastVisit>12-19-2000</LastVisit>
  <MyUsernamel>User Name</MyUsernamel>
</WebSite>
  <WebSite>
  <WebSiteName>Webs2</WebSiteName>
  <Date>12-19-2000</Date>
     <URL>http://myweb.com</URL>
     <LastVisit>12-19-2000</LastVisit>
  <MyUsernamel>User Name</MyUsernamel>
</WebSite>
<WebSite>
  <WebSiteName>Webs3</WebSiteName>
  <Date>12-19-2000</Date>
     <URL>http://myweb.com</URL>
     <LastVisit>12-19-2000</LastVisit>
  <MyUsernamel>User Name</MyUsernamel>
</WebSite>
<WebSite>
  <WebSiteName>Webs4</WebSiteName>
  <Date>12-19-2000</Date>
     <URL>http://myweb.com</URL>
     <LastVisit>12-19-2000</LastVisit>
  <MyUsernamel>User Name</MyUsernamel>
</WebSite>
 </root>

I have found alot of info on how to do this but I guess I just don't get it.
Here is the code I got so far:
VB.NET:
 Dim MyXMLDataSet As New DataSet("XMLDataSet")
        MyXMLDataSet.ReadXml("test.xml")
I'v found that I can easly add this into a datagridview.... and can add and remove records... but now what I need.

I also can blindly loop through it like this:
VB.NET:
 Dim table As DataTable
        Dim row As DataRow
        Dim column As DataColumn

        ' For each table in the DataSet, print the row values.
        For Each table In MyXMLDataSet.Tables
            For Each row In table.Rows
                For Each column In table.Columns

                    TextBox1.Text = TextBox1.Text + (row(column)) + ControlChars.CrLf
                   
                Next column
            Next row
        Next table

I guess what I need to do is somehow load the xml into a multidimensional array and then loop through it.... But I can't find any examles that I can understand.

So what I'm asking is could someone please give me an example.
 
hey i dont know what are u actually trying to do but... if i have not considered you wrong then heres how i will do this

Dim ds As New DataSet
ds.ReadXml(Server.MapPath("test.xml"))
Dim i As Int16
For i = 0 To ds.Tables(0).Rows.Count - 1
TextBox1.Text = ds.Tables(0).Rows(i).Item("URL")
Next
 
Back
Top