Use XPath to do a 'select' command
Imports System
Imports System.Xml
Imports System.Xml.Schema
Imports System.IO
Imports System.Data.SqlClient
Imports System.Collections
Imports System.Data
Public Class MainClass
Shared Sub Main()
Dim XDoc As New XmlDocument()
XDoc.Load("book.xml")
Dim XNodes As XmlNodeList
XNodes = XDoc.DocumentElement.SelectNodes( _
"//Book[starts-with(@Name, 'C#')]/Order")
Console.WriteLine("Found {0} Nodes", XNodes.Count)
Dim XNode As XmlNode
For Each XNode In XNodes
Console.WriteLine("Book {0} ordered {1} {2}", _
XNode.ParentNode.Attributes.GetNamedItem("Name").Value, _
XNode.Attributes.GetNamedItem("Quantity").Value, _
XNode.InnerText)
Next
End Sub
End Class
Related examples in the same category