dom4j Exception

来源:互联网 发布:手机求导软件 编辑:程序博客网 时间:2024/06/05 20:16
dom4j Exceptiondom4j <wbr>Exception

如果在使用DOM4J进行XML解析时,如果标签书写不规范则容易出现如下两类异常:

1.org.dom4j.DocumentException: Error on line 1 of document : Thecontent of elements must consist of well-formed character data ormarkup. Nested exception: The content of elements must consist ofwell-formed character data or markup.

2.org.xml.sax.SAXParseException: The content of elements mustconsist of well-formed character data or markup.
若只出现1类异常则说明开始标签中有空格出现,若两者都出现,则说明结束标签有空格出现,开始标签可能有空格
解决办法:只要去掉相应的空格就可以了
原创粉丝点击