Last active
December 30, 2015 20:59
-
-
Save yanhua365/7884885 to your computer and use it in GitHub Desktop.
找出一个XML文件下的info元素的param属性,并解码base64重新保存到另外一个文件中
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* 找出一个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