how to use TXMLObject.newInstance( org.w3c.dom.element )

I’m trying out the new API and running now into trouble when constructing a TXMLObject with an org.w3c.dom.Element and then trying to execute the insert-method of the TXMLObjectAccessor. Doing this, literally nothing happens. The object will not be inserted, no exception is thrown. The program just hangs for some seconds.
When I construct the TXMLObject using a the readFrom-method everything goes fine.
Below the two samples I made. Sample A) works, sample B) does not. Can anyone tell me what I’m doing wrong, or send me a working sample code.

Environment:
- JDK1.3.1
Loaded libraries:
- xerces.jar (shipped with Tamino3.1.1)
- jdom.jar (shipped with Tamino3.1.1)
- jdbc2_0-stdext.jar (shipped with Tamino3.1.1)
- jta-spec1_0_1.jar (shipped with Tamino3.1.1)
- log4j-core.jar (shipped with Tamino3.1.1)
- TaminoAPI4J.jar (shipped with Tamino3.1.1)
- domsdk.jar (119770 bytes 17/03/00)
- aelfred.jar (23358 bytes 02/07/98)
- xp.jar (166356 bytes 02/01/99)
- xt.jar (352905 bytes 05/11/99)
Classpath:
like listed above.


private void processXML () throws Exception {

String DATABASE_URI = “http://myhost/tamino/mydb”;

//*** contructing a simple xml
//*** (DomTest )

com.docuverse.dom.BasicDocument mydoc = new BasicDocument();
com.docuverse.dom.BasicElement mydocelem = new BasicElement( mydoc, “myDocElement” );
mydoc.appendChild( mydocelem );
com.docuverse.dom.BasicElement mychildelem = new BasicElement( mydoc, “myChildElement” );
mychildelem.appendChild( new BasicText( mydoc, “DomTest” ) );
mydocelem.appendChild( mychildelem );

//*** getting a string representation of the xml
String mydocelemstr = mydocelem.toString();

//*** Establish the Tamino connection
TConnectionFactory myfactory = TConnectionFactory.getInstance();
TConnection TamConn = myfactory.newConnection( DATABASE_URI );

//*** SAMPLE A
StringReader sr = new StringReader( mydocelemstr );
TXMLObject xmlObject_OK = TXMLObject.newInstance( TDOMObjectModel.getInstance() );
xmlObject_OK.readFrom( sr );

TXMLObjectAccessor xmlObjectAccessor = TamConn.newXMLObjectAccessor(
TAccessLocation.newInstance( “ino:etc” ),
TDOMObjectModel.getInstance() );

TResponse response = xmlObjectAccessor.insert ( xmlObject_OK ) ;

TamConn.close();
//*** SAMPLE A


//*** SAMPLE B
TXMLObject xmlObject_BAD = TXMLObject.newInstance( mydocelem );


TXMLObjectAccessor xmlObjectAccessor = TamConn.newXMLObjectAccessor(
TAccessLocation.newInstance( “ino:etc” ),
TDOMObjectModel.getInstance() );

TResponse response = xmlObjectAccessor.insert ( xmlObject_BAD ) ;

TamConn.close();
//*** SAMPLE B

}

I got a different result when I tried this. Sample A works, and sample B fails with an exception from the insert:

java.lang.AbstractMethodError
at com.softwareag.tamino.db.api.objectModel.dom.TDOMAdapter.setId(TDOMAdapter.java:95)
at com.softwareag.tamino.db.api.accessor.TStreamAccessorImpl.insert(TStreamAccessorImpl.java:85)
at com.softwareag.tamino.db.api.accessor.TXMLObjectAccessorImpl.insert(TXMLObjectAccessorImpl.java:77)
at Test.processXML(Test.java:68)
at Test.main(Test.java:17)

In both cases I printed the object going into the insert() method and they are both com.softwareag.tamino.db.api.objectModel.dom.TDOMAdapter so I cannot understand the above exception.


However my classpath has slightly different .jar files :

taminoapi4j.jar - from Tamino 3114, size 305016 bytes
jdom.jar - 78541 bytes
log4j-core.jar - 66624 bytes
xerces.jar - 904030 bytes
domsdk.jar - 120293 bytes

Here the solution I found. It seems that the package com.docuverse.dom in the version I have doesn’t implement correctly the org.w3c.dom - classes.

private void processXML () throws Exception {

String DATABASE_URI = “http://myhost/tamino/mydb”;


//*** getting a DocumentBuilderFactory - instance
//*** getting a DocumentBuilder
javax.xml.parsers.DocumentBuilderFactory myDocFactory = javax.xml.parsers.DocumentBuilderFactory.newInstance();
DocumentBuilder myDocBuilder = myDocBuilder = myDocFactory.newDocumentBuilder();

//*** contructing a simple xml
//*** (DomTest )
org.w3c.dom.Document mydoc = myDocBuilder.newDocument();
org.w3c.dom.Element mydocelem = mydoc.createElement(“myDocElement”);
mydoc.appendChild(mydocelem);
org.w3c.dom.Element mychildelem = mydoc.createElement(“myChildElement”);
mydocelem.appendChild(mychildelem);
mychildelem.appendChild(mydoc.createTextNode(“DomTest”));


//*** Establish the Tamino connection
TConnectionFactory myfactory = TConnectionFactory.getInstance();
TConnection TamConn = myfactory.newConnection( DATABASE_URI );

//*** SAMPLE C
TXMLObject xmlObject_OK = TXMLObject.newInstance( mydoc );

TXMLObjectAccessor xmlObjectAccessor = TamConn.newXMLObjectAccessor(
TAccessLocation.newInstance( “ino:etc” ),
TDOMObjectModel.getInstance() );

TResponse response = xmlObjectAccessor.insert ( xmlObject_OK ) ;

TamConn.close();
//*** SAMPLE C

}