Java Mailing List Archive

Home » JDOM Projects »

[jdom-interest] Formatting output

Oliver Hirschi


Author LoginPost Reply

I'm realy confused. In my example formatting the output does not work
correctly and I have no idea to solve this. I'm using JDOM 1.1.

1. I read a SVG file with JDOM.
2. I make some changes in the xml-tree (new elements, detach elements,
3. I write the tree to file with the following code:
XMLOutputter oXMLOutputter = new XMLOutputter();
Format oFormat = Format.getPrettyFormat();
FileOutputStream oFileOutputStream = new FileOutputStream(sFileChart);
OutputStreamWriter oOutputStreamWriter = new
OutputStreamWriter(oFileOutputStream, "UTF-8");
oXMLOutputter.output(oDoc_Chart, oOutputStreamWriter);

Now, my written XML is not formatted "pretty", e.g. where I detached an
element, a blank line is in the file and the identing is also not
correct. I also tried to set "oFormat.setLineSeparator("\n\n\n");", so
there comes three newlines before the root-element, but the content of
the root-element is not formatted???

Great thanks & kind regards,
Oliver Hirschi

To control your jdom-interest membership:
©2008 - Jax Systems, LLC, U.S.A.