Barry
Barry

Reputation: 1820

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

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 rendered.

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.

Upvotes: 3

Views: 2479

Answers (1)

bdoughan
bdoughan

Reputation: 149037

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:

Upvotes: 2

Related Questions