I had a site where I was wanting to store some configuration data in web.config, but the problem is that the data was a little more complex than standard name-value pairs. As it turns out, this is a rather common problem, and is easily mitigated by building custom handlers to parse the sections. Some examples are here.
What I ended up doing was writing a handler to just pass back the XmlSection. Then it can be cast as an XmlNode, and you can use SelectNodes or any number of classes, like XPathNavigator or XmlTextReader, to parse it.
public class XmlSectionHandler : IConfigurationSectionHandler
{
public XmlSectionHandler(){}
public object Create(object parent, object configContext, System.Xml.XmlNode section)
{
return section;
}
}
It's not terribly unlike what this guy is doing, but he uses XmlSerializer to just deserialize the whole section so he doesn't even need to parse the XML.