public object Create (object parent, object configContext, XmlNode section)
{
#if (XML_DEP)
XmlNode file = null;
if (section.Attributes != null)
file = section.Attributes.RemoveNamedItem ("file");
NameValueCollection pairs = ConfigHelper.GetNameValueCollection (
parent as NameValueCollection,
section,
"key",
"value");
if (file != null && file.Value != String.Empty) {
string fileName = ((IConfigXmlNode) section).Filename;
fileName = Path.GetFullPath (fileName);
string fullPath = Path.Combine (Path.GetDirectoryName (fileName), file.Value);
if (!File.Exists (fullPath))
return pairs;
ConfigXmlDocument doc = new ConfigXmlDocument ();
doc.Load (fullPath);
if (doc.DocumentElement.Name != section.Name)
throw new ConfigurationException ("Invalid root element", doc.DocumentElement);
pairs = ConfigHelper.GetNameValueCollection (pairs, doc.DocumentElement,
"key", "value");
}
return pairs;
#else
return null;
#endif
}