using System;
using System.Collections;
using System.Xml;

namespace Microsoft {

	class PollDetails {

		string name;
        string connectionAppSettingKey;
		string question;
		SortedList choices = new SortedList();

		public string Name {
			get {
				return name;
			}
		}

        public string ConnectionAppSettingKey {
            get {
                return connectionAppSettingKey;
            }
        }
            

		public string Question {
			get {
				return question;
			}
		}

		public SortedList Choices {
			get {
				return choices;
			}
		}

		public PollDetails(XmlDocument dom) {

			XmlNode navigationNode;
			XmlNodeList choicesNodeList;

			// Explicitly bind to the Root Node and get attributes
			//
			navigationNode = dom.SelectSingleNode("Poll");
			this.name = navigationNode.Attributes["name"].Value;
			this.connectionAppSettingKey = navigationNode.Attributes["connectionAppSettingKey"].Value;

			// Get the text for the Poll Question
			//
			question = navigationNode.SelectSingleNode("Question").InnerText;

			// Bind to the Choices node and a Node Collection
			//
			choicesNodeList = navigationNode.SelectSingleNode("Choices").ChildNodes;

			// Walk through each node in the Node List and add to Array List
			//
			foreach (XmlNode node in choicesNodeList)
				choices.Add(node.Name, node.InnerText);

		}

	}
}
