import groovy.xml.StreamingMarkupBuilder
Map props = [addressid:'1', line1:'line-1_VALUE', line2:'line-2_VALUE']
def builder = new StreamingMarkupBuilder()
def address = {
"address"(id: props.addressid) {
"line-1"(props.line1)
"line-2"(props.line2)
"city"("city_VALUE") // typing wimped out...
"state"("State_VALUE")
"postal-code"("postal_VALUE")
}
}
println builder.bind(address).toString() // something XML-compatible <address id="1">
...</address>
No comments:
Post a Comment