Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why is XML good for data files? [closed]

Tags:

xml

Recently the research group I have been working in have been working on some simulation codes.

For the codes we have the main C++ files containing the code, a text file containing input parameters for the simulation. The data of the simulation at every time step is spitted out in the form of columnar data where each column representing some physical quantity position, pressure, etc. and each row represents a grid point.

My boss has now asked me to switch the data format of the input-parameter-file and output data files to the XML format from its present key-value , key-value nature. He seems to be very poor at his explanations since his English pretty much sucks. Its been two times now that he ranted about the superiority about XML without me understanding a word.

Now, Let me say I am just your average C / C++ / Python programmer interested in scientific computing, and I have no back-ground in Computer Engineering subjects like databases or web development that XML seems to be used most in.

Can anyone give me a short explanation of this or else point me to some resources which offer a gentle explanation of the concepts with simple yet non-trivial examples without all the yoga, chanting, incense burning , and ugly technical vocabulary (which keep requiring me to do endless googling) that all the XML tutorials seem to be filled with.

If someone can give some explicit real-life examples of where and how the XML data format is used in some applied mathematics codes that will really be helpful.

like image 860
user1420548 Avatar asked May 27 '12 20:05

user1420548


1 Answers

Briefly, XML offer the ability to be interoperable with a wide variety of software, since XML data can be exchanged by using the XML language.

For example, the same data can be included in an HTML page for display, or can be read "as is" by other application aware of the data schema (XML schema), or can be transformed in any text format by using XSLT. (i.e. XML to CSV).

In conclusion, XML can be ported more easily than any other data format.

Of course this is not the only benefit of using XML for data: XML can validate a document against its schema (for correctness), the data can be queried with a declaration language (XPath).

A disadvatage of XML, for application that requires/produce lots of data is that XML is verbose (w.r.t. any binary data format): think how to save an image, for instance, in XML... That would be cumbersome... Of course you can include binary data in the XML document (by using base64 encoding), but in this cases (where most of the data is stored in base64) it make no sense to use XML.

like image 114
Luca Avatar answered Dec 01 '22 01:12

Luca