Re: XML and Config files
"G. Wade Johnson" <[email protected]>
| Newsgroups | gmane.comp.lang.perl.xml |
|---|---|
| Message-ID | <20090320173129.73dd5580@sovvan> |
On Fri, 20 Mar 2009 10:37:56 -0600 "Wayne Simmons" <[email protected]> wrote: > Can anyone give a reason as to the recent OT discussion of "Don't use > XML for configuration." I don't understand why not, and we as a > company frequently do. XML is well formed, well known, with parsers > available in all major programming languages. > > Ini files are a Microsoft standard (that counts as a point to the > negative when developing in UNIX). They have very limited ability to > model complex and/or repeating values, and can end up being very long. > > Could anyone give me the other point of view on this? Agreed. I think the biggest argument against XML as a configuration format is the attitude that "since it's XML, it's automatically self-documenting". We've all seen examples of XML that are more unreadable that almost any other format. People also sometimes stuff more into an XML configuration file without thought of whether or not the user will be able to understand or modify the configuration. As with everything else, it is a matter of trade-offs. If you expect mere mortals to modify the configuration, you need to work at making it understandable. This sometimes means: * using simpler formats, * not nesting your XML too deeply, or * not using every XML feature in one file (optional elements, attributes, namespaces, etc.) Some systems require more complicated configuration than others. But, it's worth remembering that XML can quickly get out of hand, if you don't keep the users of the file in mind. In other words, if your configuration involves complex, nested objects, XML is probably a reasonable choice. If your configuration involves 5 named scalar values, INI or property files might be more appropriate. G. Wade -- Understanding is a three-edged sword. -- Kosh in "Deathwalker" _______________________________________________ Perl-XML mailing list [email protected] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs