Assuming you are using DOM (as opposed to JDOM, and the choice is entirely up to you), here is an example of how you might add your new Element:
TXMLObject xmlObject = response.getFirstXMLObject();
// Get top-level Tax element
Element root = (Element) xmlObject.getElement();
//Build the new child Element and give it Text content
Document doc = root.getOwnerDocument();
Element newDetail = doc.createElement("Paydtl_line");
Text textValue = doc.createTextNode("qqqq");
newDetail.appendChild( textValue);
// Manipulate the DOM to add our new child in the correct place
// Principle - get the last "Pay_dtl" node;
// get the following "Bond_line" if there is one (optional Node in Schema)
// insertBefore() the Bond_line or appendChild() if there are no Bond_lines.
NodeList payDetails = root.getElementsByTagName("Paydtl_line");
Node lastDetail = payDetails.item(payDetails.getLength()-1);
Node firstBond = lastDetail.getNextSibling();
if (firstBond != null)
root.insertBefore(newDetail,firstBond);
else
root.appendChild(newDetail);
// Update the existing Tax instance in Tamino
response = accessor.update(xmlObject);
System.out.println("Response to update: " + response.getReturnValue());
It’s not pretty and there are probably other ways to achieve this, but it should get you started.
#API-Management#webMethods-Tamino-XML-Server-APIs#webMethods