Imports System

Imports System.IO

Imports System.Xml

 

Public Class Sample

 

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

        Dim doc As XmlDocument = New XmlDocument()

        doc.Load("books.xml")

 

        ' Create an XmlNamespaceManager to resolve the default namespace.

        Dim nsmgr As XmlNamespaceManager = New XmlNamespaceManager(doc.NameTable)

        nsmgr.AddNamespace("bk", "urn:newbooks-schema")

 

        ' Select and display all book titles.

        Dim nodeList As XmlNodeList

        Dim root As XmlElement = doc.DocumentElement

        nodeList = root.SelectNodes("/bk:bookstore/bk:book/bk:title", nsmgr)

        Dim title As XmlNode

        For Each title In nodeList

            Console.WriteLine(title.InnerXml)

        Next

    End Sub

End Class