I was avoiding this, but you got me. Admittedly, despite the supposed simplicity of XML, it's not exactly a learn-in-one-evening affair. I had to learn it on my own before much was out about it, and I've since heard that good tutorials are hard to find. Hey, if anyone knows of one, I'd love to add it to my list.
If you do plan on doing more with XML one day, then I recommend Micro$oft's free XML parser:
"http://msdn.microsoft.com/downloads/default.asp?url=/downloads/topic.asp?URL=/MSDN-FILES/028/000/072/topic.xml"
You can use it within VB like any other COM library, but it is a steep learning curve, so I'll just post a quick-and-dirty parser. If all you need to do is read the xml you posted, then this will do in a pinch:
Option Explicit
'declare a struct
Public Type Member
sFirstName As String
sLastName As String
iRank As Integer
sRankName As String
iLevel As Integer
sProfession As String
sBreed As String
sPhotoUrl As String
End Type
Public Sub LoadXMLData()
Dim sText As String
Dim colMembs As New Collection
Dim Members() As Member
Dim lPos As Long
Dim lEnd As Long
Dim fso As New FileSystemObject
Dim ts As TextStream
Dim i As Integer
Set ts = fso.OpenTextFile("D:\Temp\basicstats.xml", ForReading)
sText = ts.ReadAll
ts.Close
'parse out each member
'inefficient but easy
Do
lPos = InStr(lEnd + 1, sText, "")
If lPos = 0 Then Exit Do
lEnd = InStr(lPos + 9, sText, "")
If lEnd = 0 Then
Exit Do
Else
lPos = lPos + 8
End If
colMembs.Add Mid$(sText, lPos, lEnd - lPos)
Loop
If colMembs.Count = 0 Then Exit Sub
'1-based to match collections :(
ReDim Members(1 To colMembs.Count)
For i = 1 To colMembs.Count
lPos = InStr(colMembs(i), "")
If lPos > 0 Then
lEnd = InStr(lPos, colMembs(i), "")
If lEnd > 0 Then
lPos = lPos + 11
Members(i).sFirstName = Mid(colMembs(i), lPos, lEnd - lPos)
End If
End If
lPos = InStr(colMembs(i), "")
If lPos > 0 Then
lEnd = InStr(lPos, colMembs(i), "")
If lEnd > 0 Then
lPos = lPos + 6
Members(i).iRank = Val(Mid(colMembs(i), lPos, lEnd - lPos))
End If
End If
''''process rest similarly...
Debug.Print Members(i).sFirstName
Debug.Print Members(i).iRank
''..........
Debug.Print vbCrLf
Next
End Sub
You can pop it into any old .bas file. I found it easier to load an array of structs (Types in VB), but you could adapt this to a 2-dimensional array. I made no attempt to download the file, just read it from disk, to save me work. This is lazy code; it won't win any efficiency awards. Nevertheless, remember that XML is case-sensitive, so don't waste parsing time by setting vbTextCompare.
Cheers