HI!

Giving an XMLSerializer an OutputFormat with setPreserveSpace(true) should 
preserve spaces. Actually, this preserves LFs. Spaces are preserved always.

Example:
xml = "<root>\n  <one></one>\n  <two></two>\n  <three></three>\n</root>\n";

      sw = new StringWriter();
      outputFormat = new OutputFormat();
      outputFormat.setOmitXMLDeclaration(true);
      outputFormat.setEncoding("utf-16");
//      outputFormat.setPreserveSpace(true);
      xmlSerializer = new XMLSerializer(sw, outputFormat);
      xmlSerializer.serialize(xmlDoc.doc);
      ret = sw.toString();


Without setPreserveSpace(true), I get:
<root>   <one/>   <two/>   <three/> </root>

With setPreserveSpace(true), I get:
<root>
  <one/>
  <two/>
  <three/>
</root>


Regards,
Thomas


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to