[jdom-interest] Re: jdom 1.0 XMLOutputter -- problems

Edelson, Justin Justin.Edelson at mtvn.com
Thu May 11 08:00:08 PDT 2006

Instead of System.out, pass an OutputStream or Writer to

If you're going to use a Writer, be sure to read the warning in the
JavaDocs about the encoding:

-----Original Message-----
From: jdom-interest-bounces at jdom.org
[mailto:jdom-interest-bounces at jdom.org] On Behalf Of Frances
Sent: Thursday, May 11, 2006 10:46 AM
To: jdom-interest at jdom.org
Subject: [jdom-interest] Re: jdom 1.0 XMLOutputter -- problems

Elliotte Harold wrote:
> Frances wrote:
>> all examples I see to create XML files, like for example here..
>> http://www.cafeconleche.org/books/xmljava/chapters/ch14s03.html
>> say they are creating XML files, but they're only creating what goes 
>> INSIDE xml file, not actual XML file..    it says on this page:
> You need to read the next page. All will be revealed, though a certain

> level of familiarity with Java I/O is assumed.
> FYI, that page never says it's creating an XML *file*, only an XML 
> *document*. They are not the same thing, and the difference is crucial

> here.

thank you very much, I did go to next page (had done so previously 
also..) so, based on code found at above pg and next pg, I now have the 

	Document doc = new Document();
	Element root = new Element("GREETING");
	root.setText("Hello JDOM!");
	XMLOutputter outputter = new XMLOutputter();
	outputter.output(doc, System.out);

         //  (plus try-catch code..)

this compiles and runs fine; however, it prints XML output in command 
line..  still haven't found how to create an actual XML file (say, 
info.xml) how would I do this?  (yes, I AM familiar with Java I/O.. I 
have created files with it..)  thank you very much..


To control your jdom-interest membership:

More information about the jdom-interest mailing list