Skip to content

Instantly share code, notes, and snippets.

@yanhua365
Last active December 30, 2015 20:59
Show Gist options
  • Save yanhua365/7884885 to your computer and use it in GitHub Desktop.
Save yanhua365/7884885 to your computer and use it in GitHub Desktop.
找出一个XML文件下的info元素的param属性,并解码base64重新保存到另外一个文件中
/**
* 找出一个XML文件下的info元素的param属性,并解码base64重新保存到另外一个文件中
*/
def root = new XmlParser().parse(new File("a.xml"))
root.actions.action.infos.info.each{
if(it.'@param'){
it.'@param' = new String(it.'@param'.decodeBase64())
}
}
new XmlNodePrinter(new PrintWriter(new FileWriter(new File("b.xml")))).print(root)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment