[jdom-interest] Problem with XMLOutputter beta

stephan.segschneider at snellwilcox.com stephan.segschneider at snellwilcox.com
Fri Jul 6 02:50:57 PDT 2001


Hi Jason

it's me again. I wrote a tiny test app to verify the formatting behaviour with
JDOM 6. It actually has to do with the EntityResolver I'm using, however I don't
know what's going on. If you are interested I can send you the app (zip-size is
5k). If anyone else would like to have the files please send me your mail
address.
 
 Cheers,
               Stephan

 
-----------------------------------------------------------------
  Stephan Segschneider
  EMail : stephan.segschneider at snellwilcox.com  (office)
-----------------------------------------------------------------

____________________Reply Separator____________________
Subject:    Re: [jdom-interest] Problem with XMLOutputter beta
Author: "Jason Hunter" <jhunter at acm.org>
Date:       05/07/01 18:38

stephan.segschneider at snellwilcox.com wrote:
> 
> I have just converted my application back to JDOM beta 6. Using the following
> code does solve my problem completely. You can mess up the formatting of an
> existing XML file with any text editor (add spaces, add newlines, add tabs
> whatsoever) and after loading the XML via SaxBuilder and writing it via the
code
> shown below you will get everything repaired - formatted the way you expect it
-
> indentation four spaces, no additional empty lines between elements AND all
the
> text data *untouched*!
> 
>         fileWriter = new FileWriter(location);
>         XMLOutputter outputter = new XMLOutputter("    ", true);
>         outputter.setTrimText(false);
>         outputter.setExpandEmptyElements(false);
>         outputter.output(doc, fileWriter);

Pretty formatting is done by adding and removing text whitespace -- so I
don't see how you can say everything's formatted nicely and text data is
untouched.  Some text nodes are definitely being touched.  Given the
flags above you're adding whitespace without ever removing any, so a
pretty printed document read in and output this way will be whitespace
padded even tho it's not necessary.

-jh-
_______________________________________________
To control your jdom-interest membership:
http://lists.denveronline.net/mailman/options/jdom-interest/youraddr@yourhost.co
m




----------------------------------------------------------------------
The contents of this communication are confidential to the normal user of
the email address to which it was sent.  If you have received this email
in error, any use, dissemination, forwarding, printing or copying of this
email is strictly prohibited.  If this is the case, please notify the sender
and delete this message.
----------------------------------------------------------------------




More information about the jdom-interest mailing list