AW: [jdom-interest] SAXBuilder adds a newline!?

MarkW markw at wilsoncom.de
Thu Aug 2 03:07:39 PDT 2001


Hi,
finally got round to converting all my DOM-stuff to JDOM.
Tried your advice - it worked!
But only after downloading the newest cvs. That was a nasty bug in
SAXBuilder.java.
Shouldn´t unformatting the data be the default behaviour when getting
xml-data from a file?
Most people keep their xml-data in a formatted form if stored in files - or
am i one of the few?

Thanks.
Mark

> 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
> mixture
>  > 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
> template
>  > 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.
>  >
>
> Ahsene Boulemankher wrote:
> Mark
> 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.
> Ahsene
> PS :   Don't forget to download the last SAXBuilder.java  a recent bug
> was fixed ?
>




More information about the jdom-interest mailing list