views:

193

answers:

1

How do I get the position of the XML element in this loop?

For Each objNode In objDoc.SelectNodes("//books/book")

 ???

Next

What I want in output would be something like

1 2 3 4 ....

+5  A: 

You probably want something like:

objBooks = objDoc.SelectSingleNode("//books")

Dim pos As Integer = 1
For Each book As XmlNode In objBooks.ChildNodes

   Console.Write(pos & " ")

   pos = pos + 1
Next
Adam