I have the following Groovy code but it wont work:
xml = new groovy.xml.MarkupBuilder()
xmldata = xml.Plugins(nextid: '10') {
Target(name: 'default.auth') {
Port(protocol: 'https') {
8080
}
}
}
println xmldata
I want it to result in:
<Plugins nextid='10'>
<Target name='default.auth'>
<Port protocol='https'>8080</Port>
</Target>
</Plugins>
What I am actually getting is this:
<Plugins nextid='10'>
<Target name='default.auth'>
<Port protocol='https' />
</Target>
</Plugins>
Can anyone provide some insight on this?
You need to use
mkp.yieldto make it output the8080value to the xml, like so: