public WSConfig (WSConfig parent, object context)
		{
			if (parent == null)
				return;
			
			protocols = parent.protocols;
			wsdlHelpPage = parent.wsdlHelpPage;
			if (wsdlHelpPage != null)
				filePath = parent.filePath;
			else
				filePath = context as string;
		}
Exemplo n.º 2
0
        static void ConfigFormatExtensionTypes(XmlNode section, WSConfig config)
        {
            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 typeName = AttValue("name", child, false);
                    if (child.Attributes != null && child.Attributes.Count != 0)
                    {
                        HandlersUtil.ThrowException("Unrecognized attribute", child);
                    }

                    try
                    {
                        config.FormatExtensionTypes.Add(Type.GetType(typeName, true));
                    }
                    catch (Exception e)
                    {
                        ThrowException(e.Message, child);
                    }
                    continue;
                }

                ThrowException("Unexpected element", child);
            }
        }
Exemplo n.º 3
0
        public WSConfig(WSConfig parent, object context)
        {
            if (parent == null)
            {
                return;
            }

            protocols    = parent.protocols;
            wsdlHelpPage = parent.wsdlHelpPage;
            if (wsdlHelpPage != null)
            {
                filePath = parent.filePath;
            }
            else
            {
                filePath = context as string;
            }
        }
		static void ConfigFormatExtensionTypes (XmlNode section, WSConfig config)
		{
			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 typeName = AttValue ("name", child, false);
					if (child.Attributes != null && child.Attributes.Count != 0)
						HandlersUtil.ThrowException ("Unrecognized attribute", child);

					try {
						config.FormatExtensionTypes.Add (Type.GetType (typeName, true));
					} catch (Exception e) {
						ThrowException (e.Message, child);
					}
					continue;
				}

				ThrowException ("Unexpected element", child);
			}
		}
		static void ConfigProtocols (XmlNode section, WSConfig config)
		{
			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;
				string error;
				if (name == "add") {
					string protoName = AttValue ("name", child, false);
					if (child.Attributes != null && child.Attributes.Count != 0)
						HandlersUtil.ThrowException ("Unrecognized attribute", child);

					if (!config.AddProtocol (protoName, out error))
						ThrowException (error, child);
					
					continue;
				}

				if (name == "remove") {
					string protoName = AttValue ("name", child, false);
					if (child.Attributes != null && child.Attributes.Count != 0)
						HandlersUtil.ThrowException ("Unrecognized attribute", child);

					if (!config.RemoveProtocol (protoName, out error))
						ThrowException (error, child);
					
					continue;
				}

				if (name == "clear") {
					if (child.Attributes != null && child.Attributes.Count != 0)
						HandlersUtil.ThrowException ("Unrecognized attribute", child);

					config.ClearProtocol ();
					continue;
				}

				ThrowException ("Unexpected element", child);
			}
		}
		public object Create (object parent, object context, XmlNode section)
		{
			WSConfig config = new WSConfig (parent as WSConfig, context);

			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 == "protocols") {
					ConfigProtocols (child, config);
					continue;
				}

				if (name == "soapExtensionTypes") {
					ConfigSoapExtensionTypes (child, config.ExtensionTypes);
					continue;
				}

				if (name == "soapExtensionReflectorTypes") {
					ConfigSoapExtensionTypes (child, config.ExtensionReflectorTypes);
					continue;
				}

				if (name == "soapExtensionImporterTypes") {
					ConfigSoapExtensionTypes (child, config.ExtensionImporterTypes);
					continue;
				}

				if (name == "serviceDescriptionFormatExtensionTypes") {
					ConfigFormatExtensionTypes (child, config);
					continue;
				}

				if (name == "wsdlHelpGenerator") {
					string href = AttValue ("href", child, false);
					if (child.Attributes != null && child.Attributes.Count != 0)
						HandlersUtil.ThrowException ("Unrecognized attribute", child);

					config.ConfigFilePath = context as string;
					config.WsdlHelpPage = href;
					continue;
				}

				ThrowException ("Unexpected element", child);
			}

			return config;
		}
Exemplo n.º 7
0
        static void ConfigProtocols(XmlNode section, WSConfig config)
        {
            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;
                string error;
                if (name == "add")
                {
                    string protoName = AttValue("name", child, false);
                    if (child.Attributes != null && child.Attributes.Count != 0)
                    {
                        HandlersUtil.ThrowException("Unrecognized attribute", child);
                    }

                    if (!config.AddProtocol(protoName, out error))
                    {
                        ThrowException(error, child);
                    }

                    continue;
                }

                if (name == "remove")
                {
                    string protoName = AttValue("name", child, false);
                    if (child.Attributes != null && child.Attributes.Count != 0)
                    {
                        HandlersUtil.ThrowException("Unrecognized attribute", child);
                    }

                    if (!config.RemoveProtocol(protoName, out error))
                    {
                        ThrowException(error, child);
                    }

                    continue;
                }

                if (name == "clear")
                {
                    if (child.Attributes != null && child.Attributes.Count != 0)
                    {
                        HandlersUtil.ThrowException("Unrecognized attribute", child);
                    }

                    config.ClearProtocol();
                    continue;
                }

                ThrowException("Unexpected element", child);
            }
        }
Exemplo n.º 8
0
        public object Create(object parent, object context, XmlNode section)
        {
            WSConfig config = new WSConfig(parent as WSConfig, context);

            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 == "protocols")
                {
                    ConfigProtocols(child, config);
                    continue;
                }

                if (name == "soapExtensionTypes")
                {
                    ConfigSoapExtensionTypes(child, config.ExtensionTypes);
                    continue;
                }

                if (name == "soapExtensionReflectorTypes")
                {
                    ConfigSoapExtensionTypes(child, config.ExtensionReflectorTypes);
                    continue;
                }

                if (name == "soapExtensionImporterTypes")
                {
                    ConfigSoapExtensionTypes(child, config.ExtensionImporterTypes);
                    continue;
                }

                if (name == "serviceDescriptionFormatExtensionTypes")
                {
                    ConfigFormatExtensionTypes(child, config);
                    continue;
                }

                if (name == "wsdlHelpGenerator")
                {
                    string href = AttValue("href", child, false);
                    if (child.Attributes != null && child.Attributes.Count != 0)
                    {
                        HandlersUtil.ThrowException("Unrecognized attribute", child);
                    }

                    config.ConfigFilePath = context as string;
                    config.WsdlHelpPage   = href;
                    continue;
                }

                ThrowException("Unexpected element", child);
            }

            return(config);
        }