You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-users@xerces.apache.org by ohmson ampere <oh...@netscape.net> on 2002/06/12 00:16:05 UTC

Q: setPreserveSpace() in org.apache.xml.serialize.OutputFormat

Fellows!

  I have a DOM tree that I create programmatically. Subsequently I use org.apache.xml.serialize.XMLSerializer to write out the XML. I would like to preserve all the different kind of whitespace in the XML document; so I use setPreserveSpace() in org.apache.xml.serialize.OutputFormat.

  It works well when the identation is off. Here's some output:

<?xml version="1.0" encoding="UTF-8"?>
<content><string id="11">I love         you</string></content>

  (note that there is a couple of tabs in the string)

 But when I turn the identation on, the output is ugly: line breaks are introduced at seemingly random places in the elements, e.g. between 2 attributes. The string content is correctly output though:

<?xml version="1.0" encoding="UTF-8"?>
<content><string 
    id="11">I love          you</string></content>


What I would like to see is 

<?xml version="1.0" encoding="UTF-8"?>
<content>
    <string id="11">I love          you</string>
</content>

Is there some parameter that I am missing? Or is it a bug that I should report?

Thanks for any advice!

Ohmson


__________________________________________________________________
Your favorite stores, helpful shopping tools and great gift ideas. Experience the convenience of buying online with Shop@Netscape! http://shopnow.netscape.com/

Get your own FREE, personal Netscape Mail account today at http://webmail.netscape.com/


---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-j-user-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-j-user-help@xml.apache.org