[Simple-support] How to deserialize / serialize html within an element
Brought to you by:
niallg
|
From: Danny S. <d.s...@gm...> - 2012-03-03 03:22:47
|
Hi,
We have XML documents that contain html content inside an element. It looks
something like this ...
<asset>
<assetId>12345</assetId>
<htmlBody><html><body>Hello World></body></html></htmlBody>
</asset>
Out target Java object looks something like this :
@Element
private String assetId;
@Element
private String htmlBody;
The only way we can get the html content from inside htmlBody is to
surround it with CDATA and use @Element(data = true).
This is all fine, until we reach the point of wanting to serialize it and
the save it to our Marklogic database. I'm trying to avoid having CDATA
around the html content because it will mean modifying quite a bit of
existing Marklogic xquery scripts.
Is there another way (an annotation perhaps) to load this html content with
less effort ? I tried the @Text annotation, but that doesn't seem to work.
Regards,
Danny
|