There is an application that saves the text elements created in the application into a sqlite file, each of these elements can be sent via email as a pdf file. It is necessary to parse the sqlite file and separately pull out from it each created element (and an element that will still be created) in the xml file. For example, to get a picture, not plans.sqlite , but plans.sqlite , element1.xml , element2.xml ... "

PS: I found the NSXMLParser class in the NSXMLParser , which, as I understood, is responsible for this action, but did not find examples or explanations of step-by-step actions.

    3 answers 3

    NSXMLParser will not help you - this is a normal SAX parser and does not know how to write in xml. Honestly, I didn’t quite understand what you want - sqlite is the same database and you don’t need to parse it, you can safely access it using its api (I don’t know in the desktop mac, it appears in the iOS SDK as libsqlite3.dlyb) or some other add-in like CoreData, if I needed to overtake everything in xml, I would form it directly from the strings.

    • I understood about parsing. Well, how then is it possible to implement the formation of strings? Element in me consists of "name", "teacher", "class", below the tree structure already located coordinates on the graphs, etc. So, it is necessary for me to display separately all the elements "name", which will include all coordinates, "teacher", "class", etc. - Ascoron

    Make .dump data, then the data can be turned into XML - this is a question of technology, for example, you can use CDATA

      You should start with the question - what is a RDBMS in general, and SQLite in particular. Then you need to refer to the SQLite documentation . After that, the procedure will become clear to you, namely:

      1. get data from the database
      2. if necessary, process them accordingly
      3. generate xml

      This algorithm is very common, but from your question it follows that the problem is in your lack of understanding.

      • In fact, the question is a little different. Namely: In the iPhone App, the data created in the application are saved in separate pdf files that can be sent by email, etc. These Pdf files are saved in the general sqlite3 database and work only in one application. The customer’s task is to save each pdf file separately in xml and pdf files and they were still saved to the sqlite3 database, but when integrating with iTunes you could take one of these files and use it in the other app'e , but on another device. So I wonder how this can be implemented. - Ascoron
      • In any case, you need to work with sqlite through its api, you do not need to parse it. Its base is a kind of repository of anything with convenient access to individual elements, which can be sampled with sql queries ( query examples ) for various conditions. The documentation has it all. Code examples: one , two - dword