[jdom-interest] Formatting XMLOutputter with indents and linefeeds

Alex Chaffee guru at edamame.stinky.com
Wed Oct 4 12:09:10 PDT 2000


With the new XMLOutputter (should be in the latest CVS), this
definitely should work.  You may also need to say

 fmt.setTrimText(true)

to get rid of leftover whitespace from the source document before it
adds its newlines and indents.

 - A

On Tue, Oct 03, 2000 at 10:51:15AM -0500, Thomas C. Thompson wrote:
> I have used the following code hoping to get the xml 
> output to be formatted with indents and linefeeds to no 
> avail.  The output is just strung together in a single 
> line.  I'm sorry if this has been addressed but...
> 
> // Output the document, use standard formatter
> XMLOutputter fmt = new XMLOutputter("  ", true);
> fmt.setOmitEncoding(true);
> fmt.setLineSeparator("\n");
> fmt.output(doc, out);
> 
> Thanks for the help
> 
> Tom
> _______________________________________________
> To control your jdom-interest membership:
> http://lists.denveronline.net/mailman/options/jdom-interest/youraddr@yourhost.com

-- 
Alex Chaffee                       mailto:alex at jguru.com
jGuru - Java News and FAQs         http://www.jguru.com/alex/
Creator of Gamelan                 http://www.gamelan.com/
Founder of Purple Technology       http://www.purpletech.com/
Curator of Stinky Art Collective   http://www.stinky.com/



More information about the jdom-interest mailing list