public class HtmlWriter extends XmlWriter
maxIndent, out, quoteChar, trimStrings, uriResolver, useWhitespace
Constructor and Description |
---|
HtmlWriter(Writer out,
boolean useWhitespace,
int maxIndent,
boolean trimStrings,
char quoteChar,
UriResolver uriResolver)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
HtmlWriter |
append(char c) |
HtmlWriter |
append(int indent,
char c)
Writes an indent (if the
useWhitespace setting is enabled), followed by text. |
HtmlWriter |
append(int indent,
String text)
Writes an indent (if the
useWhitespace setting is enabled), followed by text. |
HtmlWriter |
append(Object text)
Writes the specified text to the writer.
|
HtmlWriter |
append(String text)
Writes the specified text to the writer.
|
HtmlWriter |
appendln(int indent,
String text)
Writes an indent (if the
useWhitespace setting is enabled), followed by text, followed by a newline
(if the useWhitespace setting is enabled). |
HtmlWriter |
appendln(String text)
Writes the specified text followed by a newline (if the
useWhitespace setting is enabled). |
HtmlWriter |
attr(String name,
Object value)
Shortcut for
attr( |
HtmlWriter |
attr(String name,
Object value,
boolean valNeedsEncoding)
Shortcut for
attr( |
HtmlWriter |
attr(String ns,
String name,
Object value)
Shortcut for
attr(ns, name, value, |
HtmlWriter |
attr(String ns,
String name,
Object value,
boolean valNeedsEncoding)
Writes an attribute to the output:
|
HtmlWriter |
attrUri(String name,
Object value)
Append an attribute with a URI value.
|
HtmlWriter |
cr(int depth)
Performs a carriage return.
|
HtmlWriter |
cre(int depth)
Performs a carriage return at the end of a line.
|
HtmlWriter |
eTag(int indent,
String name)
Shortcut for
i(indent).eTag( |
HtmlWriter |
eTag(int indent,
String ns,
String name)
Shortcut for
i(indent).eTag(ns, name, |
HtmlWriter |
eTag(int indent,
String ns,
String name,
boolean needsEncoding)
Shortcut for
i(indent).eTag(ns, name, needsEncoding); |
HtmlWriter |
eTag(String name)
Shortcut for
eTag( |
HtmlWriter |
eTag(String ns,
String name)
Shortcut for
eTag(ns, name, |
HtmlWriter |
eTag(String ns,
String name,
boolean needsEncoding)
Writes an end tag to the output:
|
HtmlWriter |
i(int indent)
Writes an indent to the writer if the
useWhitespace setting is enabled. |
HtmlWriter |
nl(int indent)
Writes a newline to the writer if the
useWhitespace setting is enabled. |
HtmlWriter |
oAttr(String ns,
String name)
Writes an open-ended attribute to the output:
|
HtmlWriter |
oTag(int indent,
String name)
Shortcut for
i(indent).oTag( |
HtmlWriter |
oTag(int indent,
String ns,
String name)
Shortcut for
i(indent).oTag(ns, name, |
HtmlWriter |
oTag(int indent,
String ns,
String name,
boolean needsEncoding)
Shortcut for
i(indent).oTag(ns, name, needsEncoding); |
HtmlWriter |
oTag(String name)
Shortcut for
oTag( |
HtmlWriter |
oTag(String ns,
String name)
Shortcut for
oTag(ns, name, |
HtmlWriter |
oTag(String ns,
String name,
boolean needsEncoding)
Writes an opening tag to the output:
|
HtmlWriter |
q()
Adds the quote character specified by the
quoteChar setting to the output. |
HtmlWriter |
s()
Adds a whitespace character to the output if the
useWhitespace setting is enabled. |
HtmlWriter |
sTag(int indent,
String name)
Shortcut for
i(indent).sTag( |
HtmlWriter |
sTag(int indent,
String ns,
String name)
Shortcut for
i(indent).sTag(ns, name, |
HtmlWriter |
sTag(int indent,
String ns,
String name,
boolean needsEncoding)
Shortcut for
i(indent).sTag(ns, name, needsEncoding); |
HtmlWriter |
sTag(String name)
Shortcut for
sTag( |
HtmlWriter |
sTag(String ns,
String name)
Shortcut for
sTag(ns, name, |
HtmlWriter |
sTag(String ns,
String name,
boolean needsEncoding)
Writes a start tag to the output:
|
HtmlWriter |
tag(int indent,
String name)
Shortcut for
i(indent).tag( |
HtmlWriter |
tag(int indent,
String ns,
String name)
Shortcut for
i(indent).tag(ns, name, |
HtmlWriter |
tag(int indent,
String ns,
String name,
boolean needsEncoding)
Shortcut for
i(indent).tag(ns, name, needsEncoding); |
HtmlWriter |
tag(String name)
Shortcut for
tag( |
HtmlWriter |
tag(String ns,
String name)
Shortcut for
tag(ns, name, |
HtmlWriter |
tag(String ns,
String name,
boolean needsEncoding)
Writes a closed tag to the output:
|
HtmlWriter |
text(Object o,
boolean preserveWhitespace)
Serializes and encodes the specified object as valid XML text.
|
attr, attrUri, attrUri, ceTag, cTag, ie, oAttr, text, textUri, toString
public HtmlWriter(Writer out, boolean useWhitespace, int maxIndent, boolean trimStrings, char quoteChar, UriResolver uriResolver)
out
- The writer being wrapped.useWhitespace
- If maxIndent
- The maximum indentation level.trimStrings
- If quoteChar
- The quote character to use (i.e. uriResolver
- The URI resolver for resolving URIs to absolute or root-relative form.public HtmlWriter attrUri(String name, Object value) throws IOException
name
- The attribute name.value
- The attribute value. Can be any object whose toString()
method returns a URI.IOException
- If a problem occurred.public HtmlWriter text(Object o, boolean preserveWhitespace) throws IOException
XmlWriter
text
in class XmlWriter
o
- The object being serialized.preserveWhitespace
- If XmlFormat.MIXED_PWS
or XmlFormat.TEXT_PWS
content.IOException
public HtmlWriter oTag(String ns, String name, boolean needsEncoding) throws IOException
XmlWriter
<ns:name
oTag
in class XmlWriter
ns
- The namespace. Can be name
- The element name.needsEncoding
- If IOException
- If a problem occurred.public HtmlWriter oTag(String ns, String name) throws IOException
XmlWriter
oTag(ns, name, false );
oTag
in class XmlWriter
ns
- The namespace. Can be name
- The element name.IOException
- If a problem occurred.public HtmlWriter oTag(String name) throws IOException
XmlWriter
oTag(null , name, false );
oTag
in class XmlWriter
name
- The element name.IOException
- If a problem occurred.public HtmlWriter oTag(int indent, String ns, String name, boolean needsEncoding) throws IOException
XmlWriter
i(indent).oTag(ns, name, needsEncoding);
oTag
in class XmlWriter
indent
- The number of prefix tabs to add.ns
- The namespace. Can be name
- The element name.needsEncoding
- If IOException
- If a problem occurred.public HtmlWriter oTag(int indent, String ns, String name) throws IOException
XmlWriter
i(indent).oTag(ns, name, false );
oTag
in class XmlWriter
indent
- The number of prefix tabs to add.ns
- The namespace. Can be name
- The element name.IOException
- If a problem occurred.public HtmlWriter oTag(int indent, String name) throws IOException
XmlWriter
i(indent).oTag(null , name, false );
oTag
in class XmlWriter
indent
- The number of prefix tabs to add.name
- The element name.IOException
- If a problem occurred.public HtmlWriter tag(String ns, String name, boolean needsEncoding) throws IOException
XmlWriter
<ns:name/>
tag
in class XmlWriter
ns
- The namespace. Can be name
- The element name.needsEncoding
- If IOException
- If a problem occurred.public HtmlWriter tag(String ns, String name) throws IOException
XmlWriter
tag(ns, name, false );
tag
in class XmlWriter
ns
- The namespace. Can be name
- The element name.IOException
- If a problem occurred.public HtmlWriter tag(String name) throws IOException
XmlWriter
tag(null , name, false );
tag
in class XmlWriter
name
- The element name.IOException
- If a problem occurred.public HtmlWriter tag(int indent, String name) throws IOException
XmlWriter
i(indent).tag(null , name, false );
tag
in class XmlWriter
indent
- The number of prefix tabs to add.name
- The element name.IOException
- If a problem occurred.public HtmlWriter tag(int indent, String ns, String name, boolean needsEncoding) throws IOException
XmlWriter
i(indent).tag(ns, name, needsEncoding);
tag
in class XmlWriter
indent
- The number of prefix tabs to add.ns
- The namespace. Can be name
- The element name.needsEncoding
- If IOException
- If a problem occurred.public HtmlWriter tag(int indent, String ns, String name) throws IOException
XmlWriter
i(indent).tag(ns, name, false );
tag
in class XmlWriter
indent
- The number of prefix tabs to add.ns
- The namespace. Can be name
- The element name.IOException
- If a problem occurred.public HtmlWriter sTag(String ns, String name) throws IOException
XmlWriter
sTag(ns, name, false );
sTag
in class XmlWriter
ns
- The namespace. Can be name
- The element name.IOException
- If a problem occurred.public HtmlWriter sTag(String ns, String name, boolean needsEncoding) throws IOException
XmlWriter
<ns:name>
sTag
in class XmlWriter
ns
- The namespace. Can be name
- The element name.needsEncoding
- If IOException
- If a problem occurred.public HtmlWriter sTag(int indent, String ns, String name) throws IOException
XmlWriter
i(indent).sTag(ns, name, false );
sTag
in class XmlWriter
indent
- The number of prefix tabs to add.ns
- The namespace. Can be name
- The element name.IOException
- If a problem occurred.public HtmlWriter sTag(int indent, String name) throws IOException
XmlWriter
i(indent).sTag(null , name, false );
sTag
in class XmlWriter
indent
- The number of prefix tabs to add.name
- The element name.IOException
- If a problem occurred.public HtmlWriter sTag(String name) throws IOException
XmlWriter
sTag(null , name, false );
sTag
in class XmlWriter
name
- The element name.IOException
- If a problem occurred.public HtmlWriter sTag(int indent, String ns, String name, boolean needsEncoding) throws IOException
XmlWriter
i(indent).sTag(ns, name, needsEncoding);
sTag
in class XmlWriter
indent
- The number of prefix tabs to add.ns
- The namespace. Can be name
- The element name.needsEncoding
- If IOException
- If a problem occurred.public HtmlWriter eTag(String ns, String name) throws IOException
XmlWriter
eTag(ns, name, false );
eTag
in class XmlWriter
ns
- The namespace. Can be name
- The element name.IOException
- If a problem occurred.public HtmlWriter eTag(String ns, String name, boolean needsEncoding) throws IOException
XmlWriter
</ns:name>
eTag
in class XmlWriter
ns
- The namespace. Can be name
- The element name.needsEncoding
- If IOException
- If a problem occurred.public HtmlWriter eTag(int indent, String ns, String name) throws IOException
XmlWriter
i(indent).eTag(ns, name, false );
eTag
in class XmlWriter
indent
- The number of prefix tabs to add.ns
- The namespace. Can be name
- The element name.IOException
- If a problem occurred.public HtmlWriter eTag(int indent, String name) throws IOException
XmlWriter
i(indent).eTag(null , name, false );
eTag
in class XmlWriter
indent
- The number of prefix tabs to add.name
- The element name.IOException
- If a problem occurred.public HtmlWriter eTag(String name) throws IOException
XmlWriter
eTag(null , name, false );
eTag
in class XmlWriter
name
- The element name.IOException
- If a problem occurred.public HtmlWriter eTag(int indent, String ns, String name, boolean needsEncoding) throws IOException
XmlWriter
i(indent).eTag(ns, name, needsEncoding);
eTag
in class XmlWriter
indent
- The number of prefix tabs to add.ns
- The namespace. Can be name
- The element name.needsEncoding
- If IOException
- If a problem occurred.public HtmlWriter attr(String name, Object value) throws IOException
XmlWriter
attr(null , name, value, false );
attr
in class XmlWriter
name
- The attribute name.value
- The attribute value.IOException
- If a problem occurred.public HtmlWriter attr(String ns, String name, Object value) throws IOException
XmlWriter
attr(ns, name, value, false );
attr
in class XmlWriter
ns
- The namespace. Can be name
- The attribute name.value
- The attribute value.IOException
- If a problem occurred.public HtmlWriter attr(String ns, String name, Object value, boolean valNeedsEncoding) throws IOException
XmlWriter
ns:name ='value'
attr
in class XmlWriter
ns
- The namespace. Can be name
- The attribute name.value
- The attribute value.valNeedsEncoding
- If IOException
- If a problem occurred.public HtmlWriter attr(String name, Object value, boolean valNeedsEncoding) throws IOException
XmlWriter
attr(null , name, value, false );
attr
in class XmlWriter
name
- The attribute name.value
- The attribute value.valNeedsEncoding
- If IOException
- If a problem occurred.public HtmlWriter oAttr(String ns, String name) throws IOException
XmlWriter
ns:name =
oAttr
in class XmlWriter
ns
- The namespace. Can be name
- The attribute name.IOException
- If a problem occurred.public HtmlWriter cr(int depth) throws IOException
SerializerWriter
Adds a newline and the specified number of tabs (if the useWhitespace
setting is enabled) to the output.
cr
in class XmlWriter
depth
- The indentation.IOException
- If a problem occurred trying to write to the writer.public HtmlWriter cre(int depth) throws IOException
SerializerWriter
Adds a newline and the specified number of tabs (if the useWhitespace
setting is enabled) to the output.
cre
in class XmlWriter
depth
- The indentation.IOException
- If a problem occurred trying to write to the writer.public HtmlWriter appendln(int indent, String text) throws IOException
SerializerWriter
useWhitespace
setting is enabled), followed by text, followed by a newline
(if the useWhitespace
setting is enabled).appendln
in class XmlWriter
indent
- The number of tabs to indent.text
- The text to write.IOException
- If a problem occurred trying to write to the writer.public HtmlWriter appendln(String text) throws IOException
SerializerWriter
useWhitespace
setting is enabled).appendln
in class XmlWriter
text
- The text to write.IOException
- If a problem occurred trying to write to the writer.public HtmlWriter append(int indent, String text) throws IOException
SerializerWriter
useWhitespace
setting is enabled), followed by text.append
in class XmlWriter
indent
- The number of tabs to indent.text
- The text to write.IOException
- If a problem occurred trying to write to the writer.public HtmlWriter append(int indent, char c) throws IOException
SerializerWriter
useWhitespace
setting is enabled), followed by text.append
in class XmlWriter
indent
- The number of tabs to indent.c
- The character to write.IOException
- If a problem occurred trying to write to the writer.public HtmlWriter s() throws IOException
SerializerWriter
useWhitespace
setting is enabled.s
in class XmlWriter
IOException
- If a problem occurred trying to write to the writer.public HtmlWriter q() throws IOException
SerializerWriter
quoteChar
setting to the output.q
in class XmlWriter
IOException
- If a problem occurred trying to write to the writer.public HtmlWriter i(int indent) throws IOException
SerializerWriter
useWhitespace
setting is enabled.i
in class XmlWriter
indent
- The number of tabs to indent.IOException
- If a problem occurred trying to write to the writer.public HtmlWriter nl(int indent) throws IOException
SerializerWriter
useWhitespace
setting is enabled.nl
in class XmlWriter
indent
- The current indentation level.IOException
- If a problem occurred trying to write to the writer.public HtmlWriter append(Object text) throws IOException
SerializerWriter
append
in class XmlWriter
text
- The text to write.IOException
- If a problem occurred trying to write to the writer.public HtmlWriter append(String text) throws IOException
SerializerWriter
append
in class XmlWriter
text
- The text to write.IOException
- If a problem occurred trying to write to the writer.public HtmlWriter append(char c) throws IOException
append
in interface Appendable
append
in class XmlWriter
IOException
Copyright © 2018 Apache. All rights reserved.