tags:

views:

22

answers:

1
+2  Q: 

XML addressbook

What would an address book saved as an XML document need (name, address, email, phone number,...)? And what would be best practice to save pictures?

Should I save the XML files in an database? Or group everything in a zip file?

Any other thoughts?

A: 

What would an address book saved as an XML document need

I sense a danger of wheel reinvention: http://www.w3.org/Submission/vcard-rdf/

And what would be best practice to save pictures?

http://www.w3.org/Submission/vcard-rdf/#Bin also seems to be a solved problem

Should I save the XML files in an database? Or group everything in a zip file?

That depends what you are doing with the data.

As a rule of thumb, if you want a data store, use a database and not XML. XML makes a great transport mechanism, and document format, but a poor database.

David Dorward
Why is it a bad idea to use XML as a database?
Knarf
Because it is designed as a document format, not for random access.
David Dorward
But isn't a XML file more flexible? What if I want to save 3 URI's to different pictures, 1 address and a bio for one person, and then for another I want to save 1 home address, 1 work address and x phone numbers + emails. Wouldn't XML be better than a database then?
Knarf
Either way, you'll need the logic to process them. From an SQL point of view, you just have a person tale, a picture table, an address table and so on. Foreign keys are powerful.
David Dorward
But what if I suddenly decides that I want to save the blood type of everyone? Then I have to add a whole table, and link it all up. Wouldn't it still be more flexible with an XML file? And what about portability? An XML file is just an XML file and can be moved around across different applications (web, desktop and mobile), and different computers. And it's probably easier to make an application based on XML than some fancy database format?
Knarf
Blood type can probably live quite happily as a column in the main Person table. As for portability, I already said that XML makes a decent transport format.As for ease of use, XML probably has a lower barrier of entry, SQL has easier, powerful querying.
David Dorward