Groovy对xml的操作
Groovy对xml的操作 文中主要举两个例子: 查找一个xml文件的标签值 生成一个xml文件 示例xml: def s = "" " < ! -- Copyright w3school . com . cn -- > < root > < note > < to > George < / to > < from > John < / from > < heading > Reminder < / heading > < body > Don't forget the meeting ! < / body > < / note > < note > < to > George2 < / to > < from > John2 < / from > < heading > Reminder2 < / heading > < body > Don't forget the meeting2 ! < / body > < / note > < / root > "" " 查找一个xml文件的标签值 文中的例子可以查找到from标签值为John所在的note标签的to标签值是多少 def xml = new XmlSlurper ( ) . parseText ( s ) def list = xml . depthFirst ( ) . findAll { note - >