0

How can I copy my data from xyz.xml in my assets dir to my sqllite db during development in android platform

2
  • 1
    I think you need to write some class or method that will do that import for you. No one knows how the XML tags map to your database structure but you. Commented Aug 11, 2010 at 12:55
  • I'm looking for code to parse the xml data. the tutes are for rss feeds from the internet but i couldn't find any tutes to do the parsing from local xml file Commented Aug 11, 2010 at 17:31

2 Answers 2

1

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();
Sign up to request clarification or add additional context in comments.

Comments

0

You can use:

XMLPullParser xpp = getResources().getXml(R.xml.id);

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.