Hi, I want to build xml by replacing existing XML text elements with some other text. I built the Document with SAXBuilder and put the root element in the context. My template is like this :
#set ($rootelem = $root.getRootElement()) $rootelem #foreach($elem in $rootelem.getChildren()) #set ($newelem = $elem) #if ($elem.getName().equalsIgnoreCase("serviceInstanceId")) got it $newelem.getText() $newelem.setText("OTHERTEXT") $newelem #end #end When I merge with the template, I get the text of the existing node correctly( $newelem.getText()) After setText when I print the $newelem I expect the new text (OTHERTEXT) in the element. But I get the empty element. I never see new text element in the element. Any help is appreciated. -- Thanks & Regards, Anagha