[jdom-interest] JDOM white space probelm

Bradley S. Huffman hip at a.cs.okstate.edu
Mon Feb 24 12:44:33 PST 2003


I don't understand the question, is XMLOutputter taking whitespace away that
it shouldn't, or is it adding tabs and newlines and the output is just not
what you expected?

setIndent and setNewline only cause text to be added for alignment, but
never takes any characters away, whitespace or otherwise.

Also in this case

  outputter.setTextNormalize(false); 
  outputter.setTextTrim(false);
  outputter.setTrimAllWhite(false);

is unnecessary since they are all false by default (they are also mutually
exclusive).

Brad

=?iso-8859-1?q?Alexandre=20Gomes?= writes:

> --0-1050360821-1046117251=:98036
> Content-Type: text/plain; charset=iso-8859-1
> Content-Transfer-Encoding: 8bit
> 
> 
> Hello i´m having trouble with JDOM XMLOutputter. I don´t want to have blank spa
> ces removed from element´s text but always my xml file is recorded without the
> m.
> 
> The problem is when i use ´setNewlines(true)´ my blank spaces are gone when i h
> ave a string composed with only blank spaces.
> When i set newlines to false the problem is solved. But i can´t have my record
> ed XML file messed, so i need to use setNewLines(true) with setIndent(\t).
> 
> i already tried this :
> 
> XMLOutputter outputter = new XMLOutputter();
> outputter.setEncoding("UTF-8"); 
> outputter.setTextNormalize(false); 
> outputter.setTextTrim(false);
> outputter.setTrimAllWhite(false);
> outputter.setNewlines(true);
> outputter.setIndent("\t");
> 
> and it didn´t work.. 
> 
> Please help me somebody, what should i do?
> 
> I´ll be very gratefull for any help!
> 
> 
> 
> ---------------------------------
> Busca Yahoo! 
> O serviço de busca mais completo da Internet. O que você pensar o Yahoo! encont
> ra.
> --0-1050360821-1046117251=:98036
> Content-Type: text/html; charset=iso-8859-1
> Content-Transfer-Encoding: 8bit
> 
> <P>Hello&nbsp;i´m having trouble with JDOM XMLOutputter. I don´t want to have b
> lank spaces removed from element´s text but always my xml file is recorded wit
> hout them.</P>
> <P>The problem is when i use ´setNewlines(true)´ my blank spaces are gone when 
> i have a string composed with only blank spaces.<BR>When i set newlines to fa
> lse the problem is solved. But i can´t have my recorded XML file messed, so i 
> need to use setNewLines(true) with setIndent(\t).</P>
> <P>i already tried this :</P>
> <P>XMLOutputter outputter = new XMLOutputter();<BR>outputter.setEncoding("UTF
> -8"); <BR>outputter.setTextNormalize(false); <BR>outputter.setTextTrim(false)
> ;<BR>outputter.setTrimAllWhite(false);<BR>outputter.setNewlines(true);<BR>out
> putter.setIndent("\t");</P>
> <P>and it didn´t work.. </P>
> <P>Please help me somebody, what should i do?</P>
> <P>I´ll be very gratefull for any help!</P><p><br><hr size=1><b><a href="http:
> //br.busca.yahoo.com/">Busca Yahoo! </a></b><br>
> O serviço de busca mais completo da Internet. O que você pensar o Yahoo! encont
> ra.
> --0-1050360821-1046117251=:98036--
> _______________________________________________
> To control your jdom-interest membership:
> http://lists.denveronline.net/mailman/options/jdom-interest/youraddr@yourhost
> .com



More information about the jdom-interest mailing list