I have this xml file:
<?xml version="1.0" encoding="UTF-8"?>
<Favorites>
<favorite id="1">
<title>My first favorite</title>
<latitude>31.369834</latitude>
<longitude>34.798207</longitude>
</favorite>
</Favorites>
and I want to write more “favorite”s into it.
I have all the data I need as strings in my project.
But I can’t figure out how to really do it – although I have tried a lot.
can you please help me do it ?
thanks.
I agree with the responders that you should consider using a .plist file. Creating NSDictionary objects of your “Favorite” objects, and saving the array of them.
But, to your immediate question, you could save a NSString representing your XML like this (but again, saving a string based XML means a lot of parsing and interaction methods created by you):
Hope that at the very least gets you towards where you’re headed.