Skip to content

Instantly share code, notes, and snippets.

@miceno
Created January 28, 2011 16:53
Show Gist options
  • Select an option

  • Save miceno/800543 to your computer and use it in GitHub Desktop.

Select an option

Save miceno/800543 to your computer and use it in GitHub Desktop.
HTML Markup builder example
// def writer = new FileWriter('markup.html')
def writer = new StringWriter()
def html = new groovy.xml.MarkupBuilder(writer)
html.html {
head { title 'Constructed by MarkupBuilder' }
body {
h1 'What can I do with MarkupBuilder?'
form (action:'whatever') {
for (line in ['Produce HTML','Produce XML','Have some fun'])
{
input(type:'checkbox',checked:'checked', id:line, '')
label(for:line, line)
br('')
}
}
}
}
print writer.toString()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment