This program realizes using DOM method to parse XML file from network side, display in list, and realize click to enter related page.
First we create a class that implements HTTP requests and the acquisition of XML file nodes, where the HTTP request is simple, passing a URL that is implemented in code through a method that
public string getxmlfromurl (string url) {
string xml = null;
try {
//defaulthttpclient
defaulthttpclient httpclient = new Defaulthttpclient ();
HttpPost HttpPost = new HttpPost (URL);
HttpResponse HttpResponse = Httpclient.execute (httppost);
Httpentity httpentity = httpresponse.getentity ();
XML = entityutils.tostring (httpentity, "Utf-8");
} catch (Unsupportedencodingexception e) {
e.printstacktrace ();
} catch (Clientprotocolexception e) {
E.printstacktrace ();
} catch (IOException e) {
e.printstacktrace ();
}
Return XML return
XML;
}