Created
January 28, 2011 16:53
-
-
Save miceno/800543 to your computer and use it in GitHub Desktop.
HTML Markup builder example
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // 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