Created
April 8, 2017 16:10
-
-
Save ivanoronee/ec2490de1f4158d1d1bd8c77151f871d to your computer and use it in GitHub Desktop.
This file contains 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.xml.* | |
def collection = [ | |
[ key:'tim', value:null ], | |
[ key:'brenda', value:32 ] | |
] | |
def process = { binding, element -> | |
binding."${element.key}"( element.value ) | |
} | |
println XmlUtil.serialize( new StreamingMarkupBuilder().with { builder -> | |
builder.bind { binding -> | |
data { | |
collection.each { e -> | |
process( binding, e ) | |
} | |
} | |
} | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment