[jdom-interest] SAXBuilder adds a newline!?

Ahsene boulemankher ahsene.boulemnakher at laposte.net
Wed Jul 18 08:05:42 PDT 2001

MarkW wrote:

 > i store the xml-data using an internal class (not really more than a
 > string-buffer with several properties). I can then retrieve the xml-data
 > either as a DOM-object or as a JDOM-object.
 > As i said i´m gradually changing from DOM to JDOM so the code is a 
 > of both.
 > In one of my classes i read xml-data using DOM to build a JTree-menu and
 > that´s were i get problems with the xml-data read from a formatted 
 > using SAXBuilder. It works fine when i remove the LF+CR but then it´s not
 > exactly easy reading and manipulating the templates!
 > I hope the problem is a clearer now.
Why don't you try to use a XMLFilter ?

    XMLWriter echo = new XMLWriter();
    builder = new SAXBuilder();
    builder.setXMLFilter( new DataUnformatFilter(echo) );
   doc= builder.build ( filename);
   All you need is in the directory jdom-b7/samples/sax  with a good
example FilterTest.java.
PS :   Don't forget to download the last SAXBuilder.java  a recent bug
was fixed ?

More information about the jdom-interest mailing list