Imports System.IO
Imports System.Xml
Imports System.Xml.XPath

Partial Class _Default
    Inherits System.Web.UI.Page

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) _
           Handles Me.Load
        'Wczytaj dokument
        Dim booksFile As String = Server.MapPath("books.xml")

        Dim document As New XPathDocument(booksFile)
        Dim nav As XPathNavigator = document.CreateNavigator()

        'Dodaj prefiks przestrzeni nazw, aby mógł być wykorzystany w wyrażeniu XPath
        Dim namespaceMgr As New XmlNamespaceManager(nav.NameTable)
        namespaceMgr.AddNamespace("b", "http://example.books.com")

        'Wszystkie książki, których cena nie jest większa niż 10.00
        For Each node As XPathNavigator In nav.Select( _
                "//b:book[not(b:price[. > 10.00])]/b:price", namespaceMgr)
            Dim price As Decimal = _
                CType(node.ValueAs(GetType(Decimal)), Decimal)
            Response.Write(String.Format("Cena wynosi {0}<BR/>", _
                price))
        Next


    End Sub

End Class
