0

I'm using Java JAXB annotations to process and unmarshall XML document. If content of document is CDATA, it is propertly deserialized to String.

So if element is:

<elem><![CDATA[ something ]]></elem>

result of this operation

@XmlValue
protected String value;

is string:

\t\n\rsomething\t\n\r

which is OK.

Now my problem - how to tell if this element had CDATA annotation, or no - how to differentiate between

<elem><![CDATA[ something ]]></elem> 
<elem>something</elem> 

elements? I tried custom XmlTypeAdapters but no luck (string is already processed when reaches this point).

Thanks.

Marko Kraljevic
  • 401
  • 4
  • 19
  • Have a look at : http://stackoverflow.com/questions/14193944/jaxb-marshalling-unmarshalling-with-cdata – Amit Bhati Aug 06 '15 at 15:49
  • I did but it doesn't help with my problem. I have more specific problem than that one. Like I said in my question - I tried custom XmlTypeAdapters but no luck (string is already processed when reaches this point). – Marko Kraljevic Aug 06 '15 at 15:52

0 Answers0