This method of the Document class sets the style for writing to an output stream. Use XMLOutputStream.PRETTY or XMLOutputStream.COMPACT.
public void setOutputStyle(int style);
XMLOutputStream