App.Config and XMLDocument

  • Thread starter Thread starter ryanbreakspear
  • Start date Start date
R

ryanbreakspear

Hi All,

I've created a class for reading from the App.Config which implements
IConfigurationSectionHandler. I want the Create() to return an
XMLDocument something like:

public object Create(object parent, object ConfigContext, XmlNode
section)
{
XmlDocument XmlDoc = new XmlDocument();
XmlDoc.ImportNode(section,true);
return(XmlDoc);
}

I've tried a few variations on the above but the returned XmlDoc never
has any child nodes. Any ideas?

Thanks in advance.

Ryan
 
Ok, it turns out the following code sort of works:

XmlDocument XmlDoc = new XmlDocument();
XmlNode NewNode = XmlDoc.ImportNode(section, true);
XmlDoc.AppendChild(NewNode);

The child nodes are still not being copied properly though, the
attributes don't seem to be there. Any ideas?
 
Back
Top