Home All Groups Group Topic Archive Search About

XML file vs Windows Registry

Author
19 Nov 2004 7:37 PM
Danny
Hi

I just have a quick question. One of our Windows based application
uses the registry for configuration type options and some other
things. I want to modify our application to move to use a XML file
instead of the registry. The other engineer argues that it is faster
and easier to manipulate the registry than File I/O operations with
the XML file.

I just wanted ask you guys what are the strengths and weaknesses with
using a XML file over the registry?

Thanks

Author
19 Nov 2004 10:35 PM
Dino Chiesa [Microsoft]
I generally prefer the XML file.


I have an custom config section handler in my asp.net app, derived from
Craig Andera's thing.
(see
http://integralpath.blogs.com/thinkingoutloud/2004/07/xml_serializati.html)

It is simple and easy to get config data via XML Serialization.

I also have some apps that use ONLY the registry for config data.  These are
usually self-configuring apps that require just the copy of the exe for
install.  They store state info in HKCU\\Software\\whatever.   I just don't
want the clutter of a file sitting in the filesystem.

The big drawback - the registry is harder for the end user to view and
manipulate than a simple XML file.


-Dino



Show quote
"Danny" <fernandez.***@gmail.com> wrote in message
news:dcb72385.0411191137.29402ffc@posting.google.com...
> Hi
>
> I just have a quick question. One of our Windows based application
> uses the registry for configuration type options and some other
> things. I want to modify our application to move to use a XML file
> instead of the registry. The other engineer argues that it is faster
> and easier to manipulate the registry than File I/O operations with
> the XML file.
>
> I just wanted ask you guys what are the strengths and weaknesses with
> using a XML file over the registry?
>
> Thanks
Author
20 Nov 2004 5:57 PM
Danny
Thanks Dino for the reply and URL link for the XML Serialization.

What about priviledges wouldn't that also be an advantage for using
XML over the registry? If my application wanted to write to the
registry wouldn't I have to elevate the privileges of my application
to write to the registry.

Danny


Show quote
"Dino Chiesa [Microsoft]" <din***@online.microsoft.com> wrote in message news:<e0bGkgozEHA.2016@TK2MSFTNGP15.phx.gbl>...
> I generally prefer the XML file.
>
>
> I have an custom config section handler in my asp.net app, derived from
> Craig Andera's thing.
> (see
> http://integralpath.blogs.com/thinkingoutloud/2004/07/xml_serializati.html)
>
> It is simple and easy to get config data via XML Serialization.
>
> I also have some apps that use ONLY the registry for config data.  These are
> usually self-configuring apps that require just the copy of the exe for
> install.  They store state info in HKCU\\Software\\whatever.   I just don't
> want the clutter of a file sitting in the filesystem.
>
> The big drawback - the registry is harder for the end user to view and
> manipulate than a simple XML file.
>
>
> -Dino
>
>
>
> "Danny" <fernandez.***@gmail.com> wrote in message
> news:dcb72385.0411191137.29402ffc@posting.google.com...
> > Hi
> >
> > I just have a quick question. One of our Windows based application
> > uses the registry for configuration type options and some other
> > things. I want to modify our application to move to use a XML file
> > instead of the registry. The other engineer argues that it is faster
> > and easier to manipulate the registry than File I/O operations with
> > the XML file.
> >
> > I just wanted ask you guys what are the strengths and weaknesses with
> > using a XML file over the registry?
> >
> > Thanks
Author
20 Nov 2004 6:36 PM
Lionel Fourquaux
"Danny" <fernandez.***@gmail.com> a écrit dans le message de news:
dcb72385.0411200957.6ba91***@posting.google.com...
> What about priviledges wouldn't that also be an advantage for using
> XML over the registry? If my application wanted to write to the
> registry wouldn't I have to elevate the privileges of my application
> to write to the registry.

No, you don't need special privileges to write to the registry. You do need
the correct permissions on the key you want to write to, in the same way you
need write permission on a file you want to write to. Registry keys under
HKCU will normally be writable by the user (while HKLM will usually not be
modifiable by a normal user).

Among the advantages of storing config data in the registry, I can see:
* smaller application footprint (no need to load an XML parser)
* simpler validation (registry values are typed)
* fewer possibilities of data corruption (values are accessed atomically).
There are counter-arguments for all of these. I think that low-level stuff
(services, system-wide parameters) should use the registry, while
user-visible configuration is better stored in files under the profile
directory.

AddThis Social Bookmark Button