[jdom-interest] XMLOutputter: setting pretty print

Buggle Dagmar ZFF TE-HP Dagmar.Buggle at zf.com
Tue Jul 27 08:29:50 PDT 2004


Hi,
I'm just updated from b8 to b10. I noticed that the old constructors of
XMLOutputter are deprecated now and for formatting issues you should use the
class Format instead. I want my output to be indented, wrapped by newlines
and with encoding ISO-8859-1. encoding doesn't seem to be the problem, but
setting indentation and wrapping by
outputter.getFormat().setLineSeparator(System.getProperty("line.separator"))
followed by the indentation method and the encoding setting results in xml
files all in one line.

I've consulted the api docs for those classes, and for the
setLineSeparator() method I have found the following: 'Note that if the
"newlines" property is false, this value is irrelevant.' But I can't find a
method to set this property. 

Even Creating the XMLOutputter with Format.getPrettyFormat() does not do the
job. All xml in one line.

Maybe one of the following two facts are spoiling the output?
-I'm using xToString() to get a String which
-I've got the complete doctype declaration in the declaration subset.

How can I retrieve indented and wrapped output????

Thanx,
Dagmar






More information about the jdom-interest mailing list