Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/xml/12.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/perl/11.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Groovy如何将XmlParser更改为xml格式?_Xml_Parsing_Groovy - Fatal编程技术网

Groovy如何将XmlParser更改为xml格式?

Groovy如何将XmlParser更改为xml格式?,xml,parsing,groovy,Xml,Parsing,Groovy,嗨, 我已经使用XmlParser来更改xml文件中某些节点的属性 一些代码: def temp = groovyUtils.getXmlHolder( "testAddress CUY#ResponseAsXML") def aux = temp.getXml(); def lang = new XmlParser().parseText(aux) lang.prov[0].description[0].setValue('newDesciption') 这样做之后,我就有了 " root

嗨, 我已经使用XmlParser来更改xml文件中某些节点的属性

一些代码:

def temp = groovyUtils.getXmlHolder( "testAddress CUY#ResponseAsXML") 
def aux = temp.getXml();
def lang = new XmlParser().parseText(aux)
lang.prov[0].description[0].setValue('newDesciption')
这样做之后,我就有了

" root[attributes={}; value=[a[attributes={}; value=[1]], b[attributes={}; value=[ ]], c[attributes={}; value=[2]]]]" 
如何使它再次成为xml?
谢谢

请修改问题的布局。
def out = new StringWriter()
new XmlNodePrinter(new PrintWriter(out)).print(lang)
def xml = out.toString()