Strange XML

Joined
Oct 2, 2007
Messages
14
Programming Experience
1-3
Hi all i was wondering wheather someone could explain how i would extract the string data in bold from the xml line bellow?

HTML:
<countrydata>

<state id="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

VB.NET:
  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
 
Last edited by a moderator:
Back
Top