Java Reference
In-Depth Information
}
protected String wordAfter(String SQLCmd, String after){
String word = SQLCmd.substring(SQLCmd.indexOf(after)+
after.length()).trim();
if(word.indexOf(" ")>-1)word = word.substring(0,word.indexOf(" "));
return word.trim();
}
}
The XMLQuery class
The XMLQuery class extends the basic XMLCommand class. An XMLQuery object is created by the
XMLStatement when the Statement.executeQuery() method is called. In its constructor,
XMLQuery calls the parseSQLCmd() method of its base class. Listing 19-10 shows the XMLQuery
class.
Listing 19-10: XMLQuery class
package JavaDatabaseBible.ch19.JDBCforXML;
import java.io.*;
import java.util.StringTokenizer;
import java.util.Vector;
import java.sql.SQLException;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.NodeList;
import org.w3c.dom.Node;
import org.xml.sax.InputSource;
import org.apache.xerces.parsers.DOMParser;
/**
* XMLQuery extends XMLCommand to provide XL specific query processing
*/
public class XMLQuery extends XMLCommand{
private Document xmlDoc;
public XMLQuery(String SQLString) {
this.SQLString = SQLString.toUpperCase().trim();
parseSQLCmd(SQLString);
}
// process xml doc and build ResultSet doc
public XMLResultSet processDoc(Document xmlDoc) throws SQLException{
Search WWH ::




Custom Search