Web Development

General discussion


INI vs. XML for config info

By JeriMorris ·
I'm writing a DLL that runs on a web server as part of a web-based application. The DLL has a handful of global application configuration parameters, and I'm trying to decide whether to store them in an INI file or an XML file. (I had considered using the Registry, but there's enough negative feedback on the Registry that I've decided against using it.)

My primary criteria for determining the "best way" to store the config parameters is that it must be easy for the average IT engineer to read and modify the values of the parameters.

The ease of writing code to read the config parameters is *not* a consideration for me--it'll be roughly the same degree of difficulty to use with INI or XML formats.

Thanks in advance for your comments.


This conversation is currently closed to new comments.

Thread display: Collapse - | Expand +

All Comments

Collapse -

Suggest INI format

by tehilinski In reply to INI vs. XML for config in ...

The INI format is hierarchical, can contain comments, and so can be self-documenting. These files are easily edited in any text editor. There are a couple of sourceforge projects that provide libraries to R/W INI files. (www.sourceforge.net).

XML can be a pain to edit by hand. Because of the awkwardness of hand-editing, it is more susceptible to errors introduced by the editor.

Collapse -

Re: Ini vs. Xml: reconsider registry

by fastluck In reply to INI vs. XML for config in ...

I would reconsider using the Registry. I don't know what unfavorable feedback you get on the registry. But considering your primary criteria, easy to read/modify parameters:

Ini files are fairly easy to read and modify. But since they're set up in a Property=Value configuration, it's fairly easy to make mistakes. That's even worse with XML, as another poster already stated. Embedded tokens have to be right in at least two places, along with having the right keyword.

In the registry, if the keyword exists, you only have to deal with setting the value. And if your code knows how to deal with "true", "TRUE", "True" and 1, it's unlikely that those doing the setting will make a mistake.

In the project I'm working on now, I have an initialization class containing all globally settable properties. In its create method, all properties are set in the registry. Whenever a new property is added, it's also added in the create method. When another developer or user needs to set something, I know that if the application has ever run there's already a placeholder for it in the registry. It's simple to tell them where it is and how to set it. And everyone has regedit.exe on their machine.

There's another benefit. You can set whether your settings are global to the machine, or local to the user. (HKEY_CURRENT_USER vs. HKEY_LOCAL_MACHINE). Some settings may change by user, some may not. Using an INI or XML file, storing data this way becomes more complicated.

I hope this helps.



Collapse -

INI vs. XML for config info - one additional factor

by JeriMorris In reply to INI vs. XML for config in ...

Thank you for the replies so far!

Let me add one more fact to the mix. I'd like to use a method (INI, XML, or Registry) that other server-based, IT-managed applications use, and that IT organizations are most likely to be comfortable with.

I should also mention that since this application runs on behalf of IIS, its configuration parameters aren't user-specific. If I were to use the Registry, for example, I wouldn't use HKEY_CURRENT_USER, since the parameters don't vary from user to user. Since the config parameters are server-wide, I'd use HKEY_LOCAL_MACHINE instead. (IF I used the Registry, which is still a big "if.")

Thanks again,


Collapse -

INI vs XML vs Registry

by samarel In reply to INI vs. XML for config in ...

personaly I don't like people manipulating the registry in the server (small mistake=big trouble)
INI is fine but i would choose XML
if you are developing for .NET then you will find
a lot of features that can help you editing, reading and caching data from the XML file.

Collapse -

It Depends

by ezann In reply to INI vs XML vs Registry

If I had just a few clearly identifiable params then I would choose INI because its simple and more easily edited by a Notepad type program.

If I had many params with arcane names I might consider XML because verbose comments can be included in the XML format to assist the user.

Related Discussions

Related Forums