public class HTMLWriter extends XMLWriter<EHTMLElement,EHTMLAttribute>
| Modifier and Type | Class and Description |
|---|---|
static class |
HTMLWriter.HTMLResolver
The resolver used for the
HTMLWriter. |
xmlResolver| Constructor and Description |
|---|
HTMLWriter(java.io.File file,
CSSManagerBase cssManager)
Creates a new writer for HTML documents.
|
HTMLWriter(java.io.OutputStream stream,
CSSManagerBase cssManager)
Creates a new writer for HTML documents.
|
HTMLWriter(java.io.PrintWriter writer,
CSSManagerBase cssManager)
Creates a new writer for HTML documents.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addAttribute(EHTMLAttribute attribute,
java.lang.Object value)
Adds an attribute to the currently open element but checks in addition if the
attribute may be added at all.
|
void |
addExternalJavaScript(java.lang.String scriptFilePath)
Inserts a script tag that loads JavaScript from a separate file.
|
void |
addNonBreakingSpace()
Inserts a non-breaking space.
|
void |
addRawNewLine()
Adds a line separator with closing and open tag (see
XMLWriter.addNewLine(). |
void |
addRawString(java.lang.String html)
Adds the given text unprocessed to the writer.
|
void |
addStdHeader()
This adds a default header for HTML files consisting of the XML header and a
DOCTYPE of the xhtml frameset DTD.
|
void |
addStdHeader(java.lang.String encoding)
This adds a default header for HTML files consisting of the XML header and a
DOCTYPE of the xhtml frameset DTD.
|
void |
insertEmptyElement(EHTMLElement element,
java.lang.Object... attributes)
Inserts an empty element but ensures that it is not closed using the
shorthand syntax (e.g.
|
addCDataSection, addClosedElement, addClosedTextElement, addComment, addExternalAttribute, addHeader, addHTML5Doctype, addNewLine, addPublicDocTypeDefintion, addText, close, closeElement, escape, flush, getCurrentElement, getWriter, openElement, openElement, setSuppressLineBreakspublic HTMLWriter(java.io.File file, CSSManagerBase cssManager) throws java.io.IOException
file - the file to write to.cssManager - the CSS manager used. If this is null, the class attributes may be
filled with simple strings.java.io.IOExceptionpublic HTMLWriter(java.io.OutputStream stream, CSSManagerBase cssManager)
stream - the stream to print to.cssManager - the CSS manager used. If this is null, the class attributes may be
filled with simple strings.public HTMLWriter(java.io.PrintWriter writer, CSSManagerBase cssManager)
writer - the writer to print to.public void addStdHeader(java.lang.String encoding)
XML version is set to "1.0", encoding provided by a parameter, and doc type definition to XHTML 1.0 Frameset.
public void addStdHeader()
XML version is set to "1.0", encoding to "UTF-8", and doc type definition to XHTML 1.0 Frameset.
public void addRawString(java.lang.String html)
addRawString in class XMLWriter<EHTMLElement,EHTMLAttribute>public void addRawNewLine()
XMLWriter.addNewLine().public void addExternalJavaScript(java.lang.String scriptFilePath)
public void insertEmptyElement(EHTMLElement element, java.lang.Object... attributes)
<div />).
This is useful since some browsers choke on some shorthand elements, e.g.
divs or JavaScript tags.#openElement(EHTMLElement, Object...)public void addNonBreakingSpace()
public void addAttribute(EHTMLAttribute attribute, java.lang.Object value)
addAttribute in class XMLWriter<EHTMLElement,EHTMLAttribute>attribute - the attribute to createvalue - its valueHTMLWriterException - if the attribute is not allowed for the current element.