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

Frances fdr58 at yahoo.com
Thu May 11 07:46:15 PDT 2006


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 
following:

	Document doc = new Document();
	Element root = new Element("GREETING");
	root.setText("Hello JDOM!");
	doc.setRootElement(root);
	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..

Frances




More information about the jdom-interest mailing list