XmlPullParser XML on Android

newsjour12

New Member
I'm trying to parse some XML from Android. Below is a bit of an example of the XML:\[code\]<updates at="1342481821" found="616" sorting="latest_updates" showing="Last 4D"><show> <id> 3039 </id> <last> -14508 </last> <lastepisode> -14508 </lastepisode></show><show> <id> 30612 </id> <last> -13484 </last> <lastepisode> 163275 </lastepisode></show> \[/code\]And so on....This is the actual code:\[code\]try { XmlPullParserFactory factory = XmlPullParserFactory.newInstance(); factory.setNamespaceAware(true); XmlPullParser xpp = factory.newPullParser(); URL url = new URL("http://services.tvrage.com/feeds/last_updates.php?hours=" + hours); InputStream stream = url.openStream(); xpp.setInput(stream, null); int eventType = xpp.getEventType(); while (eventType != XmlPullParser.END_DOCUMENT) { if (eventType == XmlPullParser.START_DOCUMENT) { } else if (eventType == XmlPullParser.END_DOCUMENT) { } else if (eventType == XmlPullParser.START_TAG) { if (xpp.getName().equalsIgnoreCase("id")) { showIds.add(Integer.parseInt(xpp.nextText())); } else if (eventType == XmlPullParser.END_TAG) { } else if (eventType == XmlPullParser.TEXT) { } eventType = xpp.next(); } }} catch \[/code\]... And so onThis gives no results, and \[code\]eventType\[/code\] is always \[code\]0\[/code\] in debugger. The example URL works fine in a browser. Any ideas?
 
Back
Top