Subject: Re: XML config file
To: NetBSD User-Level Technical Discussion List <tech-userlevel@NetBSD.org>
From: Jonathan A. Kollasch <jakllsch@kollasch.net>
List: tech-userlevel
Date: 07/23/2006 21:54:41
--neYutvxvOLaeuPCA
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable
On Sun, Jul 23, 2006 at 04:05:40PM -0400, Greg A. Woods wrote:
> At Fri, 21 Jul 2006 14:47:59 -0700,
> Jason Thorpe wrote:
> >=20
> > Perhaps I've simply grown so used to it... I now actively DISLIKE the =
=20
> > flat config files that BSD uses, because of their lack of structure :-)
>=20
Structure could be considered to be in the eye of the beholder. I already
have a good amount of mental investment in knowing the structure of
various unix configuration files. Given a blank file there is nothing
defining it's structure for you, you have to know the type of
syntax/structure that is expected.
>
> Perhaps the ability to represent deeper and tree-like structure and is
> nice, but XML (or anything SGML-related) really isn't the right answer
> for adding any kind of structure to any file format intended to be used
> by both humans and machine.
>
Well, termcap(5) is one of the least human-readable formats out there,
and has no place being used in as many places as it is. When I was thinking
about what an XML version would look like it got to be too much for me.
>
> Just because it's commonly used for such purposes doesn't make it right
> or good.
>
Look at Windows :) There they moved from .INI files to The Registry.
The Registry is the ultimate in non-human-readability, but it is perfectly
suited for having GUI front-ends to it.
>=20
> (the C-like syntax used by BIND and their ilk isn't really all that
> great either of course, though it's a damn sight better than XML)
There are a good number of files that I really like the "flat" format of.
The key/value(s) pair is one of the most simple syntax structures that exis=
ts,
and is well suited for many of the standard configuration files.
For example, were we to switch to an XML format, this is a bit of what
I've theorized that might look like.
hesiod.conf:
lhs=3D.ns
rhs=3D.kollasch.net
class=3DIN,HS
becomes
<?xml version=3D"1.0" encoding=3D"ISO-8859-1"?>
<hesiod_conf>
<lhs>.ns</lhs>
<rhs>.kollasch.net</rhs>
<class_list>
<class_item>IN</class_item>
<class_item>HS</class_item>
</class_list>
</hesiod_conf>
One of the worst examples I came up with was for /etc/shells,
a newline delimited list is one of the best structures for
a list of things. /etc/ttys also becomes a lot more complex.
Anyway, without structure, we wouldn't have configuration files
as we know them. At least no one has suggested using English
for these things :P
Jonathan Kollasch
--neYutvxvOLaeuPCA
Content-Type: application/pgp-signature
Content-Disposition: inline
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2 (NetBSD)
iD8DBQFExDZxOjx1ye3hmokRApT8AJ0aRxgg6IQtoddMSpmxXqsfP1/9EACglk9A
ot9aMjahqIIaOEneYNMnSZo=
=Zm02
-----END PGP SIGNATURE-----
--neYutvxvOLaeuPCA--