“java.lang.NullPointerException”的最常见原因处理XML时? [英] Most common cause of "java.lang.NullPointerException" when dealing with XMLs?

查看:324
本文介绍了“java.lang.NullPointerException”的最常见原因处理XML时?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我最强的领导是处理传入XML的代码实际上是接收到一个无效/不完整的文件,因此导致DOM解析失败。任何建议?

解决方案

不完整的文件绝对是开始寻找的地方。我会在您解析之前打印出文件,以查看发送到解析器的内容。如果不完整,这将是显而易见的。如果无效,您将有一些小小的搜索。


My strongest lead is that the code who deals with the incoming XMLs is actually receiving an invalid/incomplete file hence failing the DOM parsing. Any suggestions?

解决方案

Incomplete file is definitely the place to start looking. I'd print out the file right before the point you parse it to see what's getting sent to the parser. If it's incomplete it will be obvious. If it's invalid, you'll have a little searching to do.

这篇关于“java.lang.NullPointerException”的最常见原因处理XML时?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆