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
24 public SingleTagSectionHandler()
27 // TODO: Add constructor logic here
32 /// Returns a collection of configuration section values.
34 /// <param name="parent"></param>
35 /// <param name="context"></param>
36 /// <param name="section">The name of the configuration section.</param>
37 /// <returns></returns>
39 public virtual object Create(object parent, object context, XmlNode section)
41 //FIXME: I'm not quite sure how to implement 'parent' or 'context'.
42 //TODO: Add in proper Error Handling.
44 //Get all of the ChildNodes in the XML section.
45 if(section.HasChildNodes)
47 throw (new ConfigurationException("Child Nodes not allowed."));
51 //Get the attributes for the childNode
52 XmlAttributeCollection xmlAttributes = section.Attributes;
54 Hashtable settingsCollection = new Hashtable();
56 for(int i=0; i < xmlAttributes.Count; i++)
58 settingsCollection.Add(xmlAttributes[i].Name, xmlAttributes[i].Value);
61 return settingsCollection;