tags:

views:

61

answers:

1

i want to store my data (which i am gathering through my app) to xml and then send it to my webspace. How should i do it??

Thanks

+1  A: 

Your question contains several tasks.

Here is a solution for the upload part:

On sever-side you need to have a file-upload.

On iOS-side I suggest the usage of ASIHttpRequest

ASIFormDataRequest *request = [ASIFormDataRequest requestWithURL:url];
[request setFile:@"path/to/ur/xml" forKey:@"file"];

edit

Creating a (simple) XML-file should be quite easy, as it can be done just with String-operations.

  1. fill a (mutable) Array with the objects you want to write to the xml
    • let's say, you have a collected address book data. you filled the array with Contacts objects
    • each contact has n addresses, that are stored in an array, a name,...
  2. take the last object in the array
  3. write <contact name="%@"> to a string, with passing in the contacts name
  4. loop over the addresses and write <address kind="%@"> with specifying kind as "work", "private", "other"
  5. do similair with the address data (street, city,...)
  6. when done with a adress write </address>
  7. when done with a contact write </contact>
  8. remove last contact from array
  9. if the array isnt empty, start again with 2.
  10. wenn done with all data in the array, add <adressbook>in the beginning of the string and </addressbook> at the end.
vikingosegundo
It looks good man please have a look at my comments above if you can help
Ashutosh
If it looks good, it should worth an upvote (the top arrow). This doesnt mean you have to accept the answer.
vikingosegundo