org.riotfamily.common.markup
Class TagWriter
java.lang.Object
org.riotfamily.common.markup.TagWriter
public class TagWriter
- extends Object
Utility class to generate markup code. This example ...
TagWriter tag = new TagWriter(writer);
tag.start("div").attribute("id", "foo")
.body("Hello ")
.start("strong").body("World")
.closeAll();
... will produce the following code:
<div id="foo">Hello <strong>World</strong></div>
Note that calling start()
on an already opened tag will return
a new TagWriter. To create complex nested structures you should better use
a DocumentWriter
instead.
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
TagWriter
public TagWriter(PrintWriter writer)
setXhtml
public void setXhtml(boolean xhtml)
start
public TagWriter start(String tagName)
startEmpty
public TagWriter startEmpty(String tagName)
start
public TagWriter start(String tagName,
boolean empty)
attribute
public TagWriter attribute(String name)
attribute
public TagWriter attribute(String name,
int value)
attribute
public TagWriter attribute(String name,
boolean present)
attribute
public TagWriter attribute(String name,
String value)
attribute
public TagWriter attribute(String name,
String value,
boolean renderEmpty)
body
public TagWriter body()
body
public TagWriter body(String body)
body
public TagWriter body(String body,
boolean escapeHtml)
cData
public TagWriter cData()
closeCData
public TagWriter closeCData()
print
public TagWriter print(String s)
println
public TagWriter println(String s)
println
public TagWriter println()
end
public TagWriter end()
closeAll
public void closeAll()