internal ServiceDescriptionDocument(XmlDocument Xml, UPnPClient Client, UPnPService Service)
        {
            List <UPnPStateVariable> Variables = new List <UPnPStateVariable>();
            List <UPnPAction>        Actions   = new List <UPnPAction>();

            this.xml     = Xml;
            this.service = Service;

            if (!(Xml.DocumentElement is null) && Xml.DocumentElement.LocalName == "scpd" &&
                Xml.DocumentElement.NamespaceURI == "urn:schemas-upnp-org:service-1-0")
            {
                foreach (XmlNode N in Xml.DocumentElement.ChildNodes)
                {
                    switch (N.LocalName)
                    {
                    case "specVersion":
                        foreach (XmlNode N2 in N.ChildNodes)
                        {
                            switch (N2.LocalName)
                            {
                            case "major":
                                this.majorVersion = int.Parse(N2.InnerText);
                                break;

                            case "minor":
                                this.minorVersion = int.Parse(N2.InnerText);
                                break;
                            }
                        }
                        break;

                    case "actionList":
                        foreach (XmlNode N2 in N.ChildNodes)
                        {
                            if (N2.LocalName == "action")
                            {
                                UPnPAction Action = new UPnPAction((XmlElement)N2, this);
                                Actions.Add(Action);
                                this.actionsByName[Action.Name] = Action;
                            }
                        }
                        break;

                    case "serviceStateTable":
                        foreach (XmlNode N2 in N.ChildNodes)
                        {
                            if (N2.LocalName == "stateVariable")
                            {
                                UPnPStateVariable Variable = new UPnPStateVariable((XmlElement)N2);
                                Variables.Add(Variable);
                                this.variablesByName[Variable.Name] = Variable;
                            }
                        }
                        break;
                    }
                }
            }
		internal ServiceDescriptionDocument(XmlDocument Xml, UPnPClient Client, UPnPService Service)
		{
			List<UPnPStateVariable> Variables = new List<UPnPStateVariable>();
			List<UPnPAction> Actions = new List<UPnPAction>();
			this.xml = Xml;
			this.service = Service;

			if (Xml.DocumentElement != null && Xml.DocumentElement.LocalName == "scpd" &&
				Xml.DocumentElement.NamespaceURI == "urn:schemas-upnp-org:service-1-0")
			{
				foreach (XmlNode N in Xml.DocumentElement.ChildNodes)
				{
					switch (N.LocalName)
					{
						case "specVersion":
							foreach (XmlNode N2 in N.ChildNodes)
							{
								switch (N2.LocalName)
								{
									case "major":
										this.majorVersion = int.Parse(N2.InnerText);
										break;

									case "minor":
										this.minorVersion = int.Parse(N2.InnerText);
										break;
								}
							}
							break;

						case "actionList":
							foreach (XmlNode N2 in N.ChildNodes)
							{
								if (N2.LocalName == "action")
								{
									UPnPAction Action = new UPnPAction((XmlElement)N2, this);
									Actions.Add(Action);
									this.actionsByName[Action.Name] = Action;
								}
							}
							break;

						case "serviceStateTable":
							foreach (XmlNode N2 in N.ChildNodes)
							{
								if (N2.LocalName == "stateVariable")
								{
									UPnPStateVariable Variable = new UPnPStateVariable((XmlElement)N2);
									Variables.Add(Variable);
									this.variablesByName[Variable.Name] = Variable;
								}
							}
							break;
					}
				}
			}
			else
				throw new Exception("Unrecognized file format.");

			this.actions = Actions.ToArray();
			this.variables = Variables.ToArray();
		}