I want to update an element,not a document.
for example:
kreven 28888888 david 55555555 smith 88888888I will update [@ino:id=2]:
robort 33333333How can use the update()?
this is tamino example:
public void performUpdate(TQuery query, String updatedText) throws
TException {
TLocalTransaction localTransaction = null;
// Perform query and update operations within a transaction
try {
// Switch to local transaction mode
localTransaction = connection.useLocalTransactionMode();
// Invoke the query to obtain the document and to lock it
TResponse response = accessor.query(query);
// Obtain the TXMLObject from the response
TXMLObject xmlObject = response.getFirstXMLObject();
if (xmlObject == null)
return;
// Obtain the JDOM element and update its content
Element element = (Element) xmlObject.getElement();
element.setText(updatedText);
// Invoke the update
response = accessor.update(xmlObject);
// System.out.println(“Update succeeded!”);
// Commit the transaction
localTransaction.commit();
}
// TQueryException and TUpdateException are both derived from TAccessorException
// so we simply use the base class here
catch (TAccessorException accessorException) {
showAccessFailure(accessorException);
localTransaction.rollback();
throw accessorException;
}
finally {
connection.close();
}
}
//-----------------------------------------------
It can only get first element and update the value.I will update the element which I need.
please help me.
thanks