}
else
return;
}
ExternalTransaction tx = db.newTransaction();
tx.begin();
try {
long start;
if (newDoc) {
start = System.currentTimeMillis();
container = XMLContainer.newContainer( db, filename );
System.out.println( "DOM store: new container time: " + (System.currentTimeMillis() - start) + " ms" );
}
start = System.currentTimeMillis();
DocumentBuilder documentBuilder = builderFactory.newDocumentBuilder();
Document doc = documentBuilder.parse( filename );
// printNodeTree (doc, new StringBuffer (" "));
System.out.println( "DOM store: parse time: " + (System.currentTimeMillis() - start) + " ms" );
start = System.currentTimeMillis();
if (newDoc)
container.storeDOM( doc );
else
container.storeDOM( null, doc );
System.out.println( "DOM store: store time: " + (System.currentTimeMillis() - start) + " ms" );
start = System.currentTimeMillis();
tx.commit();
System.out.println( "DOM store: commit time: " + (System.currentTimeMillis() - start) + " ms" );
} catch (Exception e) {
tx.rollback();
throw e;
}
}