Re: [OT] XML
On 11/27/2012 05:40 PM, Vincent Lefevre wrote:
> On 2012-11-26 20:32:17 +0100, olivier sallou wrote:
>> XML is nice for internal config, message/config exchanges, etc... help with
>> its structure and its DTD to force/help understanding the schema.
>> BUT definitely not useable by an end user for end-user config. It is very
>> hard to read (opening an XML with vi is a ass). Not everybody is using a
>> Desktop with editors etc...
> Emacs + nXML mode is quite fine to read XML file and it can run in
> a terminal (just like vi). Simple XML files are easily readable in
> general. Complex ones much less, but I doubt that a complex plain
> text based config file would be readable as well.
As I've been doing a bit of FreeSwitch configuration, I can tell that
XML are not practical at all, and abusing it is even worse. Telling
"oh, it's easy, just use emacs" isn't a viable solution (note everyone
likes / uses / knows emacs).
> No problems with Emacs. It tells you in real time whether the XML file
> is valid (by default, just well-formed) or not. And when there's an
> error, it can tell you where.
> Something I've never seen with plain text config files.
Plaintext (whatever that means...), probably not, but YAML and
the .ini format can both be validated with some tools. For example:
RET=$(python -c "import configobj
will do the necessary structure checks, and returns the value
of DIRECTIVE inside the SECTION of your FILE (thanks to lo-lan-do
for this example, which we use in the Openstack packaging btw,
as Openstack uses the .ini format which appeared very practical
and easy to hack).