[jdom-interest] XMLOutputter problem

Jason Hunter jhunter at servlets.com
Fri Feb 8 13:50:52 PST 2002


The sometimes-extra-lines was a known issue in b7 (see the TODO from
back then) but it's fixed in the latest CVS.

-jh-

"Robertson, Jason" wrote:
> 
> 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