469,917 Members | 1,421 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,917 developers. It's quick & easy.

xml vs databases

I know that databases cannot be replaced by xml , and that they are complement to each other but I want to know if there are some cases or small applications where we need database but we can replace that by using xml only. If there is such cases please give me a small idea about that and what kind of applications can be done like that?
Feb 25 '06 #1
3 2493
Banfa
9,065 Expert Mod 8TB
XML is/was designed as a way of exchanging data rather than storing it for which you would use a database.

However if the amount of data involved was small or did not need to be searched then you could use XML. For storing data XML has the following disadvantages:

1. It is not a very efficient way of storing data, there is a lot of wasted data(or meta data) to carry the actual actual data, for instance to carry somes name and age a database would need a record may be 20 bytes long but you would be hard pressed to fit that data into an xml file of the same size.

2. It is not easily searchable since every record would have to be in a separate file so search a set of records for a field with a given value you would have to open and parse every file.

Where I have seen it in (games) applications is to define the screen layouts (I'm thinking EverQuest), this is a sort of database (of all program screens) however the records do not need searching and they are limited so the data in-efficiency is not a problem and it has the advantage of allowing the user to customise their interface (if they know xml).

I also imagine it could be used to record games levels in the right sort of game.
Feb 25 '06 #2
XML is

2. It is not easily searchable since every record would have to be in a separate file so search a set of records for a field with a given value you would have to open and parse every file.
Sorry, I don't agree with you on this..
Mar 1 '06 #3
Banfa
9,065 Expert Mod 8TB
Sorry, I don't agree with you on this..
That's because you are correct a single xml file could contain a number of records my mistake :)

However a database is optimised for searching (normally) where as data stored in an XML file is stored as text and searching is going to require parsing at least one file and will not be as efficient. Obviously for a low number of small records this overhead may not be significant.
Mar 1 '06 #4

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

2 posts views Thread by Gary L. Burnore | last post: by
8 posts views Thread by William Drew | last post: by
reply views Thread by Cara | last post: by
reply views Thread by Cara Altman | last post: by
3 posts views Thread by Amit | last post: by
6 posts views Thread by Tjerk Wolterink | last post: by
1 post views Thread by Waqarahmed | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.