[jdom-interest] newbie

Gregory S. Hill ghill at vmtllc.com
Fri Oct 29 13:02:31 PDT 2004


</lurk>
Hah.  I think I know this one!

<snippet>
Format form = Format.getPrettyFormat();
XMLOutputter xmlOut = new XMLOutputter(form);
xmlOut.output(doc, new PrintWriter(new FileOutputStream("myfile.xml")));
</snippet>

This will output the xml in a nice, indented, 'newlined' format.  Take a 
look at the various Format.getXXXFormat() methods, as they provide a 
variety of outputs.

Good luck.

-greg
<lurk>

pamarti srikiran wrote:

> 
> Hi I recently downloaded jdom 1.0 and tried to use it. I m unable to get 
> the newline to be printed in the output xml file.
> Im getting the following output
> <sri>hi</sri>
> 
> instead of
> <sri>
> hi
> </sri>
> 
> can anybody tell me how to do this. i have examples that use oldversion 
> of jdom. help is greatly appreciated
> 
> thanks
> -sri
> _______________________________________________
> To control your jdom-interest membership:
> http://www.jdom.org/mailman/options/jdom-interest/youraddr@yourhost.com


More information about the jdom-interest mailing list