xml - Android : Parse using xmlpullparser -
i have xml file in location res/xml/data.xml need parse xml file xmlresourceparser xrp=context.getresources().getxml(r.xml.data); i used code file. returns xmlresourceparser tried xmlpullparser xmlpullparserfactory factory = xmlpullparserfactory.newinstance(); factory.setnamespaceaware(true); xmlpullparser xpp = factory.newpullparser(); i not getting clear idea between these 2 parser. question how parse xml file in resource folder using xmlpullparser ? xmlresourceparser interface extends xmlpullparser . getxml wil return xmlresourceparser object. can read parser text similar how parse input stream or string using xmlpullparser here sample code parse resource xml try { xmlresourceparser xmlresourceparser = getresources().getxml(r.xml.data); int eventtype = xmlresourceparser.geteventtype(); while (eventtype != xmlpullparser.end_document) { if (eventtype == xmlpullparser.start_document) { system.out.pr...