The following code fragment uses the Xql.query method to query the xmlcol column in the XMLTEXT file:
String selectQuery = “select xmlcol from XMLTEXT”;
Statement stmt = _con.createStatement();
ResultSet rs = (SybResultSet)stmt.executeQuery(selectQuery);
String result;
InputStream is = null;
while ((rs != null) && (rs.next()))
{
is = rs.getAsciiStream(1);
result = Xql.query(“/bookstore/book/author”, is);
}
the following example assumes that the parsed XML data is stored in an image column of the XMLDOC table. Although this application fetches an image column as a binary stream, it does not parse this during the query because it identifies the content of this binary stream as a parsed XML document. Instead, the application creates a SybXmlStream instance from it and then executes the query. All this is done using the Xql.query() method, and does not require any input from the user.
String selectQuery = “select xmlcol from XMLDOC”;
Statement stmt = _con.createStatement();
ResultSet rs = (SybResultSet)stmt.executeQuery(selectQuery);
InputStream is = null;
String result
while ((rs != null) && (rs.next()))
{
is = rs.getBinaryStream(1);
result = Xql.query(“/bookstore/book/author/first-name”, is));
}