Hello Flavio, On 24/03/2011, at 11:53, Flavio Donadio wrote:
> I am late in this thread, but I don't understand why you need import/export. > Is it just meant for backup purposes or is it a facility for the users to get > data from other applications into yours (and out of it)? I've clarified that in another message I think, sorry. I should have included it in the main message; anyway, the export will be a facility for backing up the database and sharing it with other users. > > If it is the second case, why not stick with "delimited text" or "CSV-style" > files? > > XML is not easy to edit for the average user, although it sure is > human-readable. Yes, I'm aware of that, but editing is not obligatory. I'm just providing an extra feature for the user who knows what is a XML and thus wants to edit it. > CSV, on the other hand, is pure text and can be imported by Excel, Numbers or > any other spreadsheet app. Users could get data from others sources (HTML > tables, SQL databases, spreadsheets, whatever...) into your app and out of it. > > I do this a lot: select table contents in web page, copy and paste into > Numbers. I can delete some unneeded rows and columns, export into CSV and > then insert into a database, for example. PHPMyAdmin can generate and import > CSV files. CSV is not something I had thought about, but maybe it could be included in the app for convenience. Thanks for the idea. > > When validating aCSV file for importing, if a line does not conform to a > pre-defined format, you'll have to drop it. You can always show a dialog at > the end of the process that says something like "Some lines could not be > imported." and generate a report in a file for the user to see which lines > were dropped. > > If you go the XML route, I am almost sure you'll need a DTD for validation. Yes, I'll have to do it. I think XML is the path to follow. > > I hope it helps... Certainly Sir! Thanks for providing your opinions and help, Best wishes, Siegfried > On 23/03/2011, at 21:55, Siegfried wrote: > >> Hello, >> >> I need to create an export / import system for my app, and just thought that >> asking the list for some advices could help a lot. >> >> The CoreData database I have is fairly simple. No relationships, only 3 >> entities with no more than 4 properties each: numbers and strings. So I >> think exporting this as XML is the more appropriate solution. Also, it would >> allow users make changes in the file easily. >> >> Are there any serious drawbacks from using this method? Or may a better >> solution? What worries me most is the XML validation. It's not a high >> priority, but having an at least decent XML is worthwhile. The big question: >> A header saying XML version 1.0 is enough? Or do I need to create a DTD? >> >> Also, now on the mechanics, I think creating a mutable string and go >> appending parts of the XML in a loop is adequate for this task, and using >> NSXMLParser to parse it back should work. Indeed, the file will not be that >> big (usually a few hundreds of KBs, really extremes cases are 1 or 2MB). >> Well, at least I'm not aware of a framework to export / import CoreData, I >> don't even think it is possible. >> >> Any "yes" or "no" on my ideas are really appreciated. >> >> Thanks, >> >> Best wishes, >> >> Siegfried > _______________________________________________ Cocoa-dev mailing list ([email protected]) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [email protected]
