Class OutputSettings

java.lang.Object
org.libxmq.OutputSettings

public class OutputSettings extends Object
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 Details

    • OutputSettings

      public OutputSettings()
      Create default output settings.
  • Method Details

    • setCompact

      public OutputSettings setCompact(boolean c)
      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 OutputSettings instance, for method chaining
    • compact

      public boolean compact()
      Returns the previously set compact setting.
      Returns:
      the compact setting
    • setIndentAmount

      public OutputSettings setIndentAmount(int amount)
      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 OutputSettings instance, for method chaining
    • indentAmount

      public int indentAmount()
      Returns the previously set indentation amount.
      Returns:
      the indentation amount
    • setEscapeTabs

      public OutputSettings setEscapeTabs(boolean e)
      Set if tabs in text should be printed as a 	 entity instead of a literal tab (the --escape-tabs option).
      Parameters:
      e - If true, then escape tabs as entities.
      Returns:
      this OutputSettings instance, for method chaining
    • escapeTabs

      public boolean escapeTabs()
      Returns the previously set escape-tabs setting.
      Returns:
      the escape-tabs setting
    • setEscapeNewlines

      public OutputSettings setEscapeNewlines(boolean e)
      Set if newlines in text should be printed as a 
 entity instead of a literal newline (the --escape-newlines option).
      Parameters:
      e - If true, then escape newlines as entities.
      Returns:
      this OutputSettings instance, for method chaining
    • escapeNewlines

      public boolean escapeNewlines()
      Returns the previously set escape-newlines setting.
      Returns:
      the escape-newlines setting
    • setEscapeNon7bit

      public OutputSettings setEscapeNon7bit(boolean e)
      Set if non 7bit characters should be printed as an entity (the --escape-non-7bit option).
      Parameters:
      e - If true, then escape non 7-bit characters as entities.
      Returns:
      this OutputSettings instance, for method chaining
    • setHtmq

      public OutputSettings setHtmq(boolean h)
      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 OutputSettings instance, 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

      public OutputSettings setPreferDoubleQuotes(boolean p)
      Set if double quotes should be preferred over single quotes (the --prefer-double-quotes option).
      Parameters:
      p - If true, then prefer double quotes.
      Returns:
      this OutputSettings instance, for method chaining
    • preferDoubleQuotes

      public boolean preferDoubleQuotes()
      Returns the previously set prefer-double-quotes setting.
      Returns:
      the prefer-double-quotes setting
    • setNoTrim

      public OutputSettings setNoTrim(boolean n)
      Set if the text of the document should not be trimmed (the --trim=none option).
      Parameters:
      n - If true, then do not trim leading and trailing whitespace from text at parse time.
      Returns:
      this OutputSettings instance, for method chaining
    • noTrim

      public boolean noTrim()
      Returns the previously set no-trim setting.
      Returns:
      the no-trim setting