public static class Document.OutputSettings
extends java.lang.Object
implements java.lang.Cloneable
Modifier and Type | Class and Description |
---|---|
static class |
Document.OutputSettings.Syntax
The output serialization syntax.
|
Constructor and Description |
---|
OutputSettings() |
Modifier and Type | Method and Description |
---|---|
java.nio.charset.Charset |
charset()
Get the document's current output charset, which is used to control which characters are escaped when
generating HTML (via the
html() methods), and which are kept intact. |
Document.OutputSettings |
charset(java.nio.charset.Charset charset)
Update the document's output charset.
|
Document.OutputSettings |
charset(java.lang.String charset)
Update the document's output charset.
|
Document.OutputSettings |
clone() |
Entities.EscapeMode |
escapeMode()
Get the document's current HTML escape mode:
base , which provides a limited set of named HTML
entities and escapes other characters as numbered entities for maximum compatibility; or extended ,
which uses the complete set of HTML named entities. |
Document.OutputSettings |
escapeMode(Entities.EscapeMode escapeMode)
Set the document's escape mode, which determines how characters are escaped when the output character set
does not support a given character:- using either a named or a numbered escape.
|
int |
indentAmount()
Get the current tag indent amount, used when pretty printing.
|
Document.OutputSettings |
indentAmount(int indentAmount)
Set the indent amount for pretty printing
|
boolean |
outline()
Get if outline mode is enabled.
|
Document.OutputSettings |
outline(boolean outlineMode)
Enable or disable HTML outline mode.
|
boolean |
prettyPrint()
Get if pretty printing is enabled.
|
Document.OutputSettings |
prettyPrint(boolean pretty)
Enable or disable pretty printing.
|
Document.OutputSettings.Syntax |
syntax()
Get the document's current output syntax.
|
Document.OutputSettings |
syntax(Document.OutputSettings.Syntax syntax)
Set the document's output syntax.
|
public Entities.EscapeMode escapeMode()
base
, which provides a limited set of named HTML
entities and escapes other characters as numbered entities for maximum compatibility; or extended
,
which uses the complete set of HTML named entities.
The default escape mode is base
.
public Document.OutputSettings escapeMode(Entities.EscapeMode escapeMode)
escapeMode
- the new escape mode to usepublic java.nio.charset.Charset charset()
html()
methods), and which are kept intact.
Where possible (when parsing from a URL or File), the document's output charset is automatically set to the input charset. Otherwise, it defaults to UTF-8.
public Document.OutputSettings charset(java.nio.charset.Charset charset)
charset
- the new charset to use.public Document.OutputSettings charset(java.lang.String charset)
charset
- the new charset (by name) to use.public Document.OutputSettings.Syntax syntax()
public Document.OutputSettings syntax(Document.OutputSettings.Syntax syntax)
html
, with empty tags and boolean attributes (etc), or
xml
, with self-closing tags.syntax
- serialization syntaxpublic boolean prettyPrint()
public Document.OutputSettings prettyPrint(boolean pretty)
pretty
- new pretty print settingpublic boolean outline()
public Document.OutputSettings outline(boolean outlineMode)
outlineMode
- new outline settingpublic int indentAmount()
public Document.OutputSettings indentAmount(int indentAmount)
indentAmount
- number of spaces to use for indenting each level. Must be >= 0.public Document.OutputSettings clone()
clone
in class java.lang.Object