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

John L. Webber - jentro AG John.Webber at jentro.com
Thu Dec 14 02:40:48 PST 2000

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?



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

More information about the jdom-interest mailing list