Subject: Re: XML config file
To: Iain Hibbert <>
From: Jason Thorpe <>
List: tech-userlevel
Date: 07/21/2006 14:47:59
On Jul 21, 2006, at 1:46 PM, Iain Hibbert wrote:

> On Tue, 4 Jul 2006, Jason Thorpe wrote:
>> ...and we can do this now, with proplib.
> Ok, I've started using some proplib functions for passing  
> information to
> and from the kernel and I like it so far.  Is there a good reason  
> why we
> can externalize a dictionary but not an array? or in fact, why not  
> just
> prop_object_externalize() ?

Because I modeled this somewhat after the CFPropertyList /  
NSDictionary stuff in OS X.  Specifically, NSDictionary has - 
writeToFile:atomically:, which takes a dictionary and serializes it  
to an XML plist file, as well as +dictionaryWithContentsOfFile: and - 
initWithContentsOfFile:.  NSObject itself has no such method.

I would be happy to add internalize / externalize routines for  
prop_array_t (NSArray in OS X has similar methods to NSDictionary's  
serialization support), but I don't want to add generic  
prop_object_externalize() / prop_object_internalize() because it's  
rather important, I think, to explicitly state in the code which  
you're expecting and let the parser return an error when it gets the  
wrong one.

> As to the utility of using XML for config files, it is handy having  
> the
> internalize/externalize function and I am going to use that, but after
> having looked at the output, my opinion is that its not very human
> friendly at all so better suited for private database files rather  
> than
> configuration files.

Perhaps I've simply grown so used to it... I now actively DISLIKE the  
flat config files that BSD uses, because of their lack of structure :-)

-- thorpej