2

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!

Alessia
  • 23
  • 4
  • The fix is supposed to go out in 2.13.2 but a few other bug fixes made me change the mind so that 2.13.2 would go out to fix the most pressing xpath evaluation issue... the CDATA fix would go out 2.13.3, along with more fixes.. you could go to CVS to download the fixes I will post a link – vtd-xml-author Jun 14 '17 at 20:58

1 Answers1

0

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

vtd-xml-author
  • 3,319
  • 4
  • 22
  • 30
  • Thanks, indeed I was using the wrong "minimal" string for testing. I have update the question with the correct XML string, where '[' and ']' appear inside CDATA. That seems to break the parsing. Can you please verify? – Alessia Jun 14 '17 at 12:25
  • Thanks for the bug report! – vtd-xml-author Jun 19 '17 at 20:04