Groovy web console

subscribe to the feed Subscribe
to this
site
xml parseing (via #groovywebconsole)
tweet this snippet Tweet
this
script

xml parseing

Published 2 months ago by nmrao with tags xml
Actions  ➤ Edit in console Back to console Show/hide line numbers View recent scripts
def xml = """
<ServerList>   <Server name="testserver1">       <CleanUP>         <GZIP>           <File KeepDays="30">/app/test1/log</File>         </GZIP>       </CleanUP>     </Server>     <Server name="testserver2">     <CleanUP>       <GZIP>         <File KeepDays="30">/app/test2/log</File>       </GZIP>     </CleanUP>   </Server> </ServerList>"""
def server = 'testserver1'
def pXml = new XmlSlurper().parseText(xml)
println pXml.'**'.find{ it.@name == server}.CleanUP.GZIP.File