org.riotfamily.common.markup
Class DocumentWriter

java.lang.Object
  extended by org.riotfamily.common.markup.DocumentWriter

public class DocumentWriter
extends Object

Utility class to generate markup code. This example ...

  DocumentWriter doc = new DocumentWriter(writer);
  doc.start("body");
  doc.start("p").attribute("class", "foo");
  doc.body("Hello ");
  doc.start("strong").body("World");
  doc.closeAll();
 
... will produce the following code:
 <body><p class="foo">Hello <strong>World</strong></p></body>
 


Constructor Summary
DocumentWriter(PrintWriter writer)
           
DocumentWriter(PrintWriter writer, boolean xhtml)
           
 
Method Summary
 DocumentWriter attribute(String name)
           
 DocumentWriter attribute(String name, boolean present)
           
 DocumentWriter attribute(String name, int value)
           
 DocumentWriter attribute(String name, String value)
           
 DocumentWriter attribute(String name, String value, boolean renderEmpty)
           
 DocumentWriter body()
           
 DocumentWriter body(String body)
           
 DocumentWriter body(String body, boolean escapeHtml)
           
 void closeAll()
           
 DocumentWriter end()
           
 DocumentWriter println(String s)
           
 DocumentWriter start(String tagName)
           
 DocumentWriter start(String tagName, boolean empty)
           
 DocumentWriter startEmpty(String tagName)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DocumentWriter

public DocumentWriter(PrintWriter writer)

DocumentWriter

public DocumentWriter(PrintWriter writer,
                      boolean xhtml)
Method Detail

start

public DocumentWriter start(String tagName)

startEmpty

public DocumentWriter startEmpty(String tagName)

start

public DocumentWriter start(String tagName,
                            boolean empty)

attribute

public DocumentWriter attribute(String name)

attribute

public DocumentWriter attribute(String name,
                                int value)

attribute

public DocumentWriter attribute(String name,
                                boolean present)

attribute

public DocumentWriter attribute(String name,
                                String value)

attribute

public DocumentWriter attribute(String name,
                                String value,
                                boolean renderEmpty)

body

public DocumentWriter body()

body

public DocumentWriter body(String body)

body

public DocumentWriter body(String body,
                           boolean escapeHtml)

println

public DocumentWriter println(String s)

end

public DocumentWriter end()

closeAll

public void closeAll()