MarkupBuilder.See: Description
| Interface | Description |
|---|---|
| Indenter |
A strategy to indent or in other words pretty print
the markup.
|
| MarkupBuilderWriter |
The methods in this class will be merged with
MarkupWriter in 0.3.0. |
| MarkupWriter |
Wrap builders for deferred writing.
|
| Class | Description |
|---|---|
| Html |
Most of the XHTML tags and attributes are available as methods.
|
| HtmlBuilder<T> |
Most of the XHTML tags and attributes are available as methods.
|
| HtmlWriter |
Writes HTML using an
HtmlBuilder
by calling HtmlWriter.write(Writer). |
| MarkupBuilder<T> |
Fluent styled
markup builder that writes to a
Writer. |
| MarkupUtils |
XML Utils.
|
| SimpleIndenter |
A simple indenter that takes a String for
before and after on the opening and closing tag.
|
| Enum | Description |
|---|---|
| Indenter.TagIndentSpot |
Indicates the current position (cursor) of where whitespace is to be applied.
|
| MarkupBuilder.TagClosingPolicy |
Policy for how tags should be closed.
|
MarkupBuilder.
Example
StringWriter sw = new StringWriter();
new Html(sw) {{
div().title("first");
span().id("hello").end();
div().title("second");
text("Second");
start("custom1").attr("data", "value").end();
start("custom2").text("hello").end();
end();
end();
}};
String result = sw.getBuffer().toString();
String expected = "\n" +
"<div title=\"first\">\n" +
" <span id=\"hello\"/>\n" +
" <div title=\"second\">Second\n" +
" <custom1 data=\"value\"/>\n" +
" <custom2>hello\n" +
" </custom2>\n" +
" </div>\n" +
"</div>";
assertEquals(expected, result);
See MarkupBuilder for creating your own markup builders.
Copyright © 2010–2025 JATL. All rights reserved.