TaminoResult.getDocument() problem/question

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)

Maybe your doc is not org.w3c.dom.Document I’ve had this problem few weeks ago here is some cutted src from my old tests - as far as i remember .getDocument() was working fine.

public TaminoResult resultFromTamino (String host, String query)
{
TaminoResult tr=null;
try {
TaminoClient tamino = new TaminoClient(host);
tamino.setPageSize(5);
tr = tamino.query(query);
return tr;


}


org.w3c.dom.Document dataInDocument=(org.w3c.dom.Document) tamino.resultFromTamino(“http://localhost/tamino/Test/Sailing/yacht","yacht”).getDocument();

Terry,

I think your problem is a result of Tamino returning a DOM1 document, and JAXP expecting a DOM2 document. When the DOMEcho class processes the returned DOM1 document and attempts to execute the root node’s “getNamespaceURI()” method, this fails at run time.

I have attached a modified version of DOMEcho that works, because I have removed all DOM2-specific operations. The classpath I used to compile and execute this was:

Classpath=jaxp.jar;crimson.jar;taminoclient.jar;domsdk.jar;xp.jar;.

Hope this helps.
Bill.
DOMEcho.zip (4.09 KB)