org.xml.sax.SAXParseException: Content is not allowed in trailing section. .

总结一下,这个问题主要出现的原因有两点。

 

1、XML内容不正确,比如多个空格,换行等等。需要仔细排查;

2、使用Stream读取流文件不正确,详细如下:

 

读写文件时,一般采用的是每次从inputStream中read 一个有固定大小的byte array时,这时候在

 

byte[] array = new byte[1024];

 

BufferedInputStream buffInput = new BufferedInputStream(inputStream);

FileOutputStream fileOS = new FileOutputStream(targetFile);

BufferedOutputStream buffOS = new BufferedOutputStream(fileOS);

int word = 0;

while ((word = buffInput.read(array)) != -1){

buffOS.write(array);

}

 

 

上面的写法,如果最后一次read到array中不足1024的时候,前一次read的byte同样会出现在byte[]中,从而导致XML解析失败。因此可以采用下面的方法:

 

 

BufferedInputStream buffInput = new BufferedInputStream(inputStream);

FileOutputStream fileOS = new FileOutputStream(targetFile);

BufferedOutputStream buffOS = new BufferedOutputStream(fileOS);

int word = 0;

while ((word = buffInput.read()) != -1){

buffOS.write(word);

}

 

 

 

1、进入在netbeans的安装目录;

2、定位到etc目录里

3、编辑找到netbeans.conf文件,把netbeans_jdkhome路径设置为当前JDK路径。

解决!

 

 

 

 

声明:

文章来自于ITeye,欢迎访问我的博客:xiaoyu1985ban.iteye.com

ITeye文章版权属于作者,受法律保护。没有作者书面许可不得转载。若作者同意转载,必须以超链接形式标明文章原始出处和作者。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值