The following example uses the FileInputStream() query to read bookstore.xml, and the URL() 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");
}
URL _url = new URL("http://mybookstore/bookstore.xml");
if ((result =
Xql.query("/bookstore/book/author/first-name",url.openStream()))
!= Xql.EmptyResult )
{
System.out.println(result);
}else{
System.out.println("Query returned false\n");
}