Formatting output

View: New views
1 Messages — Rating Filter:   Alert me  

Formatting output

by Oliver Hirschi-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi

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,
etc.)
3. I write the tree to file with the following code:
------------------
XMLOutputter oXMLOutputter = new XMLOutputter();
Format oFormat = Format.getPrettyFormat();
oXMLOutputter.setFormat(oFormat);
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:
http://www.jdom.org/mailman/options/jdom-interest/youraddr@...
LightInTheBox - Buy quality products at wholesale price