Created
April 20, 2018 06:39
-
-
Save ppazos/1acf4cf9c2598ff8a55297ee7b5a09df to your computer and use it in GitHub Desktop.
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
import groovy.util.XmlSlurper | |
def xml = new XmlSlurper().parseText(''' | |
<issues> | |
<issue> | |
<id>1</id> | |
<priority>1</priority> | |
</issue> | |
<issue> | |
<id>2</id> | |
<priority>2</priority> | |
</issue> | |
</issues> | |
''') | |
def p = '1' | |
def priorityIssue = xml.'**'.find { issue -> | |
issue.priority.text() == p | |
} | |
xml.issue[0].replaceNode { node -> | |
mkp.yield(node) | |
hermano('lamano') | |
} | |
println xml.children()*.name() | |
println xml.find { it.name() == 'hermano' } | |
groovy.xml.XmlUtil.serialize( xml ) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment