OutputFormat represents the format configuration used by
XMLWriterand its base classes to format the XML output
| Modifier and Type | Field and Description |
|---|---|
| private char | attributeQuoteChar
Quote character to use when writing attributes. |
| private boolean | doXHTML
Whether or not to use XHTML standard. |
| private String | encoding
The encoding format |
| private boolean | expandEmptyElements
Whether or not to expand empty elements to
<tagName></tagName> - default is |
| private String | indent
The default indent is no spaces (as original document) |
| private String | lineSeparator
New line separator |
| private boolean | newLineAfterDeclaration
Whether or not to print new line after the XML declaration - default is
|
| private int | newLineAfterNTags
Controls when to output a line.separtor every so many tags in case of no lines and total text trimming. |
| private boolean | newlines
The default new line flag, set to do new lines only as in original document |
| private boolean | omitEncoding
Whether or not to output the encoding in the XML declaration - default is
|
| private boolean | padText
pad string-element boundaries with whitespace |
| protected static final String | STANDARD_INDENT
standard value to indent by, if we are indenting |
| private boolean | suppressDeclaration
Whether or not to suppress the XML declaration - default is
|
| private boolean | trimText
should we preserve whitespace or not in text nodes? |
| Access | Constructor and Description |
|---|---|
| public | |
| public | OutputFormat(String
is the indent string to be used for indentation (usually a
number of spaces). indent)Creates an |
| public | OutputFormat(String
is the indent string to be used for indentation (usually a
number of spaces). indent, boolean whether new lines are added to layout the newlines)Creates an |
| public | OutputFormat(String
is the indent string to be used for indentation (usually a
number of spaces). indent, boolean whether new lines are added to layout the newlines, String is the text encoding to use for writing the XML encoding)Creates an |
| Modifier and Type | Method and Description |
|---|---|
| public static OutputFormat | Returns: DOCUMENT ME!A static helper method to create the default compact format. |
| public static OutputFormat | Returns: DOCUMENT ME!A static helper method to create the default pretty printing format. |
| public char | |
| public String | |
| public String | |
| public String | |
| public int | |
| public boolean | |
| public boolean | Returns: true if a new line should be printed following XML declarationDOCUMENT ME! |
| public boolean | |
| public boolean | |
| public boolean | |
| public boolean | Returns: true if the output of the XML declaration (<?xml
version="1.0"?>)
should be suppressed else false.DOCUMENT ME! |
| public boolean | |
| public boolean | Returns: DOCUMENT ME!Whether or not to use the XHTML standard: like HTML but passes an XML parser with real, closed tags. |
| public int | Returns: the index of first parameter that we didn't understandis the array of command line arguments args, int is the index in args to start parsing options i)Parses command line arguments of the form |
| public void | setAttributeQuoteCharacter(char
The character to use when quoting attribute values. quoteChar)Sets the character used to quote attribute values. |
| public void | |
| public void | setExpandEmptyElements(boolean
boolean indicating whether or not empty
elements should be expanded.
This will set whether empty elements are expanded from
|
| public void | |
| public void | setIndent(boolean
if true, set indenting on; if false, set indenting off doIndent)Set the indent on or off. |
| public void | setIndentSize(int
int number of spaces in indentation.This will set the indent |
| public void | setLineSeparator(String
String line separator to use.This will set the new-line separator. |
| public void | setNewLineAfterDeclaration(boolean
boolean indicating whether or not to print new
line following the XML declaration. The default is true.This will set whether a new line is printed after the XML declaration (assuming it is not supressed.) |
| public void | setNewLineAfterNTags(int
DOCUMENT ME! tagCount)Controls output of a line.separator every tagCount tags when isNewlines is false. |
| public void | setNewlines(boolean
true indicates new lines should be printed,
else new lines are ignored (compacted).DOCUMENT ME! |
| public void | setOmitEncoding(boolean
boolean indicating whether or not the XML
declaration should indicate the document encoding.
This will set whether the XML declaration ( |
| public void | setPadText(boolean
boolean if true, pad string-element boundariesEnsure that text immediately preceded by or followed by an element will be "padded" with a single space. |
| public void | setSuppressDeclaration(boolean
boolean indicating whether or not the XML
declaration should be suppressed.
This will set whether the XML declaration ( |
| public void | setTrimText(boolean
boolean true → trim the whitespace, false → use
text verbatimThis will set whether the text is output verbatim (false) or with
whitespace stripped as per |
| public void | setXHTML(boolean
boolean true → conform to XHTML, false → conform
to HTML, can have unclosed tags, etc.This will set whether or not to use the XHTML standard: like HTML but passes an XML parser with real, closed tags. |
| attributeQuoteChar | back to summary |
|---|---|
| private char attributeQuoteChar Quote character to use when writing attributes. | |
| doXHTML | back to summary |
|---|---|
| private boolean doXHTML Whether or not to use XHTML standard. | |
| encoding | back to summary |
|---|---|
| private String encoding The encoding format | |
| expandEmptyElements | back to summary |
|---|---|
| private boolean expandEmptyElements Whether or not to expand empty elements to
<tagName></tagName> - default is | |
| indent | back to summary |
|---|---|
| private String indent The default indent is no spaces (as original document) | |
| lineSeparator | back to summary |
|---|---|
| private String lineSeparator New line separator | |
| newLineAfterDeclaration | back to summary |
|---|---|
| private boolean newLineAfterDeclaration Whether or not to print new line after the XML declaration - default is
| |
| newLineAfterNTags | back to summary |
|---|---|
| private int newLineAfterNTags Controls when to output a line.separtor every so many tags in case of no lines and total text trimming. | |
| newlines | back to summary |
|---|---|
| private boolean newlines The default new line flag, set to do new lines only as in original document | |
| omitEncoding | back to summary |
|---|---|
| private boolean omitEncoding Whether or not to output the encoding in the XML declaration - default is
| |
| padText | back to summary |
|---|---|
| private boolean padText pad string-element boundaries with whitespace | |
| STANDARD_INDENT | back to summary |
|---|---|
| protected static final String STANDARD_INDENT standard value to indent by, if we are indenting | |
| suppressDeclaration | back to summary |
|---|---|
| private boolean suppressDeclaration Whether or not to suppress the XML declaration - default is
| |
| trimText | back to summary |
|---|---|
| private boolean trimText should we preserve whitespace or not in text nodes? | |
| OutputFormat | back to summary |
|---|---|
| public OutputFormat() Creates an | |
| OutputFormat | back to summary |
|---|---|
| public OutputFormat(String indent) Creates an
| |
| OutputFormat | back to summary |
|---|---|
| public OutputFormat(String indent, boolean newlines) Creates an
| |
| OutputFormat | back to summary |
|---|---|
| public OutputFormat(String indent, boolean newlines, String encoding) Creates an | |
| createCompactFormat | back to summary |
|---|---|
| public static OutputFormat createCompactFormat() A static helper method to create the default compact format. This format does not have any indentation or newlines after an alement and all other whitespace trimmed
| |
| createPrettyPrint | back to summary |
|---|---|
| public static OutputFormat createPrettyPrint() A static helper method to create the default pretty printing format. This format consists of an indent of 2 spaces, newlines after each element and all other whitespace trimmed, and XMTML is false.
| |
| getAttributeQuoteCharacter | back to summary |
|---|---|
| public char getAttributeQuoteCharacter() | |
| getEncoding | back to summary |
|---|---|
| public String getEncoding() | |
| getIndent | back to summary |
|---|---|
| public String getIndent() | |
| getLineSeparator | back to summary |
|---|---|
| public String getLineSeparator() | |
| getNewLineAfterNTags | back to summary |
|---|---|
| public int getNewLineAfterNTags() | |
| isExpandEmptyElements | back to summary |
|---|---|
| public boolean isExpandEmptyElements() | |
| isNewLineAfterDeclaration | back to summary |
|---|---|
| public boolean isNewLineAfterDeclaration() DOCUMENT ME!
| |
| isNewlines | back to summary |
|---|---|
| public boolean isNewlines() | |
| isOmitEncoding | back to summary |
|---|---|
| public boolean isOmitEncoding() | |
| isPadText | back to summary |
|---|---|
| public boolean isPadText() | |
| isSuppressDeclaration | back to summary |
|---|---|
| public boolean isSuppressDeclaration() DOCUMENT ME!
| |
| isTrimText | back to summary |
|---|---|
| public boolean isTrimText() | |
| isXHTML | back to summary |
|---|---|
| public boolean isXHTML() Whether or not to use the XHTML standard: like HTML but passes an XML
parser with real, closed tags. Also, XHTML CDATA sections will be output
with the CDATA delimiters: ( " <![CDATA[ " and "
]]> " ) otherwise, the class HTMLWriter will output the
CDATA text, but not the delimiters.
Default is
| |
| parseOptions | back to summary |
|---|---|
| public int parseOptions(String[] args, int i) Parses command line arguments of the form
| |
| setAttributeQuoteCharacter | back to summary |
|---|---|
| public void setAttributeQuoteCharacter(char quoteChar) Sets the character used to quote attribute values. The specified
character must be a valid XML attribute quote character, otherwise an
| |
| setEncoding | back to summary |
|---|---|
| public void setEncoding(String encoding) DOCUMENT ME!
| |
| setExpandEmptyElements | back to summary |
|---|---|
| public void setExpandEmptyElements(boolean expandEmptyElements)
This will set whether empty elements are expanded from
| |
| setIndent | back to summary |
|---|---|
| public void setIndent(String indent) This will set the indent
| |
| setIndent | back to summary |
|---|---|
| public void setIndent(boolean doIndent) Set the indent on or off. If setting on, will use the value of STANDARD_INDENT, which is usually two spaces.
| |
| setIndentSize | back to summary |
|---|---|
| public void setIndentSize(int indentSize) This will set the indent
| |
| setLineSeparator | back to summary |
|---|---|
| public void setLineSeparator(String separator)
This will set the new-line separator. The default is
| |
| setNewLineAfterDeclaration | back to summary |
|---|---|
| public void setNewLineAfterDeclaration(boolean newLineAfterDeclaration) This will set whether a new line is printed after the XML declaration (assuming it is not supressed.)
| |
| setNewLineAfterNTags | back to summary |
|---|---|
| public void setNewLineAfterNTags(int tagCount) Controls output of a line.separator every tagCount tags when isNewlines is false. If tagCount equals zero, it means don't do anything special. If greater than zero, then a line.separator will be output after tagCount tags have been output. Used when you would like to squeeze the html as much as possible, but some browsers don't like really long lines. A tag count of 10 would produce a line.separator in the output after 10 close tags (including single tags).
| |
| setNewlines | back to summary |
|---|---|
| public void setNewlines(boolean newlines) DOCUMENT ME!
| |
| setOmitEncoding | back to summary |
|---|---|
| public void setOmitEncoding(boolean omitEncoding)
This will set whether the XML declaration (
| |
| setPadText | back to summary |
|---|---|
| public void setPadText(boolean padText) Ensure that text immediately preceded by or followed by an element will
be "padded" with a single space. This is used to allow make
browser-friendly HTML, avoiding trimText's transformation of, e.g.,
| |
| setSuppressDeclaration | back to summary |
|---|---|
| public void setSuppressDeclaration(boolean suppressDeclaration)
This will set whether the XML declaration (
| |
| setTrimText | back to summary |
|---|---|
| public void setTrimText(boolean trimText) This will set whether the text is output verbatim (false) or with
whitespace stripped as per
| |
| setXHTML | back to summary |
|---|---|
| public void setXHTML(boolean xhtml) This will set whether or not to use the XHTML standard: like HTML but passes an XML parser with real, closed tags. Also, XHTML CDATA sections will be output with the CDATA delimiters: ( " <[CDATA[ " and " ]]< ) otherwise, the class HTMLWriter will output the CDATA text, but not the delimiters. Default: false
| |