June 2003
Intermediate to advanced
800 pages
34h 20m
English
You need to retrieve a specific node from an XmlDocument, and you know its name but not its position.
Use the XmlDocument.GetElementsByTagName method.
The XmlDocument class provides a convenient GetElementsByTagName method that searches an entire document for nodes that have the indicated element name. It returns the results as a collection of XmlNode objects.
This code demonstrates how you could use GetElementsByTagName to calculate the total price of an order:
Public Module XmlSearchTest Public Sub Main() ' Load the document. Dim Doc As New XmlDocument Doc.Load("orders.xml") ' Retrieve all prices. Dim PriceNodes As XmlNodeList PriceNodes = Doc.GetElementsByTagName("Price") Dim PriceNode As ...Read now
Unlock full access