JAXB and CDATA sections
843834Jul 16 2002 — edited Oct 13 2008Hi,
I'm using JAXB to read in XML data like the following:
<OBJECT id="TABLET-REPORT">
<ATTRIBUTE name="STYLE">
<VALUE><![CDATA[formulogic.css]]></VALUE>
</ATTRIBUTE>
<ATTRIBUTE name="LABEL">
<VALUE><![CDATA[~a]]></VALUE>
</ATTRIBUTE>
<ATTRIBUTE name="HEADER">
<VALUE><![CDATA[ </tr>]]></VALUE>
<VALUE><![CDATA[ <th class="maintext" width="10%" align="center">Cost
per Tab</td>]]></VALUE>
</ATTRIBUTE>
</OBJECT>
JAXB doesn't seem to have a problem with the CDATA sections, but I can't
actually detect that they're there--so I just get the content back.
I was using the CDATA section to indicate that the contents were in a
string, so I actually want to treat the following two differently:
<VALUE><![CDATA[~a]]></VALUE>
<VALUE>~a</VALUE>
Anyone have any good ideas how to do this?
Also, when writing out, if I have a string with quotes in it (ie
"\"fred\""); I'd like to write this out as
<VALUE><![CDATA[fred]]></VALUE>
I can't see any way to do this with JAXB.
Thanks in advance.
Denis