I’m using the TaminoClient from the Tamino XML Database 2.3.1.1 for Windows.
JAXP 1.1 does not want to read in the tree from the getDocument().
I’ve attached a code example from the JAXP 1.1 examples, and inserted below a snippet of how I expected to plug in the TaminoResult.
I’ve replaced this section:
code:
// Step 3: parse the input file
Document doc = null;
try {
doc = db.parse(new File(filename));
} catch (SAXException se) {
System.err.println(se.getMessage());
System.exit(1);
} catch (IOException ioe) {
System.err.println(ioe);
System.exit(1);
}
with this:
code:
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
DocumentBuilder db = null;
Document doc = null;
TaminoResult tr = null;
try
{
db = dbf.newDocumentBuilder();
doc = db.newDocument();TaminoClient tamino = new TaminoClient( TAMINO_URL );
tamino.setPageSize(10);
tamino.startSession();
tr = tamino.query( “CATEGORY” );
doc = tr.getDocument();
tamino.endSession();
}
catch( … )
{
…
}
I get an Exception when trying to manipulate the doc with the DOMEcho.java example attached (code replaced as described.
Anybody have any experience and luck with the getDocument() or getElement() methods from the TaminoResult?
Perhaps I am just doing something wrong. I did convert send the toXmlString to an InputStream and parsed that successfully with the same code. Example of this:
code:
StringBufferInputStream is = new StringBufferInputStream( tr.toXmlString() );
doc = db.parse( is );
Not clean, but it got my job done. I could use the JAXP and walk down the tree with no problems after this. But I see it as a String → TaminoResult → String → Document.
Hopefully this community can help.
Terry
DOMEcho.java (12.4 KB)