how can i tell XMLSerializer to preserve empty lines (and spaces) within elements? i write a DOM object via
FileWriter fw = new FileWriter(file);
OutputFormat of = new OutputFormat(document, "iso-8859-1", true);
of.setLineWidth(0); //turn off automatic line wrapping
of.setPreserveSpace(false); //true preserves new lines but does not nice XML formatting
XMLSerializer xmls = new XMLSerializer(fw,of);
xmls.serialize(document);
and empty lines within text nodes are just ignored or a space is inserted instead. but when i set outputFormat.setPreserveSpace(true), the new lines are preserved and printed to the XML file. however, with setPreserveSpace(true) all the nice XML formatting is gone (all XML is printed to to one single line - just the explicit new lines within elements (text nodes) create new lines), too! :-(
how can i preserve space in element (nodes) but still keep the nice XML formatting (with new lines for each element and indentation)?