Web Wiz - Green Windows Web Hosting

  New Posts New Posts RSS Feed - Confusion in XML
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Confusion in XML

 Post Reply Post Reply Page  <1 567
Author
Diep-Vriezer View Drop Down
Senior Member
Senior Member
Avatar

Joined: 06 August 2003
Location: Netherlands
Status: Offline
Points: 831
Post Options Post Options   Thanks (0) Thanks(0)   Quote Diep-Vriezer Quote  Post ReplyReply Direct Link To This Post Posted: 01 December 2003 at 11:52pm

... is half the work. Thx

Gone..
Back to Top
Mart View Drop Down
Senior Member
Senior Member
Avatar

Joined: 30 November 2002
Status: Offline
Points: 2304
Post Options Post Options   Thanks (0) Thanks(0)   Quote Mart Quote  Post ReplyReply Direct Link To This Post Posted: 07 December 2003 at 6:02am

private const localURL as String = " http://localhost/quickstart/howto/samples/Xml/QueryXmlDocume ntXPath/cs/books.xml"

Shared sub Main
    Dim myQueryXmlDocumentXPathSample as QueryXmlDocumentXPathSample
    myQueryXmlDocumentXPathSample = new QueryXmlDocumentXPathSample()
    myQueryXmlDocumentXPathSample.Run(localURL)
end sub

public sub Run(args as String)
    Console.WriteLine("XPath Test started ...")

    Dim myXPathDocument as XPathDocument = new XPathDocument(args)
    Dim myXPathNavigator as XPathNavigator = myXPathDocument.CreateNavigator()

    ' Get all the book prices
    XPathQuery(myXPathNavigator, "descendant::book/price")

    ' Get the ISBN of the last book
    XPathQuery(myXPathNavigator, "bookstore/book[3]/@ISBN")
end sub

private sub XPathQuery(myXPathNavigator as XPathNavigator, xpathexpr as String )

    try
        Console.WriteLine("XPath query: " + xpathexpr)

        ' Create a node interator to select nodes and move through them (read-only)
        Dim myXPathNodeIterator as XPathNodeIterator  =  myXPathNavigator.Select (xpathexpr)

        while (myXPathNodeIterator.MoveNext())
             Console.WriteLine("<" & myXPathNodeIterator.Current.Name + "> " & myXPathNodeIterator.Current.Value)
        end while

        Console.WriteLine()
    catch e as Exception
        Console.WriteLine ("Exception: {0}", e.ToString())
    end try
end sub

Back to Top
Diep-Vriezer View Drop Down
Senior Member
Senior Member
Avatar

Joined: 06 August 2003
Location: Netherlands
Status: Offline
Points: 831
Post Options Post Options   Thanks (0) Thanks(0)   Quote Diep-Vriezer Quote  Post ReplyReply Direct Link To This Post Posted: 07 December 2003 at 7:34am
 Nice! This'll do the job!
Gone..
Back to Top
 Post Reply Post Reply Page  <1 567

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.08
Copyright ©2001-2026 Web Wiz Ltd.


Become a Fan on Facebook Follow us on X Connect with us on LinkedIn Web Wiz Blogs
About Web Wiz | Contact Web Wiz | Terms & Conditions | Cookies | Privacy Notice

Web Wiz is the trading name of Web Wiz Ltd. Company registration No. 05977755. Registered in England and Wales.
Registered office: Web Wiz Ltd, Unit 18, The Glenmore Centre, Fancy Road, Poole, Dorset, BH12 4FB, UK.

Prices exclude VAT at 20% unless otherwise stated. VAT No. GB988999105 - $, € prices shown as a guideline only.

Copyright ©2001-2026 Web Wiz Ltd. All rights reserved.