Closed FLamparski closed 10 years ago
Well, everything I need for now should be complete. On to test...
Dumb XML is dumb
So -- har har -- using XPath on Android is a bloody joke. It goes into garbage collection pretty much ALL the time. I'm reimplementing this API using the Pull parser, which could take a while.
Hopefully the speed will be worth it.
In the meantime, enjoy:
while (event != XmlPullParser.END_DOCUMENT) {
switch (event) {
case XmlPullParser.START_TAG:
key = xpp.getName();
if (key.equals("Error"))
error = new NDE2Exception();
if (key.equals("Area"))
area = new Area();
break;
case XmlPullParser.TEXT:
value = xpp.getText();
if (key.equals("AreaId"))
area.setAreaId(Integer.parseInt(value));
if (key.equals("Name"))
area.setName(value);
if (key.equals("HierarchyId"))
area.setHierarchyId(Integer.parseInt(value));
if (key.equals("LevelTypeId"))
area.setLevelTypeId(Integer.parseInt(value));
if (key.equals("message"))
error.setNessMessage(value);
if (key.equals("detail"))
error.setNessDetail(value);
break;
case XmlPullParser.END_TAG:
if (xpp.getName().equals("Area"))
areaSet.add(area);
break;
}
event = xpp.next();
}
I blame the ONS.
DONE. For now.
Finish wrapping the Discovery API (skip the unnecessary methods)