However I think that I have refined the technique.
What I always wanted was direct read only XML access to the config section.
The following gives exactly what I want:
public class XmlNodeConfigSection : IConfigurationSectionHandler
{
public object Create(
object parent,
object configContext,
System.Xml.XmlNode section)
{
return section;
}
}
When registered as follows in app.config:
section name=”mysection” type=”mynamespace.XmlNodeConfigSection, myassembly”
Allows the following to return an XmlNode:
(XmlNode)ConfigurationManager.GetSection(“mysection”);
This will be null if the requested section does not exist.
You are free to use XPath expressions (&c) to get at the data!