Question Multiple Items Returned In XML - What do i do please?

trevorjdaniel

Member
Joined
Sep 24, 2009
Messages
8
Programming Experience
1-3
Hello, hope you can help!

I am calling an external XML feed which is returning multiple rows of information but I am unable to work out how to load these records into an object that can be returned by the class.

Here is the code I have so far:

VB.NET:
Public Class GetGeocodeResults

        Private RawData As XElement
        Public PlaceName As String
        Public lat As String
        Public lon As String
        Public MapQuestStatusCode As Boolean

        Public Sub New(ByVal rawDataString As String)
            Me.RawData = XElement.Parse(rawDataString)
            
            Try
                For Each child As XElement In Me.RawData.Elements()
                    PlaceName = child.Attribute("display_name").Value
                    lat = child.Attribute("lat").Value
                    lon = child.Attribute("lon").Value
                Next
            Catch
                MapQuestStatusCode = False
            End Try

        End Sub

    End Class

As you can see the PlaceName, lat and lon changes everytime it loops through a new record.

Can anyone help me work out how to load it into somekind of object which will be returned that contains all the results please?

Many thanks
 
Back
Top