[jdom-interest] b9 white space

John johnkie at pacbell.net
Sat May 3 16:45:14 PDT 2003


I am seeing extra white space in my output files with the b9.  I load the 
write the documents using the following code:

SAXBuilder builder = new SAXBuilder("org.apache.xerces.parsers.SAXParser");
builder.setIgnoringElementContentWhitespace(true);
Document doc = builder.build("filename.xml");

XMLOutputter xout = new XMLOutputter("  ", true, "UTF-8");
FileOutputStream fs = new FileOutputStream(fileName);
xout.output(doc, fs);

The input document uses only linefeeds to delimit lines, and has spaces and 
tabs to indent the XML.  A hex dump of the output file shows individual 
linefeeds indented.  I have included a short section of the dump of the 
output file below.  The input file has a linefeed followed by four spaces 
between the elements.

INPUT:
0000:0020 46 2d 38 22 3f 3e 0a 3c 43 4f 4e 54 45 4e 54 3e F-8"?>.<CONTENT>
0000:0030 0a 20 20 20 20 3c 43 4f 4e 54 45 4e 54 54 59 50 .    <CONTENTTYP
0000:0040 45 20 76 61 6c 75 65 3d 22 63 6f 33 22 2f 3e 0a E value="co3"/>.


OUTPUT:
0000:0020 46 2d 38 22 3f 3e 0d 0a 3c 43 4f 4e 54 45 4e 54 F-8"?>..<CONTENT
0000:0030 3e 0d 0a 20 20 0a 20 20 20 20 0d 0a 20 20 3c 43 >..  .    ..  <C
0000:0040 4f 4e 54 45 4e 54 54 59 50 45 20 76 61 6c 75 65 ONTENTTYPE value




More information about the jdom-interest mailing list