Class OutputSettings
java.lang.Object
org.libxmq.OutputSettings
The
OutputSettings class is used to configure the output behavior
when printing XMQ. It provides options for controlling
pretty printing, indentation, and other formatting settings that affect
how XMQ content is presented as plain text, ansi-colored text, HTML or TeX.
Typical usage involves enabling or disabling pretty printing, setting the indentation width, and adjusting other output-related preferences to produce human-readable or compact XMQ output.
Example:
OutputSettings settings = new OutputSettings()
.setPrettyPrint(true)
.setIndentAmount(4);
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleancompact()Returns the previously set compact setting.booleanReturns the previously set escape-newlines setting.booleanReturns the previously set escape-non-7bit setting.booleanReturns the previously set escape-tabs setting.booleanhtmq()Returns true if the output format is htmq.intReturns the previously set indentation amount.booleannoTrim()Returns the previously set no-trim setting.booleanReturns the previously set prefer-double-quotes setting.setCompact(boolean c) Set if printing compact XMQ or not.setEscapeNewlines(boolean e) Set if newlines in text should be printed as a entity instead of a literal newline (the--escape-newlinesoption).setEscapeNon7bit(boolean e) Set if non 7bit characters should be printed as an entity (the--escape-non-7bitoption).setEscapeTabs(boolean e) Set if tabs in text should be printed as a	entity instead of a literal tab (the--escape-tabsoption).setHtmq(boolean h) Set if the output format is htmq.setIndentAmount(int amount) Sets the number of spaces to use for each level of indentation when pretty printing XMQ output.setNoTrim(boolean n) Set if the text of the document should not be trimmed (the--trim=noneoption).setPreferDoubleQuotes(boolean p) Set if double quotes should be preferred over single quotes (the--prefer-double-quotesoption).
-
Constructor Details
-
OutputSettings
public OutputSettings()Create default output settings.
-
-
Method Details
-
setCompact
Set if printing compact XMQ or not. Compact XMQ uses no newlines for the entire document.- Parameters:
c- If true, then print XMQ on a single line, ie no newlines.- Returns:
- this
OutputSettingsinstance, for method chaining
-
compact
public boolean compact()Returns the previously set compact setting.- Returns:
- the compact setting
-
setIndentAmount
Sets the number of spaces to use for each level of indentation when pretty printing XMQ output.This setting is only applied when pretty printing is enabled. Increasing the indent amount makes the output more readable, while setting a smaller value produces more compact output.
- Parameters:
amount- the number of spaces to use per indentation level; must be zero or a positive integer, negative values are interpreted as zero.- Returns:
- this
OutputSettingsinstance, for method chaining
-
indentAmount
public int indentAmount()Returns the previously set indentation amount.- Returns:
- the indentation amount
-
setEscapeTabs
Set if tabs in text should be printed as a	entity instead of a literal tab (the--escape-tabsoption).- Parameters:
e- If true, then escape tabs as entities.- Returns:
- this
OutputSettingsinstance, for method chaining
-
escapeTabs
public boolean escapeTabs()Returns the previously set escape-tabs setting.- Returns:
- the escape-tabs setting
-
setEscapeNewlines
Set if newlines in text should be printed as a entity instead of a literal newline (the--escape-newlinesoption).- Parameters:
e- If true, then escape newlines as entities.- Returns:
- this
OutputSettingsinstance, for method chaining
-
escapeNewlines
public boolean escapeNewlines()Returns the previously set escape-newlines setting.- Returns:
- the escape-newlines setting
-
setEscapeNon7bit
Set if non 7bit characters should be printed as an entity (the--escape-non-7bitoption).- Parameters:
e- If true, then escape non 7-bit characters as entities.- Returns:
- this
OutputSettingsinstance, for method chaining
-
setHtmq
Set if the output format is htmq. Then non 7-bit characters are escaped using html entity names, when such a name exists.- Parameters:
h- If true, the output is htmq.- Returns:
- this
OutputSettingsinstance, for method chaining
-
htmq
public boolean htmq()Returns true if the output format is htmq.- Returns:
- the htmq setting
-
escapeNon7bit
public boolean escapeNon7bit()Returns the previously set escape-non-7bit setting.- Returns:
- the escape-non-7bit setting
-
setPreferDoubleQuotes
Set if double quotes should be preferred over single quotes (the--prefer-double-quotesoption).- Parameters:
p- If true, then prefer double quotes.- Returns:
- this
OutputSettingsinstance, for method chaining
-
preferDoubleQuotes
public boolean preferDoubleQuotes()Returns the previously set prefer-double-quotes setting.- Returns:
- the prefer-double-quotes setting
-
setNoTrim
Set if the text of the document should not be trimmed (the--trim=noneoption).- Parameters:
n- If true, then do not trim leading and trailing whitespace from text at parse time.- Returns:
- this
OutputSettingsinstance, for method chaining
-
noTrim
public boolean noTrim()Returns the previously set no-trim setting.- Returns:
- the no-trim setting
-