[jdom-interest] How to format an XML document for printing?

Jason Hunter jhunter at collab.net
Thu Dec 14 11:06:33 PST 2000


Notice a setLineWidth() method is an idea listed in our TODO.txt file in
the latest distribution.  It's not implemented yet, but seems like a
reasonable idea to me.  I'd want to implement it after fixing a few bugs
I found in XMLOutputter.

Anyone else think line width would be good/bad?  It does affect
whitespace handling, which can be a touchy subject.  Setting a width
would be saying you don't care about preserving literal whitespace.

-jh-

"John L. Webber - jentro AG" wrote:
> 
> Is there a relatively easy way to format an XML document for printing to
> paper? More specifically, to regulate the line length of the output?
> 
> I'm using JDOM to produce a config file, and many elements have a long
> attribute list; when I use an XMLOutputter constructed as new
> XMLOutputter("  ", true), these elements are printed to file as one long
> line, which is not optimal for printing. After checking the archives and
> the javadocs I haven't been able to find any way of doing this, other
> than maybe implementing a formatter/parser myself to do the job.
> 
> Have I overlooked a possibility with XMLOutputter, or can anyone share
> some code snippets to help me with my formatting task?
> 
> Thanks,
> 
> John
> 
> --
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> jentro AG
> John L. Webber, Software Development
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> Peter-Henlein-Strasse 28-30, 85540 Haar/Munich, Germany
> Tel.:  +49 89 462 385 0     (switchboard)
> Tel.:  +49 89 462 385 38    (direct)
> Fax:   +49 89 462 385 29
> mailto:John.Webber at jentro.com
> http://www.jentro.com
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> _______________________________________________
> To control your jdom-interest membership:
> http://lists.denveronline.net/mailman/options/jdom-interest/youraddr@yourhost.com



More information about the jdom-interest mailing list