I am working on an app which reads an xml file generated on server and sync the local database on device.I am trying to construct a Sync Manager which hold all the fields available on the server and add these fields for sync like a shopping cart. And after adding all the fields Sync all the fields added to the cart.
I have three questions:
-
What would be the best method to do this?
-
Can i read a particular tag in xml without parsing the whole Xml file on server?
-
Condition for comparing fields on the local database?
I made something similar. I don’t know in which programming language are you programming but I am using QT. So I wanted to connect to database. I have made approach like this. Write SQL scripts that will handle your xml code. For example you want to return only certain part of database and not all of it. Then I have wrote PHP scripts as a middle tier part of and application, something to handle connection and sent certain post parameters that will tell me what to send back or what to do in database. Then I have made script to convert everything to XML and send it back to QT and represent data in my GUI. Using scripts while working with database is good because you can change it to any database you want. For example I have been using it for Oracle database. As oracle database for android doesn’t have automatic sync I have made my scripts to handle all that. I hope my example did help you to understand the approach that I have been using. I can’t say like 100% it’s correct way but it’s defiently working correctly for me. Good luck!