[jdom-interest] XMLOutputter problem

Alex Devasia ADEVASIA at mobius.com
Fri Feb 8 13:33:56 PST 2002


That's the same problem. Each time my application runs a user can edit/add
entries that get written out to the XML file. Every time the file is written
to the number of blank lines keep increasing, as the file grows the # of
blank lines go up too.
-Alex

-----Original Message-----
From: Robertson, Jason [mailto:Jason.Robertson at acs-inc.com]
Sent: Friday, February 08, 2002 4:20 PM
To: 'Jason Hunter'; Alex Devasia
Cc: 'jdom-interest at jdom.org'
Subject: RE: [jdom-interest] XMLOutputter problem


If I'm to make an assumption about Alex's problem, there are meaningless
blank lines added to the document when it's saved. I think he wants the
newlines and the indent because he wants it to be pretty for a human. I have
the same problem but didn't care enough to ask about it. In my app, I have a
little class to merge several web.xml files and I get output like this:

<web-app>
  <!-- A Comment -->
  <servlet>
    <servlet-name>Servlet1</servlet-name>
    <servlet-class>com.me.Servlet1</servlet-class>
    
  </servlet>
  <servlet>
    <servlet-name>Servlet2</servlet-name>
    <servlet-class>com.me.Servlet2</servlet-class>
    
  </servlet>
...
</web-app>

See the blank lines occurring before the close tag? I think that's what he's
talking about. If he's not, then hey, anyone know how to solve this problem?

I'm using b7 and haven't tried pulling the latest code.

Jason

-----Original Message-----
From: Jason Hunter [mailto:jhunter at servlets.com]
Sent: Friday, February 08, 2002 3:59 PM
To: Alex Devasia
Cc: 'jdom-interest at jdom.org'
Subject: Re: [jdom-interest] XMLOutputter problem


Your passing "true" indicates you want newlines added.  Don't pass
true.  You probably don't want to pass " " for the indent either.  Just
use the default XMLOutputter constructor.

-jh-

Alex Devasia wrote:
> 
> I notice blank lines get inserted between lines each time I edit an XML
> file. The class is constructed as follows:
> m_xmlOutputter = new XMLOutputter(" ", true);
> I don't want to call m_xmlOutputter.setTextNormalize(true) because it
> removes whitespace from actual values being written to the file. I just
want
> to prevent blank lines from being written to the file. Can I fix this
> problem by calling some other method. I hope this gets fixed in version 8.
> 
> Thanks
> 
> _______________________________________________
> To control your jdom-interest membership:
>
http://lists.denveronline.net/mailman/options/jdom-interest/youraddr@yourhos
t.com
_______________________________________________
To control your jdom-interest membership:
http://lists.denveronline.net/mailman/options/jdom-interest/youraddr@yourhos
t.com



More information about the jdom-interest mailing list