|
code.google.com home | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.owasp.html.HtmlStreamRenderer
@NotThreadSafe public class HtmlStreamRenderer
Given a series of HTML tokens, writes valid, normalized HTML to the output.
The output will have well-defined tag boundaries, but there may be orphaned
or missing close and open tags.
The result of two renderers can always be concatenated to produce a larger
snippet of HTML, but if the first was called with
writeOpenTag("plaintext", ...)
, then any tags in the second will not
be interpreted as tags in the concatenated version.
Method Summary | |
---|---|
void |
closeDocument()
|
void |
closeTag(java.lang.String elementName)
|
static HtmlStreamRenderer |
create(java.lang.Appendable output,
Handler<? super java.io.IOException> ioExHandler,
Handler<? super java.lang.String> badHtmlHandler)
Factory. |
static HtmlStreamRenderer |
create(java.lang.StringBuilder output,
Handler<? super java.lang.String> badHtmlHandler)
Factory. |
boolean |
isDocumentOpen()
|
void |
openDocument()
|
void |
openTag(java.lang.String elementName,
java.util.List<java.lang.String> attrs)
|
void |
text(java.lang.String text)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public static HtmlStreamRenderer create(@WillCloseWhenClosed java.lang.Appendable output, Handler<? super java.io.IOException> ioExHandler, Handler<? super java.lang.String> badHtmlHandler)
output
- the buffer to which HTML is streamed.ioExHandler
- called with any exception raised by output.badHtmlHandler
- receives alerts when HTML cannot be rendered because
there is not valid HTML tree that results from that series of calls.
E.g. it is not possible to create an HTML <style>
element whose
textual content is "</style>"
.public static HtmlStreamRenderer create(java.lang.StringBuilder output, Handler<? super java.lang.String> badHtmlHandler)
output
- the buffer to which HTML is streamed.badHtmlHandler
- receives alerts when HTML cannot be rendered because
there is not valid HTML tree that results from that series of calls.
E.g. it is not possible to create an HTML <style>
element whose
textual content is "</style>"
.public final void openDocument() throws java.lang.IllegalStateException
openDocument
in interface HtmlStreamEventReceiver
java.lang.IllegalStateException
public final void closeDocument() throws java.lang.IllegalStateException
closeDocument
in interface HtmlStreamEventReceiver
java.lang.IllegalStateException
public final boolean isDocumentOpen()
public final void openTag(java.lang.String elementName, java.util.List<java.lang.String> attrs)
openTag
in interface HtmlStreamEventReceiver
attrs
- alternating attribute names and values.public final void closeTag(java.lang.String elementName)
closeTag
in interface HtmlStreamEventReceiver
public final void text(java.lang.String text)
text
in interface HtmlStreamEventReceiver
|
code.google.com home | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |