0
家伙,我有一个URL一个xml,我需要解析XML解析XML
下面是我的XML
这是怎么了我解析
InputStream in = new FileInputStream(file);
builder = DocumentBuilderFactory.newInstance().newDocumentBuilder();
doc = builder.parse(in, null);
NodeList audio = doc.getElementsByTagName("point");
int len = audio.getLength();
Toast t = Toast.makeText(getApplicationContext(), "Length is "+len, 0);
t.show();
for (int i = 0; i < len; i++) {
Node singleTerminalNode1 = audio.item(i);
Element secondlevel = (Element)singleTerminalNode1;
NodeList value2Nodes = (secondlevel).getElementsByTagName("file");
String audioxml = ((Element)value2Nodes.item(0)).getAttribute("name");
System.out.println("got the value from audioxml "+audioxml);
Toast toast = Toast.makeText(getApplicationContext(), "Downloaded to Sdcard/varun/"+audioxml, 0);
toast.show();
}
但我需要从URL解析如何改变这个
我应该通过url.openStream();您的InputStream中的 – Goofy 2012-03-01 08:31:15
:InputStream in = url.openStream() – Thommy 2012-03-01 08:39:46