AW: [jdom-interest] SAXBuilder inserts unwanted carriage return

MarkW markw at wilsoncom.de
Tue Oct 30 04:09:10 PST 2001


Hi,
I had a similar problem and somebody pointed me to an example in
\samples\sax.
Look at DataFormatFilter.java and DataUnformatFilter.java.
Hope it helps.

Mark

> When you create a document using SAXBuilder.build(), it seems that a
> carriage return is inserted at each end of line. And when you output the
> loaded document, it leads to ugly indentation.
>
> This is particularly true on script elements where
> "<![CDATA[
> ]]>"
>   is inserted on EACH line.
>
> Here is a small code that shows the problem
> public void showError()
> {
>      InputStream input;
>      Document document;
>      SAXBuilder builder;
>      XMLOutputter outputter;
>
>      try
>      {
>        outputter = new XMLOutputter("  ", true);
>        builder = new SAXBuilder();
>        // Use your own xml file defining a script
>        document = builder.build(new File("myDocument.xml"));
>        outputter.output(document, System.out);
>      }
>      catch(Exception e)
>      {
>      }
> }
>
> It is not a big deal, but if you want to use templates to generate your
> final XML files, then you got badly indented files and human unreadable
> scripts.
>
> Can the wonderful jdom team try to fix that for the next release?
> Thanks,
>
> Philippe Converset
>
> _______________________________________________
> To control your jdom-interest membership:
> http://lists.denveronline.net/mailman/options/jdom-interest/yourad
dr at yourhost.com




More information about the jdom-interest mailing list