Hi all i was wondering wheather someone could explain how i would extract the string data in bold from the xml line bellow?

<countrydata>

<stateid="point"><name>Sligo</name><size>2</size><loc>54.28,-8.48</loc></state>

</countrydata>

I am using an xReader to read the file in another program but the structure is very different, the code i use for the other app us bellow. could someone please direct me in how i should change this code to suit the current xml, i will need to put 54.28,-8.48 from above into 2 seperate variables as i loop through the lines.

Any help would be great many thanks

Dim Country as String
Dim RefPosLat As Double
Dim RefPosLong As Double
xReader.ReadToFollowing("countrydata")
Name = xReader.GetAttribute("id").Split(",")(1)
Dim trStr As String = Name.Trim()
xReader.ReadToFollowing("RefPosLat")
Try
RefPosLat = xReader.ReadElementContentAsDouble
Catch ex As Exception
RefPosLat = CDbl("0.0000000000")
End Try
xReader.ReadToFollowing("RefPosLong")
Try
RefPosLong = xReader.ReadElementContentAsDouble
Catch ex As Exception
RefPosLong = CDbl("0.000000000")
End Try

Domino.Vbcoder

Try Using Dataset, Datatable and DataRows

Dim SQLds As New DataSet
Dim SQLTable As New DataTable
Dim SQLRow As DataRow

SQLds.ReadXml("MyXML.xml")

SQLTable = SQLds.Tables(0)
For Each SQLRow In SQLTable.Rows[INDENT]Variable = SQLRow("name").tostring
Variable = SQLRow("size").tostring
Variable = SQLRow("loc").tostring
[/INDENT]Next
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.