以文本方式查看主题

-  中文XML论坛 - 专业的XML技术讨论区  (http://bbs.xml.org.cn/index.asp)
--  『 DOM/SAX/XPath 』  (http://bbs.xml.org.cn/list.asp?boardid=11)
----  使用DOM4J的DocumentHelper.parseText的方法解析带CDATA的XML出错  (http://bbs.xml.org.cn/dispbbs.asp?boardid=11&rootid=&id=61959)


--  作者:rahc
--  发布时间:4/28/2008 9:45:00 PM

--  使用DOM4J的DocumentHelper.parseText的方法解析带CDATA的XML出错
使用dom4j调用DocumentHelper.parseText方法时,出现异常
org.dom4j.Document
Exception: Error on line 5 of document  : The content of elements must consist o
f well-formed character data or markup. Nested exception: The content of element
s must consist of well-formed character data or markup.

指向的第5行正好是我要解析的xml文档出现cdata的地方:

<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
        <title></title>
        <script language="javascript">
<![CDATA[
allCount=1
...
]]>
</script>
</head>
</html>

请问各位大侠何解?


W 3 C h i n a ( since 2003 ) 旗 下 站 点
苏ICP备05006046号《全国人大常委会关于维护互联网安全的决定》《计算机信息网络国际联网安全保护管理办法》
35.156ms