The following example uses the FileInputStream() query to read bookstore.xml, and the URI() method to read a Web page named bookstore.xml which contains information about all the books in the bookstore:
String result; FileInputStream XmlFile = new FileInputStream("bookstore.xml"); if ((result = Xql.query("/bookstore/book/author/first-name", XmlFile)) != Xql.EmptyResult ) { System.out.println(result); }else{ System.out.println("Query returned false\n"); } URI _uri = new URI("http://mybookstore/bookstore.xml"); if ((result = Xql.query("/bookstore/book/author/first-name",uri.openStream())) != Xql.EmptyResult ) { System.out.println(result); }else{ System.out.println("Query returned false\n");}
Copyright © 2005. Sybase Inc. All rights reserved. |
![]() |