Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why use XML as a storage format? [duplicate]

Possible Duplicate:
When is it OK to use an XML file to save information?

What's up with everything using XML as a storage format for configuration files such? I'm asking because [name retraced] framework has an XML configuration file to store database credentials, and the particular application that's built upon the framework has some menus stored as an XML fragment in a database... it's not like we'd share database credentials or or menu structure with others, or even data that would be consumed by multiple services. It's all internal/specific to this app. A coworker said that XML is an easily-readable format for humans... but I don't think that's true. password foobar123 in an INI file is easier for a human to read than <password>foobar123</password>. Then he said about parsing, but INI files have been around for ages so I'm sure there's a library or two for parsing them. I could see the logic behind using it as a data export method, because then whatever the app produces can be consumed by other services in a straightforward manner, but for internal stuff I just don't get it. Someone please enlighten me.

like image 451
Lucas Avatar asked Aug 11 '26 08:08

Lucas


1 Answers

I won't tackle your general question (I'm not a huge XML fan myself), but I will comment on your comparison of INI and XML files.

XML is good at describing arbitrarily structured data (trees, etc.). INI files best described categorized dictionary type data (key, value pairs). For the specific example you gave of a menu system, XML is a much better bet as it can reflect the menu tree directly.

like image 75
Drew Hall Avatar answered Aug 13 '26 22:08

Drew Hall



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!