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

Andreas Werner awerner at
Thu Dec 14 05:34:26 PST 2000

Hallo John

Just look at the XMLOutputter API. There are some methods to set identation
and line breaks.

For a more professional output you could use XSL and FOP to produce PDF

Andreas Werner

-----Ursprungliche Nachricht-----
Von: jdom-interest-admin at
[mailto:jdom-interest-admin at]Im Auftrag von John L. Webber -
jentro AG
Gesendet: Donnerstag, 14. Dezember 2000 11:41
An: jdom-interest
Betreff: [jdom-interest] How to format an XML document for printing?

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
To control your jdom-interest membership:

More information about the jdom-interest mailing list