コード例 #1
0
        static void ConfigSoapExtensionTypes(XmlNode section, ArrayList extensions)
        {
            if (section.Attributes != null && section.Attributes.Count != 0)
            {
                ThrowException("Unrecognized attribute", section);
            }

            XmlNodeList nodes = section.ChildNodes;

            foreach (XmlNode child in nodes)
            {
                XmlNodeType ntype = child.NodeType;
                if (ntype == XmlNodeType.Whitespace || ntype == XmlNodeType.Comment)
                {
                    continue;
                }

                if (ntype != XmlNodeType.Element)
                {
                    ThrowException("Only elements allowed", child);
                }

                string name = child.Name;
                if (name == "add")
                {
                    string seType   = AttValue("type", child, false);
                    string priority = AttValue("priority", child);
                    string group    = AttValue("group", child);
                    if (child.Attributes != null && child.Attributes.Count != 0)
                    {
                        HandlersUtil.ThrowException("Unrecognized attribute", child);
                    }

                    WSExtensionConfig wse = new WSExtensionConfig();
                    Exception         e   = wse.SetType(seType);
                    if (e != null)
                    {
                        ThrowException(e.Message, child);
                    }

                    e = wse.SetPriority(priority);
                    if (e != null)
                    {
                        ThrowException(e.Message, child);
                    }

                    e = wse.SetGroup(group);
                    if (e != null)
                    {
                        ThrowException(e.Message, child);
                    }

                    extensions.Add(wse);
                    continue;
                }

                ThrowException("Unexpected element", child);
            }
        }
		static void ConfigSoapExtensionTypes (XmlNode section, ArrayList extensions)
		{
			if (section.Attributes != null && section.Attributes.Count != 0)
				ThrowException ("Unrecognized attribute", section);

			XmlNodeList nodes = section.ChildNodes;
			foreach (XmlNode child in nodes) {
				XmlNodeType ntype = child.NodeType;
				if (ntype == XmlNodeType.Whitespace || ntype == XmlNodeType.Comment)
					continue;

				if (ntype != XmlNodeType.Element)
					ThrowException ("Only elements allowed", child);
				
				string name = child.Name;
				if (name == "add") {
					string seType = AttValue ("type", child, false);
					string priority = AttValue ("priority", child);
					string group = AttValue ("group", child);
					if (child.Attributes != null && child.Attributes.Count != 0)
						HandlersUtil.ThrowException ("Unrecognized attribute", child);

					WSExtensionConfig wse = new WSExtensionConfig ();
					Exception e = wse.SetType (seType);
					if (e != null)
						ThrowException (e.Message, child);

					e = wse.SetPriority (priority);
					if (e != null)
						ThrowException (e.Message, child);

					e = wse.SetGroup (group);
					if (e != null)
						ThrowException (e.Message, child);

					extensions.Add (wse);
					continue;
				}

				ThrowException ("Unexpected element", child);
			}
		}