Using openStream with a URL that has a subdomain with an underscore in it returns ioexception in Android. Why?

不羁岁月 提交于 2019-12-06 06:05:01

Valid host names can not contain an underscore ("_") so what you see is correct behavior.

After some more searching I found the MS hostnames can violate the standard. The only option I can think of is to find a DNS resolver that can handle an underscore in the hostname and use the IP address directly.

pointtofuture

you shoudle use :

InputStream in = Url.openConnection().getInputStream();
SAXParserFactory factory = SAXParserFactory.newInstance();
SAXParser parser = factory.newSAXParser();
RssHandler handler = new RssHandler();
parser.parse(in, handler);
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!