Here's how I would make it out. You can use it, but you will have to come up with an implementation for the Way class yourself! :)
List<Way> allWays = new ArrayList<Way>(); Way way; int eventType; while((eventType = parser.getEventType())!=XmlPullParser.END_DOCUMENT){ if(eventType==XmlPullParser.START_TAG) { if("nd".equals(parser.getName()) { way.addNd(parser.getAttributeValue(0)); } else if("way".equals(parser.getName()) { way = new Way(); } } else if(eventType==XmlPullParser.END_TAG) { if("way".equals(parser.getName()) { allWays.add(way); } } parser.next(); }
Of course, if the xml that suits you is even a little different, this exact code may not work. Again, I will leave this as an exercise for the seeker.
nicholas.hauschild
source share