There are two ways to write configuration files. There is the simple way used by nearly all linux/unix apps, and most Java developers:
#this is a config file
key1 = value1
key2 = value2
key3 = value3 #comments can go here
Then there is the crazy XML way that seems to be the preferred .NET method:
<?xml version="1.0" encoding="utf-8"?>
<add key="key1" value="value1" />
<add key="key2" value="value2" />
<add key="key3" value="value3" />
<!-- comments are not fun at all -->
I don’t know about you, but personally I think the first format is clear, concise, easy to read, easy to edit, and easy to document with inline comments. The second one is none of the above.
Both are easy to parse – especially since you will rarely need to do it by hand, as most environments provide classes that will do this for you. Maybe I’m old school but I think that simplicity of the non-xml config outweighs any potential benefit of using the xml markup.
At the end of the day most configuration files are just simple lists of key and value pairs. You don’t need XML’s tree structure to represent that. Very rarely do these pairs need to be ordered in a specific type of hierarchy that would warrant the use of XML.
For me, using xml for your config files is just meaningless overhead. Same information could be stored in a simple delimited text file. Of course if your platform has a built in support for XML config files, then that’s probably what you should use. But given a choice, without platform support for either format I would always pick simple text over XML.
How about you? Do you believe in XML config files?
[tags]xml, config, config files, configuration, configuration files[/tags]