Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
如何在此循环中获取 XML 元素的位置?
For Each objNode In objDoc.SelectNodes("//books/book") ??? Next
我想要的输出是这样的
1 2 3 4 ....
你可能想要这样的东西:
objBooks = objDoc.SelectSingleNode("//books") Dim pos As Integer = 1 For Each book As XmlNode In objBooks.ChildNodes Console.Write(pos & " ") pos = pos + 1 Next