I have some xml data I’m trying to unmarshall into java objects and one of the elements contains <br/> elements:
<details>
<para>
Line Number One
<br/>
Line Number Two
</para>
</details>
In my Details java object I have:
class Details {
@XmlElement(name="para")
private List<String> paragraphs;
}
The problem is that the only element in the paragraphs list is ‘Line Number Two’. Does anyone know how I can deal with this?
You can represent mixed content with
@XmlMixedas follows (note that it’s applied to content of a class itself rather than to its element, thus you need an additional class):paragraphsproperty will containStrings for text lines andElements for XML elements.