Here are related parts:
Indenting (false)If true, then the serializer will add indents at each level and wrap lines that exceed the maximum line width. If false it won't. The number of spaces to indent is set by the indent property, and the column to wrap at is set by the line width property.
public void setIndenting(boolean indenting);
public boolean getIndenting();
Indent (4)The number of spaces to indent each level if indenting is true.
public void setIndent(int indent);
public int getIndent();
Line width (72)The maximum number of characters in a line when indenting is true. Setting this to zero turns off line wrapping completely.
public void setLineWidth(int width);
public int getLineWidth();
So, we can set a line width, set indenting to true and give an indent value. The best way is this i think. I read "Creating DOMWriters" section too and it does not solve this problem either. (it just can select which nodes can be printed)
Example code:
1 2 3
| format.setLineWidth(40); format.setIndenting(true); format.setIndent(6); |