android: dump data from local xml file to SQLite database
How can I copy my data from xyz.xml in my assets dir to my sqllite db during development开发者_开发技巧 in android platform
Something like this..
InputStream is;
Document dom = null;
is = getAssets().open("main.xml");
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
DocumentBuilder builder = factory.newDocumentBuilder();
dom = builder.parse(is);
Element root = dom.getDocumentElement();
You can use:
XMLPullParser xpp = getResources().getXml(R.xml.id);
精彩评论