2 // System.Configuration.SingleTagSectionHandler.cs
5 // Christopher Podurgiel (cpodurgiel@msn.com)
12 using System.Collections;
15 namespace System.Configuration
18 /// Summary description for SingleTagSectionHandler.
20 public class SingleTagSectionHandler : IConfigurationSectionHandler
23 public SingleTagSectionHandler()
26 // TODO: Add constructor logic here
31 /// Returns a collection of configuration section values.
33 /// <param name="parent"></param>
34 /// <param name="context"></param>
35 /// <param name="section">The name of the configuration section.</param>
36 /// <returns></returns>
37 public object Create(object parent, object context, XmlNode section)
39 //FIXME: I'm not quite sure how to implement 'parent' or 'context'.
40 //TODO: Add in proper Error Handling.
42 //Get all of the ChildNodes in the XML section.
43 if(section.HasChildNodes)
45 throw (new ConfigurationException("Child Nodes not allowed."));
49 //Get the attributes for the childNode
50 XmlAttributeCollection xmlAttributes = section.Attributes;
52 Hashtable settingsCollection = new Hashtable();
54 for(int i=0; i < xmlAttributes.Count; i++)
56 settingsCollection.Add(xmlAttributes[i].Name, xmlAttributes[i].Value);
59 return settingsCollection;