Configured with three variables passed to the constructor:
indent
: a String
added at each level
of output; e.g. two spaces or a tab
lineSeparator
: the String
to break lines with,
no line breaking is performed if this is null or the empty string
encoding
: The name of the encoding to use for output; e.g.
UTF-16 or ISO-8859-1
Options can be set with these methods:
public void setLineSeparator(String separator) {}
public void setSuppressDeclaration(boolean suppressDeclaration) {}
public void setOmitEncoding(boolean omitEncoding) {}
public void setExpandEmptyElements(boolean expandEmptyElements) {}
public void setIndent(String indent) {}
public void setIndentSize(int indentSize) {}
public void setIndenting(boolean useIndentation) {}
The output()
method writes a Document
onto a given
OutputStream
:
public void output(Document doc, OutputStream out, String encoding) throws IOException
public void output(Document doc, OutputStream out) throws IOException