[jdom-interest] problem with XMLOutputter and CDATA

Karsten Opitz Karsten_Opitz at CoCreate.com
Tue Mar 6 13:21:35 PST 2001

I'm using the XMLOutputter with indent=true & newline=true because I do need
the formatted output for several reasons

Now I'm writing a CDATA section, e.g. 
    <![CDATA[aaaa         bbb]]>

When I read that back in, I have two choices

(1) getText          ==> "\n   aaaa      bbb\n"
(2) getTextTrim ==> "aaaa  bbb"

Neither of these strings are satisfactory, how can I get the original block
back ? As a workaround, I'm using
    String str = elem.getText();
Of course, that's not safe either. What if my block of binary data happens
start with a whitespace ?

Any suggestions for a workaround ? Maybe an enhancement request for the
XMLOutputter ?


Karsten Opitz
CoCreate Software Inc.
3801 Automation Way, Suite 110
Fort Collins, CO, 80525
www : http://www.cocreate.com
Phone : (970) 267-8161
Fax : (970) 267-8001
e-mail : karsten_opitz at CoCreate.com

More information about the jdom-interest mailing list