[user]
login: zipi
realm: zape
[server]
ip: 192.168.0.127
port: 11811
# here we allow the whole class C subnet except the gateway
auth_ips: 192.168.0.*, -192.168.0.1
with:
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE config-file SYSTEM ""
"http://localhost/devel/XML/DTDs/config-file_1_3.dtd">
<config-file>
<user>
<login value="zipi"/>
<realm value="zape"/>
</user>
<server>
<ip value="192.168.0.127"/>
<port value="11811"/>
<!-- here we allow the whole class C subnet except the gateway -->
<auth_ips value="192.168.0.*, -192.168.0.1"/>
</server>
</config-file>
And now parse that. I chose a deliberately easy to follow (ficticious) DTD. The first one can be read in every machine where ASCII/ISO-Latin-1 has any meaning (and probable in those with EBCDIC as well, with some care) and processed with a simple while bucle and a split/:/ and a couple of chomps, detecting the [] sections to put the data in the hash correctly. The XML one needs a dedicated parser, and then the user is forced to walk up and down the tree to get the values.
Now try to edit that by hand. It's easy, right? After all it's just an example. Now let's take something more, mmm, fleshy, like sendmail's config file. Make XML of that and try to understand it! (it's hard enough as it currently is...)
XML is okay for OpenOffice document processor format, but config files should be parseable with just VI (your system may be down and down to the bare minimum when you have to remotely solve an incidence at 3am). No XML at 3am, please. Actually no XML config.
Hope I've presented my case more clearly now.... Best regards,
-- our $Perl6 is Fantastic; |