By which cases storing data as XML is more suitable to RDBMS and why?

Are you able to give any example?


Without having much data and you are as a whole charge of it (no dependent 3rd parties), XML is a fairly option. Otherwise, RDBMS - see below for additional reasons.


If RDBMS is really a filing cabinet (drawers of same-sized records organized by some index) then XML is really a back-pack (not-always-organized bag of at random-sized records, may stand out in the corners).

Causes of XML

1) Versatility

In case your schema is either very loose or changes with time, XML is more suitable as versioning RDMS is difficult once there's data within it. In my opinion, XML Serialization, XSLT and XPath queries are resilient to alterations in the XML schema and could work with old/new customers. For instance, you can include newer and more effective elements right into a document as well as an older EXE that reads that document will just ignore individuals elements. An RDBMS query that does 'SELECT * FROM table' in which you just added a column may have undefined results.

2) Deployment

Easy - just ship your EXE.

3) Debugability

Simple to 'debug' the information - the XML might be human-readable already otherwise, XSLT could make it more readable.

4) Interoperability

You are able to hands the XML off and away to others and never care what platform/technology they will use.

Causes of RDBMS

1) Performance

For those who have lots of data, then your indexing options that come with a RDBMS provides you with best performance. Reading through a sizable XML (> 1000 records) is costly if you are essentially just looking for the record with ID=123, which RDBMS can perform inside a snap. Saved Methods will make this better still.

2) Security

You are able to secure areas of RDBMS through permissions - e.g. grant/deny Choose use of various customers.

3) Business Tools

You will find many RDBMS tools for items like OLAP and confirming.

When the data can naturally be referred to inside a tree like structure, XML might be OK. I'd should you prefer a lighter alternative, though. YAML and JSON are candidates.

I'd never favour storing many XML files price of data on the database anytime.

XML will work for readable and extension file formats - e.g. whenever you save within an application. XML is more suitable because it enables other people to make use of that extendable.

Another time XML is more suitable is perfect for configuration configurations. For instance, I perform a large amount of game programming and it might be madness personally to keep game play configurations inside a database. An XML (or any file for your matter) is a lot simpler.

However given records (data in records) for example items, or clients you'd be very wrong to favour something apart from a database to keep this data. Support, speed and scalability being three good examples why.

So the reply is - it is dependent.

You need to be the judge making the best call.

For an example:

"XML is much like tupperware. Should you went shopping and also got home, you actually could put the items inside a customized tupperware box, but in the finish during the day its most likely simpler simply to put stuff within the fridge."

XML has its own place though, when i menetioned above.

I'd be cautious because XML isn't a data hard drive. XML is really a meta-language, a language for creating languages. XML is often misused like a data hard drive, but that frequency doesn't provide credence to some faulty knowledge of we've got the technology.

I've heard somebody make an effort to argue this declaring that meta-language means a language of information about data, that is still not really a data hard drive. A language produced to represent an account upon the dwelling of information isn't a language from the data itself, even though a clear case of the word what might be a structure produced of information the word what is not.

In case your intent isn't to produce a language in order to represent a language for any class of information I wouldn't recommend using XML because is going to be bloated, slow, and you'll unlikely use the aiding technologies which make XML truly effective. As options others have pointed out YAML and JSON, that are substantially lighter. I would suggest trying among individuals. When the meta data, and it is structure/associations, is much more vital that you you compared to data itself i quickly would stick to XML because because the opportunity of processing and manipulation can be quite extensible.