Forum Discussion
pflaumengeist
13 years agoContributor
You could look at the MarkUpBuilder (see here See Example 8:)
Example
will get you this
Example
def sw = new StringWriter()
def xml = new groovy.xml.MarkupBuilder(sw)
xml.'soapenv:Envelope'( 'xmlns:soapenv' : "http://schemas.xmlsoap.org/soap/envelope/", 'xmlns:par' : "") {
'soapenv:Header' {}
'soapenv:Body' {
'par:""' {
'settings' {
'label1' {
'entry' {
'key' 'hiho'
'value' {}
}
}
'label2' {}
'label3' {
'value1' {}
'value2' {}
'value3' {}
}
}
}
}
}
log.info sw
will get you this
<soapenv:Envelope xmlns:soapenv='http://schemas.xmlsoap.org/soap/envelope/' xmlns:par=''>
<soapenv:Header />
<soapenv:Body>
<par:"">
<settings>
<label1>
<entry>
<key>hiho</key>
<value />
</entry>
</label1>
<label2 />
<label3>
<value1 />
<value2 />
<value3 />
</label3>
</settings>
</par:"">
</soapenv:Body>
</soapenv:Envelope>