[jdom-interest] XMLOutputter to String produces strange "newlines"

Buggle Dagmar ZFF TE-HP Dagmar.Buggle at zf.com
Fri Oct 25 05:13:39 PDT 2002


Hi, 
I'm using XMLOutputter to convert a newly created JDOM document to a String.
The thing I found was that between the XML declaration and the doctype and
between the doctype and the rest of the document three characters have been
inserted: \r\r\n (instead of \r\n or \n, what would be expected).
I'm using the following code to get the XML as a String:

        XMLOutputter xToString = new XMLOutputter("", false, "ISO-8859-1");
        xToString.setTrimAllWhite(true);
        String sXMLString = xToString.outputString(newCfg); //newCfg is an
instance of org.jdom.Document

I also tried to use XMLOutputter with a StringWriter, but that created the
same result concerning the wrong "newlines".

My OS is WinNT, I'm using the JDOM version which is distributed with JDK
1.4.0-b92.

Am I doing something wrong? Is there a more elegant way to get a String from
a JDOM tree?


Mit freundlichen Gruessen / Best regards

Dagmar Buggle (TE-H)

ZF Friedrichshafen AG		   	phone:	+49 (0)7541 77      7992
Research and Development Center		fax:  	+49 (0)7541 77 90 7992
Department TE-H				email:	mailto:dagmar.buggle at zf.com
88038 Friedrichshafen	






More information about the jdom-interest mailing list