开发者

Groovy How can change an XmlParser to an xml format?

HI, I've used XmlParser to can change the attributes of some nodes in my xml f开发者_如何学Goile.

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!


def out = new StringWriter()
new XmlNodePrinter(new PrintWriter(out)).print(lang)
def xml = out.toString()
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜