public static class

Document.OutputSettings

extends Object
implements Cloneable
java.lang.Object
   ↳ org.jsoup.nodes.Document.OutputSettings

Class Overview

A Document's output settings control the form of the text() and html() methods.

Summary

Public Constructors
Document.OutputSettings()
Public Methods
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(Charset charset)
Update the document's output charset.
Document.OutputSettings charset(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
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 prettyPrint()
Get if pretty printing is enabled.
Document.OutputSettings prettyPrint(boolean pretty)
Enable or disable pretty printing.
[Expand]
Inherited Methods
From class java.lang.Object

Public Constructors

public Document.OutputSettings ()

Public Methods

public 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.

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.

Returns
  • the document's current charset.

public Document.OutputSettings charset (Charset charset)

Update the document's output charset.

Parameters
charset the new charset to use.
Returns
  • the document's output settings, for chaining

public Document.OutputSettings charset (String charset)

Update the document's output charset.

Parameters
charset the new charset (by name) to use.
Returns
  • the document's output settings, for chaining

public Document.OutputSettings clone ()

public 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.

The default escape mode is base.

Returns
  • the document's current escape mode

public Document.OutputSettings escapeMode (Entities.EscapeMode escapeMode)

Set the document's escape mode

Parameters
escapeMode the new escape mode to use
Returns
  • the document's output settings, for chaining

public int indentAmount ()

Get the current tag indent amount, used when pretty printing.

Returns
  • the current indent amount

public Document.OutputSettings indentAmount (int indentAmount)

Set the indent amount for pretty printing

Parameters
indentAmount number of spaces to use for indenting each level. Must be >= 0.
Returns
  • this, for chaining

public boolean prettyPrint ()

Get if pretty printing is enabled. Default is true. If disabled, the HTML output methods will not re-format the output, and the output will generally look like the input.

Returns
  • if pretty printing is enabled.

public Document.OutputSettings prettyPrint (boolean pretty)

Enable or disable pretty printing.

Parameters
pretty new pretty print setting
Returns
  • this, for chaining