简体   繁体   中英

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?

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM