0

I have XML code (data form database) and I would like to move this data from XML to something like cursor or arraylist. It is possible? How to do that?

user1019901
  • 561
  • 3
  • 5
  • 11
  • There's a lot of XML parsing API's available and I think the JDK itself has one built-in. Just Google it! You could build your own too it's not that difficult except when it comes to non-standard input. – ADTC Oct 25 '12 at 18:21

2 Answers2

0

Since you'll likely know the structure, it seems you could use XStream.

similar question: How do I convert XML into a java value object?

Community
  • 1
  • 1
ChrisThompson
  • 1,998
  • 12
  • 17
0

There's a lot of libraries in Android you can use, plus a lot of external XML libraries. XML Pull Parser and SAX Parsers come with Android, at least from 1.6 as far as I know. XML Pull parser is more C-like, while SAX parser is more Java-like. There's also the DOM parser.

I ended up using the SAX parser for one project, and I used a Stack in order to keep track of where I am in the XML tree.

Joe Plante
  • 6,308
  • 2
  • 30
  • 23