How to Parse XML Documents (Android)

  1. Install the latest android sdk
  2. Create an Android project
  3. Create classes called DownloadXMLAsyncTask.java and IDataChangedListener.java using the code from here in your Android Project.
  4. Modify the MainActivity for Andriod, similar to what you did for the iPhone here, but using the new DownloadXMLAsyncTask.java as a starting point
  5. You will need the following permission to your manifest file: <uses-permission android:name="android.permission.INTERNET" />

Here is come code to help initialize your parser

HttpURLConnection connection;
URL xmlUrl = new URL("http://www.w3schools.com/xml/cd_catalog.xml");
XmlPullParser receivedDataParser = XmlPullParserFactory.newInstance().newPullParser();
connection = (HttpURLConnection)xmlUrl.openConnection();
receivedDataParser.setInput(connection.getInputStream(), null);