使用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:

待解决。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值