I have an xml document that I used JAXB to ultimately have struts2 display in a webpage.
This document at a high level contains CDATA sections that are paragraphs that contain some HTML. The java object returned is a list of the paragraph objects whose text gets turned into strings.
When I display them in the JSP I get the paragraphs outputted to the screen and they contain HTML but it is not 开发者_如何学JAVArendered.
I have found answers on here about removing HTML from java strings but nothing like this. I also don't have control over the XML document I only consume it.
EclipseLink JAXB (MOXy) has the @XmlCDATA annotation for handling CDATA (I'm the tech lead). This may help if you can use MOXy as your JAXB implementation.
For more information see:
- http://bdoughan.blogspot.com/2010/07/cdata-cdata-run-run-data-run.html
精彩评论