views:

37

answers:

1

HI, I've used XmlParser to can change the attributes of some nodes in my xml file.

Some code:

def temp = groovyUtils.getXmlHolder( "testAddress CUY#ResponseAsXML") 
def aux = temp.getXml();
def lang = new XmlParser().parseText(aux)
lang.prov[0].description[0].setValue('newDesciption')

After doing that I have something like

" root[attributes={}; value=[a[attributes={}; value=[1]], b[attributes={}; value=[ ]], c[attributes={}; value=[2]]]]" 

How can I make it again to be an xml? Thanks!

+1  A: 
def out = new StringWriter()
new XmlNodePrinter(new PrintWriter(out)).print(lang)
def xml = out.toString()
ataylor
thanks; that worked
Paul