예제 #1
0
 string GetDescription(object obj)
 {
     if (obj is ServiceDescription)
     {
         return("Service Description '" + ServiceDescription.TargetNamespace + "'");
     }
     else if (obj is Binding || obj is Message || obj is PortType || obj is Service)
     {
         return(GetNamedItemDescription(obj, ServiceDescription));
     }
     else if (obj is Import)
     {
         return(GetItemDescription(obj, ServiceDescription, ((Import)obj).Location));
     }
     else if (obj is MessageBinding)
     {
         return(GetNamedItemDescription(obj, ((MessageBinding)obj).OperationBinding));
     }
     else if (obj is MessagePart)
     {
         return(GetNamedItemDescription(obj, ((MessagePart)obj).Message));
     }
     else if (obj is Operation)
     {
         return(GetNamedItemDescription(obj, ((Operation)obj).PortType));
     }
     else if (obj is OperationBinding)
     {
         return(GetNamedItemDescription(obj, ((OperationBinding)obj).Binding));
     }
     else if (obj is OperationMessage)
     {
         return(GetNamedItemDescription(obj, ((OperationMessage)obj).Operation));
     }
     else if (obj is Port)
     {
         return(GetNamedItemDescription(obj, ((Port)obj).Service));
     }
     else if (obj is ServiceDescriptionFormatExtension)
     {
         ServiceDescriptionFormatExtension ext = (ServiceDescriptionFormatExtension)obj;
         return(GetItemDescription(ext, ext.Parent, ext.GetType().Name));
     }
     else if (obj is XmlSchema)
     {
         if (ServiceDescription == null)
         {
             return("Schema '" + ((XmlSchema)obj).TargetNamespace + "'");
         }
         else
         {
             return("Schema '" + ((XmlSchema)obj).TargetNamespace + "', in " + GetDescription(ServiceDescription));
         }
     }
     else if (obj is XmlSchemaObject)
     {
         return(obj.GetType().Name + " in Schema " + GetDescription(CurrentSchema));
     }
     return(obj.GetType().Name);
 }
예제 #2
0
        static void WriteExtension(XmlWriter writer, ServiceDescriptionFormatExtension ext)
        {
            Type          type = ext.GetType();
            ExtensionInfo info = ExtensionManager.GetFormatExtensionInfo(type);

//				if (prefix != null && prefix != "")
//					Writer.WriteStartElement (prefix, info.ElementName, info.Namespace);
//				else
//					WriteStartElement (info.ElementName, info.Namespace, false);

            XmlSerializerNamespaces ns = new XmlSerializerNamespaces();

            ns.Add("", "");
            info.Serializer.Serialize(writer, ext, ns);
        }
예제 #3
0
        void AddExtensionNamespaces(XmlSerializerNamespaces ns, ServiceDescriptionFormatExtensionCollection extensions)
        {
            foreach (object o in extensions)
            {
                ServiceDescriptionFormatExtension ext = o as ServiceDescriptionFormatExtension;
                if (ext == null)
                {
                    // o can be XmlElement, skipping that
                    continue;
                }

                ExtensionInfo einf = ExtensionManager.GetFormatExtensionInfo(ext.GetType());
                foreach (XmlQualifiedName qname in einf.NamespaceDeclarations)
                {
                    ns.Add(qname.Name, qname.Namespace);
                }
            }
        }
예제 #4
0
		static void WriteExtension (XmlWriter writer, ServiceDescriptionFormatExtension ext)
		{
			Type type = ext.GetType ();
			ExtensionInfo info = ExtensionManager.GetFormatExtensionInfo (type);
			
//				if (prefix != null && prefix != "")
//					Writer.WriteStartElement (prefix, info.ElementName, info.Namespace);
//				else
//					WriteStartElement (info.ElementName, info.Namespace, false);

			XmlSerializerNamespaces ns = new XmlSerializerNamespaces ();
			ns.Add ("","");
			info.Serializer.Serialize (writer, ext, ns);
		}