In my xml file I have two or more parent nodes like:-
//parent node pizza //attributes are 1 Veg Pizza
//parent node burger
carrier.xml ile contains below xml contents
// In your code
XmlPullParser xpp=null;
int eventType = 0;
XmlPullParserFactory factory =null;
BufferedReader bufr=null;
StringBuilder total ="";
try{
bufr = new BufferedReader(new FileReader("/carrier.xml"));
total = new StringBuilder();
String line="";
while ((line = bufr.readLine()) != null)
{
total.append(line);
}
factory = XmlPullParserFactory.newInstance();
factory.setNamespaceAware(true);
xpp = factory.newPullParser();
xpp.setInput(new StringReader(new String(total)));
eventType = xpp.getEventType();
}catch(XmlPullParserException e){
// Log.v("xmlpullparser"," "+e);
e.printStackTrace();
}catch(IOException ie){
// Log.v("IOException"," "+ie);
ie.printStackTrace();
}
try{
while (eventType != XmlPullParser.END_DOCUMENT){
if(eventType == XmlPullParser.START_TAG){
String Scid="",Scname="";
int acount=xpp.getAttributeCount();
if(acount!=-1){
for(int x=0;x