org.gjt.xpp.XmlPullParserException 错误解决

	// 定义一个SringBuffer对象,用于接受参数
	StringBuffer xmlBuffer = new StringBuffer();
	String line = null;
	// 通过request获取获取输入流
	BufferedReader reader = request.getReader();
	// 一次读取请求输入流的数据
	while ((line = reader.readLine()) != null) {
		xmlBuffer.append(line);
	}
	// 将从输入流中读取到的内容转换	成字符串
	String xml = xmlBuffer.toString();
	// 以Dom4J开始解析XML字符串
	InputStream in = new ByteArrayInputStream(xml.getBytes());
	Document xmlDoc = (Document)new XPPReader().read(new ByteArrayInputStream(xml.getBytes()));
今天在学习Ajax时后,写到
Document xmlDoc = (Document)new XPPReader().read(new ByteArrayInputStream(xml.getBytes()));

一直报错误,提示

Multiple annotations found at this line:
	- The type org.gjt.xpp.XmlPullParserException cannot be resolved. It is indirectly referenced from 
	 required .class files
	- The method read(InputStream) from the type XPPReader refers to the missing type XmlPullParserException
	- The type org.gjt.xpp.XmlPullParserException cannot be resolved. It is indirectly referenced from 
	 required .class files
	- The method read(InputStream) from the type XPPReader refers to the missing type XmlPullParserException

异常,查了半天,并且看了源代码,原因是,找不到
import org.gjt.xpp.XmlPullParserException;
的包,于是,网上各种找,都没有结果。随后在dom4j的源代码包中找到了

pull-parser-2.1.10.jar
架包,于是加入,顺利解决。

  • 1
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值