UsingStreamingMarkupBuilder
Using the Streaming Markup Builder
The Streaming Markup Builder allows you to generate output that has "inline" elements. For example <p>The <b>brown</b> dog</p>. This is difficult in block level markup builders without embedding the tag in the string within the block.
The Streaming Builder allows to yield string to the enclosing builder. I'm not sure how you avoid the magic of having to know the variable is mkp.
You can try this sample in the Groovy Console to see that it generates "Hello bold world".
import groovy.xml.StreamingMarkupBuilder def xml = new StreamingMarkupBuilder().bind() { html() { head() body() { p() { mkp.yield 'Hello ' b('bold') mkp.yield ' World' } } } }