javaxmlvtd-xml

CDATA in XML with ]] in the content


I am using vtd-xml to do some xpaths on XML. My XML contains CDATA tags which vtd-xml seems to have an issue parsing.

Here is my XML:

<?xml version="1.0" encoding="UTF-8"?>
<root><![CDATA[ some random ]] stuff ]]></root>

Here is the exception I am getting:

Caused by: com.ximpleware.ParseException: Error in CDATA: Invalid termination sequence
Line Number: 2 Offset: 30
    at com.ximpleware.VTDGen.process_cdata(VTDGen.java:3092)
    at com.ximpleware.VTDGen.parse(VTDGen.java:2640)
    at sandpit.lib.xml.VtdXmlDocument.from(VtdXmlDocument.java:132)
    ... 7 more

Is this a bug in vtd-xml or is my XML invalid?


Solution

  • This is a bug that has been reported and fixed I believe. Check out the latest vtdGen.java from CVS and do a build.