Reputation: 1447
I've got the following code in VB 2012, which returns a correct XML:
Dim xml = XDocument.Load("http://myURL.com/api/request")
I know I can use the values form the XML this way:
Debug.WriteLine(xml.<response>.<label1>.<regel1>.<text>.Value)
But the problem is, that label1
can also be label2
, label3
etc. How can i create something like this:
For iLabel as Integer = 1 To myArray.Length
Debug.WriteLine(xml.<response>.<label + iLabel>.<regel1>.<text>.Value)
Next
Upvotes: 0
Views: 51
Reputation: 89285
How about using .Elements(XName)
method, for example :
For iLabel as Integer = 1 To myArray.Length
Debug.WriteLine(xml.<response>.Elements("label" & iLabel).<regel1>.<text>.Value)
Next
Upvotes: 1