[jdom-interest] XMLOutputter

Steven Gould steven.gould at cgiusa.com
Tue Feb 27 01:42:03 PST 2001


The default XMLOutputter does not add any indentation or newlines, so the results you
got are correct. The javadoc for the XMLOutputter default constructor states:

This will create an XMLOutputter with no additional whitespace (indent or new lines)



Corcos Igal wrote:

> Has anyone used the XMLOutputter class without specifying any parameters and
> found that the supposed default options are not enforced.?
> When I specify the following:
>         Document newDoc = new Document( elmRoot );
>             XMLOutputter fmt = new XMLOutputter();
>             fmt.output(newDoc, System.out);
> My XML gets output all on one line, but when I change the second to last
> line to:
>             XMLOutputter fmt = new XMLOutputter("  ", true);
> My XML gets output with the correct formatting (i.e. 2 space indent and new
> line feeds on).
> Shouldn't it print this way without having to specify the parameters?
> Igal Corcos.
> _______________________________________________
> 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