CustomBindingConfiguration ReadCustomBinding(XmlReader reader)
        {
            string a;
            var    b = new CustomBindingConfiguration();

            if ((a = reader.GetAttribute("name")) != null)
            {
                b.Name = a;
            }

            if (!reader.IsEmptyElement)
            {
                reader.ReadStartElement();
                for (reader.MoveToContent(); reader.NodeType != XmlNodeType.EndElement; reader.MoveToContent())
                {
                    if (reader.NodeType != XmlNodeType.Element)
                    {
                        reader.Skip();
                        continue;
                    }
                    switch (reader.LocalName)
                    {
                    case "binaryMessageEncoding":
                        b.MessageEncoding = new BinaryMessageEncodingBindingElement();
                        reader.Skip();
                        break;

                    case "textMessageEncoding":
                        b.MessageEncoding = new TextMessageEncodingBindingElement();
                        reader.Skip();
                        break;

                    case "httpTransport":
                        b.Transport = new HttpTransportBindingElement();
                        reader.Skip();
                        break;

                    case "httpsTransport":
                        b.Transport = new HttpsTransportBindingElement();
                        reader.Skip();
                        break;

                    default:
                        throw new XmlException(String.Format("Unexpected configuration element '{0}'", reader.LocalName));
                    }
                }
                reader.ReadEndElement();
            }

            return(b);
        }
Ejemplo n.º 2
0
        CustomBindingConfiguration ReadCustomBinding(XmlReader reader)
        {
            string a;
            var    b = new CustomBindingConfiguration();

            if ((a = reader.GetAttribute("name")) != null)
            {
                b.Name = a;
            }

            if (!reader.IsEmptyElement)
            {
                reader.ReadStartElement();
                for (reader.MoveToContent(); reader.NodeType != XmlNodeType.EndElement; reader.MoveToContent())
                {
                    if (reader.NodeType != XmlNodeType.Element)
                    {
                        reader.Skip();
                        continue;
                    }
                    switch (reader.LocalName)
                    {
                    // FIXME: binary encoder must be included in 2.1 profile.
                    // Since they are internal only, they have to be specially handled by linker.
//					case "binaryMessageEncoding":
//						b.MessageEncoding = new BinaryMessageEncodingBindingElement ();
//						reader.Skip ();
//						break;
                    case "textMessageEncoding":
                        b.MessageEncoding = new TextMessageEncodingBindingElement();
                        reader.Skip();
                        break;

                    case "httpTransport":
                        b.Transport = new HttpTransportBindingElement();
                        reader.Skip();
                        break;

                    case "httpsTransport":
                        b.Transport = new HttpsTransportBindingElement();
                        reader.Skip();
                        break;
                    }
                }
                reader.ReadEndElement();
            }

            return(b);
        }
		CustomBindingConfiguration ReadCustomBinding (XmlReader reader)
		{
			string a;
			var b = new CustomBindingConfiguration ();
			if ((a = reader.GetAttribute ("name")) != null)
				b.Name = a;

			if (!reader.IsEmptyElement) {
				reader.ReadStartElement ();
				for (reader.MoveToContent (); reader.NodeType != XmlNodeType.EndElement; reader.MoveToContent ()) {
					if (reader.NodeType != XmlNodeType.Element) {
						reader.Skip ();
						continue;
					}
					switch (reader.LocalName) {
					case "binaryMessageEncoding":
						b.MessageEncoding = new BinaryMessageEncodingBindingElement ();
						reader.Skip ();
						break;
					case "textMessageEncoding":
						b.MessageEncoding = new TextMessageEncodingBindingElement ();
						reader.Skip ();
						break;
					case "httpTransport":
						b.Transport = new HttpTransportBindingElement ();
						reader.Skip ();
						break;
					case "httpsTransport":
						b.Transport = new HttpsTransportBindingElement ();
						reader.Skip ();
						break;
					default:
						throw new XmlException (String.Format ("Unexpected configuration element '{0}'", reader.LocalName));
					}
				}
				reader.ReadEndElement ();
			}
			
			return b;
		}