I know this is not exactly what you are asking, but since BrowserUK answered your question, I thought maybe you can give AppConfig a try. I use it for parsing/handling/writing config files in the ".ini" format, and it works great.
hope this helps,
Comment on Re: Handling different sections in config files