使用dom4j解析xml字符串

又是没接触不多的东西。只能Google了,大同小异找了几篇做了测试。改改就能满足自己的需求了。。。

1.

va解析xml字符串

http://zhuliyy1983.javaeye.com/blog/197954

2Dom4j解析xml字符http://student.csdn.net/cp.php?ac=blog

3http://hi.baidu.com/shuimufengyi/blog/item/5f8ad5b131841f5a0923029f.html

4http://xpws2006.blog.163.com/blog/static/9543857720095183129813/

都是很简单的例子,大概一看就知道怎么回事的东西。期间遇到个小问题???

就是在某一节点的属性中要是它的值含有 “&”号,将会报错。。。例如随便一节点 <record name="ss&" />,这样便报如下错误:

org.dom4j.DocumentException: Error on line 1 of document : The entity name must immediately follow the '&' in the entity reference. Nested exception: The entity name must immediately follow the '&' in the entity reference.

at org.dom4j.io.SAXReader.read(SAXReader.java:482)

at org.dom4j.DocumentHelper.parseText(DocumentHelper.java:278)

at com.zyeeda.projs.gpgc.epdc.portal2.utils.Unfinishwork.readXml(Unfinishwork.java:39)

at com.zyeeda.projs.gpgc.epdc.portal2.utils.Unfinishwork.main(Unfinishwork.java:87)

Nested exception:

待解决。

你可能感兴趣的:(java,xml,PHP,Blog,Google)