Android dom 解析器错误
我在解析 xml 时遇到一个特殊问题,因此解析器工作正常,直到遇到
static final String ImageHotel = "Url";
...
else if (name.equalsIgnoreCase("ImageHotel")){
message.setHotelImage(property.getFirstChild().getNodeValue());
if (!marchand.getImgHtlUrl().equalsIgnoreCase("")){
message.setHotelImageLink(new URL(marchand.getImgHtlUrl() + property.getFirstChild().getNodeValue()));
}else{
message.setHotelImageLink(new URL("http://localhost/noimage.jpg"));
}
}
即使我尝试用 try/catch 绕过它,这也会不断抛出错误。
欢迎任何帮助,
谢谢。 侯赛姆.
I'm facing a particular problem while parsing xml so the parser works fine until it encouters <Url/> tag which contains no value, I already made the test il my code :
static final String ImageHotel = "Url";
...
else if (name.equalsIgnoreCase("ImageHotel")){
message.setHotelImage(property.getFirstChild().getNodeValue());
if (!marchand.getImgHtlUrl().equalsIgnoreCase("")){
message.setHotelImageLink(new URL(marchand.getImgHtlUrl() + property.getFirstChild().getNodeValue()));
}else{
message.setHotelImageLink(new URL("http://localhost/noimage.jpg"));
}
}
This keep throwing error even when i tried to bypass by surrounding with try/catch..
any help is welcome
thanks.
Houssem.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我参考解析此文件尝试添加您自己的数据并获取标记值...
NewsBeen 类是::
public class NewsBeen {
}
I have reference to parse this file try to add your own data and get tag value....
The NewsBeen class is::
public class NewsBeen {
}
我告诉过你用 try/catch 包围不起作用,所以,现在它起作用了,因为我必须跟踪 NullPointerException 而不是简单的异常,就像这样:
谢谢你们,对这个警报感到抱歉;)
I told you that surrounding with try/catch did not work, so, now it does, because i had to track the NullPointerException instead of simple Exception, like this :
thank you guys and sorry for this alert ;)