Chapter 7
[ 153 ]
}
body {
h1 "Groovy Builders are cool!"
}
}
then:
xmlIsIdentical writer.toString(), "simple.html"
In the next example, we build a more complex HTML page containing nested tables.
MarkupBuilder will close all tags correctly so that they are well-formed. A classic
mistake when working with nested tag formats is to misplace or unbalance the
closing of tags. The HTML
tags are highly prone to error when hand-coded. Assume that we want to generate HTML to display the names of the various Groovy builder and ConcreteBuilder classes in a nested table. The HTML to produce this table would be something like the following:
|