Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re: Re: Re: Configuration File

by kral (Monk)
on Jul 15, 2003 at 09:41 UTC ( [id://274329]=note: print w/replies, xml ) Need Help??


in reply to Re: Re: Configuration File
in thread Configuration File

I deeply dislike XML for configuration files. Unless your configuration data is extremely complicated, with deeply nested environments, you don't need XML at all; and if so, why are you using such a complex configuration anyway?

XML files are complicated if YOU make it complicated. Imho, it's the best way to make a portable config file. Parser for xml exists for almost every language. And it is also much fessibile. Change from a simple configuration to a more complex one is a joke with xml. I can't say the same thing for the ini files.

----------
kral
(sorry for my english)

Replies are listed 'Best First'.
Re: Re: Re: Re: Configuration File
by Excalibor (Pilgrim) on Jul 15, 2003 at 10:14 UTC

    okay, let's compare:

    [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;

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://274329]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others studying the Monastery: (5)
As of 2024-04-19 05:55 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found