Groovy markupbuilder tags
Posted
by john renfrew
on Stack Overflow
See other posts from Stack Overflow
or by john renfrew
Published on 2010-06-18T12:39:51Z
Indexed on
2010/06/18
12:43 UTC
Read the original article
Hit count: 353
Is there a way to modify the code from a previous answer
import groovy.xml.MarkupBuilder
def writer = new StringWriter()
def builder = new MarkupBuilder(writer)
def awaiting = ['one', 'two', 'three']
builder.html {
ul {
awaiting.each {
li(it.toString())
}
}
}
println writer.toString()
so that if you add a tag instead that you send it - like
builder.html{
tag{
awaiting.each{}
}
} return result
could be 'ol' or 'ul' for example
© Stack Overflow or respective owner