jdom没有从url中获取任何内容

时间:2011-11-25 21:58:16

标签: java android xml-parsing jdom

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);
    Document doc = null;
    try {
        SAXBuilder builder = new SAXBuilder();
        Log.i("inside ","inside");
        doc = builder.build(new URL("http://www.rathbones.com/app/symbol.php?name=goog"));
        Iterator mainitr = doc.getRootElement().getChildren().iterator();
        while(mainitr.hasNext()){
            Element mainel = (Element) mainitr.next();
            Log.i("inside ","inside");
            Log.i("Element: ",mainel.getName());
        }
    } catch (Exception e) {
        Log.e("app", "getXMLForStockCode() > " + e);
    }
}

我收到此错误:getXMLForStockCode() > java.io.IOException: Couldn't open http://www.rathbones.com/app/symbol.php?name=goog

可能是什么问题?

0 个答案:

没有答案