Thank you for your responses. This question, as naive as it might seem at first glance, was not so naive :)
Personally, I don’t like XML for configuration files, I find it difficult for people to read and modify, and for computers it is difficult to parse because they are so versatile and powerful.
INI files or Java-based files are great only for the most basic applications that require an attachment. General solutions for adding nesting to these formats are as follows:
level1.key1=value level1.key2=value level2.key1=value
not a pretty look, a lot of redundancy and hard to move things between nodes.
JSON is not a bad language, but it is designed for simple analysis of computers (this is valid JavaScript), so it is not wildly used for configuration files.
JSON is as follows:
{"menu": { "id": "file", "value": "File", "popup": { "menuitem": [ {"value": "New", "onclick": "CreateNewDoc()"}, {"value": "Open", "onclick": "OpenDoc()"}, {"value": "Close", "onclick": "CloseDoc()"} ] } }}
In my opinion, it is too cluttered with commas and quotes.
YAML is suitable for configuration files, here is an example:
invoice: 34843 date : 2001-01-23 bill-to: &id001 given : Chris family : Dumars
however, I don’t really like its syntax, and I think that using spaces to define areas makes things a little fragile (think about inserting a block into a different level of nesting).
A few days ago, I started writing my own language for a configuration file, I named it Swush .
Here are a few examples: as simple key-value pairs:
key:value key:value2 key1:value3
or as more complex and commented
server{ connector{ protocol : http // HTTP or BlahTP port : 8080 # server port host : localhost /* server host name*/ } log{ output{ file : /var/log/server.log format : %t%s } } }
Swush supports strings in simple form above or in quotation marks, which allows you to use spaces and even new lines within strings. I am going to add arrays in the near future, for example:
name [1 2 bc "Delta force"]
There is a Java implementation, but more implementations are welcome. :). check the site for more information (I covered most of this, but the Java API provides some interesting features, such as a selector).