You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Steve Conover <sc...@groundswell.net> on 2000/08/08 17:43:57 UTC

possible solution to hierarchy problem - need advice

Ok so I think I might have an Oracle-specific solution to this hierarchical
resultsets problem.  I noticed in Marcelo's documentation that he used and
example of the oracle xml api (roughly like this):

(given java.sql.Connection cn)

OracleXMLQuery q = new OracleXMLQuery(cn, "select fname, lname from emp");
q.useLowerCaseTagNames();
System.out.println(q.getXMLString().substring(22)); 
//substring(22) removes <?xml version... from xml string

so the result is that I have the XML output using Oracle's api, which
presumably would support output of nested queries (since it works in XSQL
and I assume the XSQL servlet uses this api under the covers).  This code
would be in an xsp taglib, so now I need to figure out how to load this XML
string output into the DOM on-the-fly.  I looked in the Xerces javadocs, and
it looks like I could possibly turn the string into a character stream (so
that I can create an "InputSource"), and feed that to the parser.  Is there
some way I can grab the current parser instance to do this, or (more likely)
I guess I need to instanciate a new parser every time, load the XML string,
extract a Document from that, then morph the Document into an Element and
return that out of the xsp:logic function.  Does this sound right, or is
there an easier way to load an XML string result from some java calls into
the DOM?

Regards,
Steve