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
}