如何在android平台开发期间将数据从我的资产目录中的xyz.xml复制到我的sqllite数据库
答案 0 :(得分:1)
像这样......
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();
答案 1 :(得分:0)
您可以使用:
XMLPullParser xpp = getResources().getXml(R.xml.id);