[jdom-interest] Avoid linebreak when using org.jdom.Element.RemoveChild

Victor Toni victor.toni at ebuconnect.de
Tue Dec 12 04:44:22 PST 2006


Søren Faltz wrote:
> My outputter looks like this
>  
>
> public String convertDocumentToString(Document doc) {
>     String stringDocument;
>
>     XMLOutputter outputter = new XMLOutputter();
>     stringDocument = outputter.outputString(doc.getRootElement());
>
>     return stringDocument;
>   }
>
> Can I specify it to remove empty lines??
>
Have you tried:

XMLOutputter outputter = new XMLOutputter(Format.getPrettyFormat());

>  
> 2006/12/12, Victor Toni <victor.toni at ebuconnect.de 
> <mailto:victor.toni at ebuconnect.de>>:
>
>     JDOM works exactly as it is supposed to.
>
>     You have "text" between <Orange/> and <Green/> even if it contains
>     only
>     whitespaces and newlines.
>
>     Which format have you used for the Outputter?
>
>     Søren Faltz wrote:
>     > Document before
>     >
>     > <xml>
>     >   <type>
>     >     <Orange/>
>     >     <Green/>
>     >   </type>
>     > </xml>
>     >
>     > I then call objElementType.removeChild("Green");
>     >
>     > and my xml looks like this
>     >
>     > <xml>
>     >   <type>
>     >     <Orange/>
>     >
>     >   </type>
>     > </xml>
>     >
>     >
>     >
>     > but i want it to look like this
>     >
>     > <xml>
>     >   <type>
>     >     <Orange/>
>     >   </type>
>     > </xml>
>     >
>     > 2006/12/12, Victor Toni <victor.toni at ebuconnect.de
>     <mailto:victor.toni at ebuconnect.de>
>     > <mailto:victor.toni at ebuconnect.de
>     <mailto:victor.toni at ebuconnect.de>>>:
>     >
>     >     Søren Faltz wrote:
>     >     > When I use the removechild method, an empty line occurs in
>     the Jdom
>     >     > document, how do I avoid this empty line???
>     >
>     >     Providing a simply test case might prove useful.
>     >
>     >     Kindest regards,
>     >     Victor
>     >
>     >
>     >
>     ------------------------------------------------------------------------
>     >
>     > _______________________________________________
>     > To control your jdom-interest membership:
>     >
>     http://www.jdom.org/mailman/options/jdom-interest/youraddr@yourhost.com
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> To control your jdom-interest membership:
> http://www.jdom.org/mailman/options/jdom-interest/youraddr@yourhost.com


More information about the jdom-interest mailing list