query(String query, String xmlDoc)  query(String query, SybXmlStream xmlDoc)

Appendix D: The Java-Based XQL Processor

query(String query, InputStream xmlDoc)

Description

Queries an XML document using an input stream as the second argument.

Syntax

query(String query,InputStream xmlDoc)

Where:

Examples

Example 1

This example queries the bookstore for authors listed in bookstore.Xql.

FileInputStream xmlStream = new FileInputStream("doc.xml");
String result = Xql.query("/bookstore/book/author", xmlStream);

The following example queries an XML document on the Web using a URI as the search argument:

URI xmlURI = new URI("http://mywebsite/doc.xml");
String result = Xql.query("/bookstore/book/author", xmlURI.openStream());

Usage

Returns a Java string.





Copyright © 2005. Sybase Inc. All rights reserved. query(String query, SybXmlStream xmlDoc)

View this book as PDF