@NotThreadSafe public class HtmlStreamRenderer extends Object implements HtmlStreamEventReceiver
writeOpenTag("plaintext", ...), then any tags in the second will not
be interpreted as tags in the concatenated version.| Modifier and Type | Method and Description |
|---|---|
void |
closeDocument()
Called first to indicate that no more events will be received.
|
void |
closeTag(String elementName)
Called to specify an end tag like
</elementName>. |
static HtmlStreamRenderer |
create(Appendable output,
Handler<? super IOException> ioExHandler,
Handler<? super String> badHtmlHandler)
Factory.
|
static HtmlStreamRenderer |
create(StringBuilder output,
Handler<? super String> badHtmlHandler)
Factory.
|
boolean |
isDocumentOpen()
True if
openDocument() has been called and
closeDocument() has not subsequently been called. |
void |
openDocument()
Called first to indicate that events follow.
|
void |
openTag(String elementName,
List<String> attrs)
Called to specify a tag with the given name and attributes.
|
void |
text(String text)
Called to specify a text node.
|
public static HtmlStreamRenderer create(@WillCloseWhenClosed Appendable output, Handler<? super IOException> ioExHandler, Handler<? super 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(StringBuilder output, Handler<? super 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 IllegalStateException
HtmlStreamEventReceiveropenDocument in interface HtmlStreamEventReceiverIllegalStateExceptionpublic final void closeDocument()
throws IllegalStateException
HtmlStreamEventReceivercloseDocument in interface HtmlStreamEventReceiverIllegalStateExceptionpublic final boolean isDocumentOpen()
openDocument() has been called and
closeDocument() has not subsequently been called.public final void openTag(String elementName, List<String> attrs)
HtmlStreamEventReceiveropenTag in interface HtmlStreamEventReceiverattrs - alternating attribute names and values.public final void closeTag(String elementName)
HtmlStreamEventReceiver</elementName>.closeTag in interface HtmlStreamEventReceiverpublic final void text(String text)
HtmlStreamEventReceivertext in interface HtmlStreamEventReceiverCopyright © 2018 OWASP. All rights reserved.