There's a philosophical side to this as well that the programmer has to decide on. Should you be in the business of fixing invalid XML that is sent to you, or do you push that back on the client? There is no single answer to this, but it is a question you need to ask.
Robert Costello -----Original Message----- From: Radu Preotiuc [mailto:[email protected]] Sent: Wednesday, March 11, 2009 7:59 PM To: [email protected] Subject: RE: Removing CData from XML Elements Andrew, You have got to be careful using unescapeHtml() because it changes the data in your document. It seems to me that some code that you have is escaping some text which doesn't have to be escaped and so then you call unescapteHtml() to reverse that; the clean solution is to identify who's doing the extra escaping in the first place (XMLBeans is not doing it). Radu On Wed, 2009-03-11 at 14:45 -0700, acowlin wrote: > Hi Radu, > > Apologies if I wasn't very clear before. > > I had an xml element that looked like this, (but the text was much longer) > > <description><p>Some description</p></description> > > I was loading this into an xmlbeans document, but when I did a toString() on > that document the XML being returned was > > <description><![CDATA[<p>Some description</p>]]></description> > > So I actually wanted to change the element to not have CDATA wrapped around > the text (as the html was already escaped). > > I found a work around that involved using > StringEscapeUtils.unescapeHtml(String str) in one of the apache libraries > to unescape all the Html inside the CDATA and then it was ok to leave the > CDATA around it. > If you know of a way to remove the CData wrapped around a text Id still be > interested to hear it :) > > Thanks, > > Andrew > > > Radu Preotiuc-Pietro-2 wrote: > > > > Sorry, I must have misunderstood then. Setting CDataLengthThreshold to a > > large value should do the job. > > > > Andrew, can you provide a sample doc for which this does not work for > > you? > > > > Radu > > > > > > > --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]

