【发布时间】:2016-07-29 18:10:26
【问题描述】:
我正在尝试使用 jdom-2.0.6.jar 从 URL 解析 xml,但我得到 IOException:
IOException: Couldn't open "here is xml link"
我在做什么:
import org.jdom2.Document;
import org.jdom2.Element;
import org.jdom2.JDOMException;
import org.jdom2.input.SAXBuilder;
String myurl = "https://myfile.xml";
SAXBuilder builder = new SAXBuilder();
try {
Document document = builder.build(myurl);
Element rootNode = document.getRootElement().getChild("myroot");
} catch (IOException io) {
Log.d("IOException", io.getMessage());
} catch (JDOMException jdomex) {
Log.d("JDOMException", jdomex.getMessage());
}
相同的代码在 Eclipse 中运行良好,但在 Android Studio 中却不行。那么有什么问题呢?
【问题讨论】:
标签: java android xml eclipse jdom-2