CDATA in XML with ]] in the content

寵の児 提交于 2019-12-08 06:23:51

问题


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?


回答1:


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



来源:https://stackoverflow.com/questions/42202920/cdata-in-xml-with-in-the-content

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!