Question: XML vs A standard database?

Hey guys,

so I’ve started working on a project, a web application that in essence generates some ouput-data from data read from an OPC Server (used for process engineering optimization) and finally displays it to the user in different ways. Now, I’ve written the application in ASP.NET (C#) and I’ve reached the point where I’m ready to store my data… I’ve only ever worked with SQL variants (MySQL, SQL CE etc.) when working in ASP.NET but seeing as the data relatively limited, and doesn’t need to be saved for more than a few seconds before being updated - It seems a bit over the top to use a full Database?

My idea would then be to have a grid that is connected to a XMLDataSource (my .xml file) which is then updated once every few seconds from a backend method querying the OPC Server.

I’ve tried reading around on the net, but all I can seem to find is some people saying: "XML is not meant to be a replacement for a Database" and other people saying: “You shouldn’t use a full database if you don’t need it!” - So I’m kind of stuck in the middle there.

Have you guys got any experience with using an XML Document as a small Database/Cache? And can it handle being queried once every 4-5 seconds?

Hope this makes sense and that I haven’t completely missed the point of XML :slight_smile:

Thanks in advance,

Unless you plan on doing queries, eg. SELECT … WHERE etc. I wouldn’t think of it as a database but more as a data store.

IMHO nothing wrong with using XML for this, and you certainly wouldn’t be the first or only.

Another option could be a CSV file. Or maybe even a JSON object?

How much data are you planning to deal with? How often would it be doing a complete file rewrite as opposed to a single row/column UPDATE?

Hey thanks for your reply, I haven’t even thought of a JSON object, that’s another thing to consider!

As for the data amounts, they are relatively small. Currently the application is writing roughly 10 rows of data in a 8 column Gridview, and updating it once every 4-10 seconds depending on a user defined updaterate.

I’ve never even heard of CSV files, I’ll look into that!

Comma Separated Variables might be the way to go. Kind of like
Id, Name, Price
1, Bob, 1.23
2, Fred, 2.34
3, Tom, 3.45

Depending on what the data is you can specify different enclosures, delimiters and terminators.

I don’t know, but file rewrites every few seconds might be fastest with JSON. No particular reason for me to think this, just a hunch.

In any case, XML is more verbose though it can provide more control over the data.

And I’m wondering if using a database might just be faster and more efficient than files, though for that small amount probably not.

Sounds like testing might be in order before you commit.

Yep… A lovely way to spend an evening… Just tried it with a custom DataObject and a bit of Cache[var]… Definitely room for improvement :stuck_out_tongue:

I’ll check out JSON next, thanks for the reply again <3