try This
try {
InputStream mInputStream = getAssets().open("XmlData.xml");
XmlPullParserFactory xmlFactoryObject = XmlPullParserFactory.newInstance();
XmlPullParser myparser = xmlFactoryObject.newPullParser();
myparser.setInput(mInputStream, null);
int event = myparser.getEventType();
while (event != XmlPullParser.END_DOCUMENT) {
String name=myparser.getName();
switch (event){
case XmlPullParser.START_TAG:
break;
case XmlPullParser.END_TAG:
if(name.equals("page")){
Log.e("TAG",""+ myparser.getAttributeValue(null,"id"));
Log.e("Page content ",""+ myparser.getAttributeValue(null,"text"));
}
break;
}
event = myparser.next();
}
} catch (Exception e) {
e.printStackTrace();
}
2
solved how can parse this xml file? [closed]