Using XML to write configuration files -- .INI like
Hello. I am writing an application that has several hardcoded directory paths. I would like to write a configuration utility to write an XML based INI file. This file would be read at the execution of the program and the variables initialized. Does anyone have a link to a good reference or thread. I would really benefit from seeing some code of an actual variable being initialized with data from an external file.
Thanks
brazilnut
Re: Using XML to write configuration files -- .INI like
Hi ...
I am a year late on this discussion ...
Why would you not use the registry to manage the application configuration infomration. This seems to be the standard with all the 'pro' apps !!??
I am working for a company and we have some apps (All Windows) that are MSVC 6.0 c++ and we are using the regsitry to store this stuff.
.NET is coming and we are starting to get some people that now want to store the app configuration in XML in a file.
I think there are many benefits to the regisry
- All data is saved in one location
- OS tool provided to edit and maintain data
- Data is typed defined (to some extent)
- Standard backup apps will back up the regsitry
NOW ... if I was creating an application that was going to run on Windows and Unix then I would use the XML as a configuration medium.
That is all.
Peace and Love,
Chris Macgowan
Voting for Kerry !!
-
I am working for a company
Re: Using XML to write configuration files -- .INI like
Registry used to be the best way to save configuration information but it does not work well w/ XCOPY deployment methodology of .NET application. In fact, the idea of .NET application is to be able to zip up 1 folder and extract it to another PC and it should work without any other installation steps to be taken. This also makes it easy to move the installation from one PC to another since you can just xcopy 1 folder and it will just work.
Another reason for XML formatted INI file is for interopability. You can write the same application for 2 diff OSes but use the same configuration module. This is still far-fetch since .NET framework is not available for other OSes yet but that does not stop you from writting the same application using a different programming language and still use the same configuration file.
File based configuration setting is much easier to manage then registry especially for remote management. Also, it allows you to store a lot more information which registry limits per key.
My 2 cents -