According to this answer, VTD should be able to parse records with CDATA
.
However, it seems the parsing does not work with version 2.13 (from maven repo) and with the latest 2.13.2 downloaded from sourceforge.
This is the test I am using:
private String xmlCDATA = "<p><![CDATA[ [Hello [World]] ! ]]></p>" ;";
@Test
public void testCDATA() throws Exception {
VTDGen vg = new VTDGen();
vg.setDoc(xmlCDATA.getBytes());
vg.parse(false);
}
and the exception I get:
com.ximpleware.ParseException: Error in CDATA: Invalid termination sequence
Line Number: 1 Offset: 27
at com.ximpleware.VTDGen.process_cdata(VTDGen.java:3092)
at com.ximpleware.VTDGen.parse(VTDGen.java:2640)
Any help is appreciated!
It seems that you are missing the trailing > character... which is required for terminating CDATA segement ... iow, it should have been ]]>
Update: I did a check and managed a quick release that contains the fixes to this bug in two places: one in VTDGen.java, the other in VTDGenHuge.java