• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Castor disable-output-escaping

 
Jez Nicholson
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
One of my Java attributes is a String with raw html in. Castor, or more likely the underlying xml parser, very kindly output escapes the value, i.e. turns the greater-than symbols to gt;, etc. I want to marshall the value to xml with a CDATA section and non-output escaped tags.

I can assign a custom handler to put the CDATA markers, but can I turn the output-escaping off?
 
Jez Nicholson
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well, I managed to find an answer myself. I've seen this question asked in various places including the castor-list and the official word is that you can't.....but that got me thinking, if xslt has a disable-output-escaping directive then it has to be possible.

My answer is to use the org.apache.xml.serializer.ToXMLStream as xslt does.

Something like...



then i've created a CDataFieldHandler to wrap any fields I choose in my mapping file....

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic