0

I have some sort of simple mobile shopping section inside my app. I get XML or JSON from server and want to put name/description/price/currency/etc to corresponding views. I really don't want to parse all XML myself and prefer to use some syntax like ["products.product.price" -> R.id.priceTextView] to map xml/json data to Android views.

I googled a little bit but failed to find a good way to do this. Do anybody know some lib or maybe Android class doing that?

Alexey
  • 73
  • 7
  • If you can implement it from the JSON response, check http://stackoverflow.com/questions/21480634/unable-to-loop-through-dynamic-json-string-recursively-in-android/21480997#21480997 – Pararth Feb 01 '14 at 09:21
  • Initial was to make it without Java object in between but still works. Thanks! Any ideas about xml? – Alexey Feb 01 '14 at 09:28
  • Not used xml with mapping or for an android class doing that, but maybe this can help & chose the parser for your implementation.. http://www.mkyong.com/java/how-to-read-xml-file-in-java-dom-parser/ http://www.mkyong.com/java/how-to-read-xml-file-in-java-sax-parser/ – Pararth Feb 01 '14 at 09:44
  • Thanks but I know how to parse xml, I just don't want to do it myself :) That generates lots of ugly code. – Alexey Feb 01 '14 at 09:47
  • :) Yes, i figured you'l know that. I checked up gson and xml and found these two links: https://github.com/stanfy/gson-xml https://groups.google.com/forum/#!topic/google-gson/ncWGLyEEU5M Not to sound obssessed with gson but just as i don't know other ways for mapping that way in/from xml – Pararth Feb 01 '14 at 09:53

0 Answers0