开发者

xml with cdata html sections using jaxb to convert to java objects ...is it possible to render the html?

开发者 https://www.devze.com 2023-02-06 12:17 出处:网络
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 obj

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
0

精彩评论

暂无评论...
验证码 换一张
取 消