Hi, If you cant fix it in the parsers (I defer to others)then you can fix it in the document factory (quick and very dirty, no flames please)
Extend the document factory that you want to use, and override the createCDATA public CDATA createCDATA(String text) { //fix the text return super.createCDATA(fixedText); } > -----Original Message----- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED]] On Behalf Of > Brian W. Young > Sent: Tuesday 17 September 2002 23:03 > To: Inns, Jeff > Cc: '[EMAIL PROTECTED]' > Subject: Re: [dom4j-user] CDATA, Carriage Returns and Line Feeds > > > I'm not sure there is a way around this. I experienced the > same thing a > while back and ended up having to use a ReplaceString("\n", "\r\n") > method. Quite a hack but it seemed the only way around it. > Looked like > most of the XML parsers out there would get rid of the CR. > > Sorry.... > > Inns, Jeff wrote: > > >I am experiencing a problem when I parse an XML document > that contains > >a CDATA section. The CDATA section in the DOM model does not contain > >the same content as the physical XML document. The CDATA section is > >the content of an Element. > > > >The CDATA section in the physical XML document contains carriage > >returns and line feeds. However, after the file is parsed > and I access > >the CDATA section (by means of Element.getText() - or - > >Element.getData()), the carriage return characters are gone and only > >the line feed characters are left. It appears that the parser is > >removing the carriage returns. > > > >It should be noted that I am using DOM4J to create the XML document > >that I am parsing. In other words, I use DOM4J to create the xml > >document, persist it to disk using XMLWriter; then another process > >comes along and uses DOM4J to parse and read the document. > > > >The OS is Win2K, JVM is Sun 1.4.0_01, DOM4J version is the latest > >nightly build as of 1:00 PM EST 9/17/2002. > > > >I doubt this is a DOM4J problem, but rather something I need to > >configure at a lower level. Any help will be greatly appreciated. > > > >Regards, > >Jeff > > > > > > > >------------------------------------------------------- > >This SF.NET email is sponsored by: AMD - Your access to the > experts on > >Hammer Technology! Open Source & Linux Developers, register > now for the > >AMD Developer Symposium. Code: EX8664 > >http://www.developwithamd.com/developerlab > >_______________________________________________ > >dom4j-user mailing list > >[EMAIL PROTECTED] > >https://lists.sourceforge.net/lists/listinfo/dom4j-user > > > > > > > > > > > -- > Brian W. Young > Senior Software Engineer/Project Manager > 1309 Sutton Park Drive South, Suite 320 > Jacksonville, FL 32224 > [EMAIL PROTECTED] > voice: 904.482.4209 > fax: 904.482.4220 > > > > > ------------------------------------------------------- > This SF.NET email is sponsored by: AMD - Your access to the > experts on Hammer Technology! Open Source & Linux Developers, > register now for the AMD Developer Symposium. Code: EX8664 > http://www.developwithamd.com/developerlab > > _______________________________________________ > dom4j-user mailing list > [EMAIL PROTECTED] > https://lists.sourceforge.net/lists/listinfo/d> om4j-user > ------------------------------------------------------- This SF.NET email is sponsored by: AMD - Your access to the experts on Hammer Technology! Open Source & Linux Developers, register now for the AMD Developer Symposium. Code: EX8664 http://www.developwithamd.com/developerlab _______________________________________________ dom4j-user mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/dom4j-user