public class HTMLWriter extends XMLWriter
HTMLWriter
takes a DOM4J tree and formats it to a
stream as HTML.
This formatter is similar to XMLWriter but outputs the text of CDATA
and Entity sections rather than the serialised format as in XML and
also supports certain element which have no corresponding close tag such
as for <BR> and <P>.
Modifier and Type | Field and Description |
---|---|
protected static OutputFormat |
defaultHtmlFormat |
private Set |
omitElementCloseSet
Used to store the qualified element names which
should have no close element tag
|
DEFAULT_FORMAT, lastOutputNodeType, LEXICAL_HANDLER_NAMES, writer
Constructor and Description |
---|
HTMLWriter() |
HTMLWriter(OutputFormat format) |
HTMLWriter(OutputStream out) |
HTMLWriter(OutputStream out,
OutputFormat format) |
HTMLWriter(Writer writer) |
HTMLWriter(Writer writer,
OutputFormat format) |
Modifier and Type | Method and Description |
---|---|
void |
endCDATA()
Report the end of a CDATA section.
|
protected Set |
getOmitElementCloseSet() |
protected String |
getPadText() |
protected boolean |
isExpandEmptyElements() |
protected void |
loadOmitElementCloseSet(Set set) |
protected boolean |
omitElementClose(String qualifiedName) |
void |
startCDATA()
Report the start of a CDATA section.
|
protected void |
writeCDATA(String text) |
protected void |
writeClose(String qualifiedName)
Overriden method to not close certain element names to avoid
wierd behaviour from browsers for versions up to 5.x
|
protected void |
writeDeclaration()
This will write the declaration to the given Writer.
|
protected void |
writeEmptyElementClose(String qualifiedName) |
protected void |
writeEntity(Entity entity) |
characters, close, comment, createWriter, endDocument, endDTD, endElement, endEntity, endPrefixMapping, escapeAttributeEntities, escapeElementEntities, flush, getLexicalHandler, getProperty, handleException, ignorableWhitespace, indent, installLexicalHandler, isNamespaceDeclaration, notationDecl, parse, println, processingInstruction, setDocumentLocator, setIndentLevel, setLexicalHandler, setOutputStream, setProperty, setWriter, startDocument, startDTD, startElement, startEntity, startPrefixMapping, unparsedEntityDecl, write, write, write, write, write, write, write, write, write, write, write, write, write, writeAttribute, writeAttribute, writeAttributes, writeAttributes, writeClose, writeComment, writeDocType, writeDocType, writeElement, writeElementContent, writeEntityRef, writeEscapeAttributeEntities, writeNamespace, writeNode, writeOpen, writePrintln, writeProcessingInstruction, writeString
error, fatalError, getContentHandler, getDTDHandler, getEntityResolver, getErrorHandler, getFeature, getParent, parse, resolveEntity, setContentHandler, setDTDHandler, setEntityResolver, setErrorHandler, setFeature, setParent, skippedEntity, warning
protected static final OutputFormat defaultHtmlFormat
private Set omitElementCloseSet
public HTMLWriter(Writer writer)
public HTMLWriter(Writer writer, OutputFormat format)
public HTMLWriter() throws UnsupportedEncodingException
UnsupportedEncodingException
public HTMLWriter(OutputFormat format) throws UnsupportedEncodingException
UnsupportedEncodingException
public HTMLWriter(OutputStream out) throws UnsupportedEncodingException
UnsupportedEncodingException
public HTMLWriter(OutputStream out, OutputFormat format) throws UnsupportedEncodingException
UnsupportedEncodingException
public void startCDATA() throws SAXException
LexicalHandler
The contents of the CDATA section will be reported through
the regular characters
event; this event is intended only to report
the boundary.
startCDATA
in interface LexicalHandler
startCDATA
in class XMLWriter
SAXException
- The application may raise an exception.LexicalHandler.endCDATA()
public void endCDATA() throws SAXException
LexicalHandler
endCDATA
in interface LexicalHandler
endCDATA
in class XMLWriter
SAXException
- The application may raise an exception.LexicalHandler.startCDATA()
protected void writeCDATA(String text) throws IOException
writeCDATA
in class XMLWriter
IOException
protected void writeEntity(Entity entity) throws IOException
writeEntity
in class XMLWriter
IOException
protected void writeDeclaration() throws IOException
XMLWriter
This will write the declaration to the given Writer. Assumes XML version 1.0 since we don't directly know.
writeDeclaration
in class XMLWriter
IOException
protected void writeClose(String qualifiedName) throws IOException
writeClose
in class XMLWriter
IOException
protected void writeEmptyElementClose(String qualifiedName) throws IOException
writeEmptyElementClose
in class XMLWriter
IOException
protected boolean omitElementClose(String qualifiedName)
protected Set getOmitElementCloseSet()
protected void loadOmitElementCloseSet(Set set)
protected String getPadText()
getPadText
in class XMLWriter
protected boolean isExpandEmptyElements()
isExpandEmptyElements
in class XMLWriter
WebARTS Library Licensed Under the GNU - General Public License. Other Libraries licensed under their respective Open Source Licenses