Example #1
0
        internal void WriteItem(NameInfo itemNameInfo, NameInfo typeNameInfo, object value)
        {
            this.attrList.Clear();
            if (itemNameInfo.NItransmitTypeOnMember)
            {
                this.attrList.Put("xsi:type", this.TypeNameTagResolver(typeNameInfo, true));
            }
            string str = null;

            if (typeNameInfo.NIprimitiveTypeEnum == InternalPrimitiveTypeE.QName)
            {
                if (value != null)
                {
                    SoapQName name = (SoapQName)value;
                    if ((name.Key == null) || (name.Key.Length == 0))
                    {
                        this.attrList.Put("xmlns", "");
                    }
                    else
                    {
                        this.attrList.Put("xmlns:" + name.Key, name.Namespace);
                    }
                    str = name.ToString();
                }
            }
            else
            {
                str = Converter.SoapToString(value, typeNameInfo.NIprimitiveTypeEnum);
            }
            this.NamespaceAttribute();
            this.Write(InternalElementTypeE.Member, "item", this.attrList, str, false, typeNameInfo.NIprimitiveTypeEnum == InternalPrimitiveTypeE.Invalid);
        }
Example #2
0
    static void Ctor1()
    {
        //<snippet21>
        // Create a SoapQName object.
        SoapQName qName = new SoapQName();

        Console.WriteLine(
            "The value of the SoapQName object is \"{0}\".",
            qName.ToString());
        //</snippet21>
    }
Example #3
0
    static void Ctor2()
    {
        //<snippet22>
        // Create a SoapQName object.
        string    name  = "SomeName";
        SoapQName qName = new SoapQName(name);

        Console.WriteLine(
            "The value of the SoapQName object is \"{0}\".",
            qName.ToString());
        //</snippet22>
    }
Example #4
0
    public static void Main(string[] args)
    {
        //<snippet11>
        // Parse an XSD formatted string to create a SoapQName object.
        string    xsdQName = "tns:SomeName";
        SoapQName qName    = SoapQName.Parse(xsdQName);

        //</snippet11>

        //<snippet12>
        // Print the value of the SoapQName object in XSD format.
        Console.WriteLine(
            "The SoapQName object in XSD format is {0}.",
            qName.ToString());
        //</snippet12>

        //<snippet13>
        // Print the XSD type string of the SoapQName object.
        Console.WriteLine("The XSD type of the SoapQName " +
                          "object is {0}.", qName.GetXsdType());
        //</snippet13>

        //<snippet16>
        // Print the XSD type string of the SoapQName class.
        Console.WriteLine(
            "The XSD type of the SoapQName class " +
            "is {0}.", SoapQName.XsdType);
        //</snippet16>

        // Create a QName object.
        SoapQName soapQNameInstance =
            new SoapQName("tns", "SomeName", "http://example.org");

        //<snippet17>
        // Print the key the SoapQName object.
        Console.WriteLine("The key of the SoapQName " +
                          "object is {0}.", soapQNameInstance.Key);
        //</snippet17>

        //<snippet18>
        // Print the name of the SoapQName object.
        Console.WriteLine("The name of the SoapQName " +
                          "object is {0}.", soapQNameInstance.Name);
        //</snippet18>

        //<snippet19>
        // Print the namespace of the SoapQName class.
        Console.WriteLine("The namespace for this instance of SoapQName " +
                          "is {0}.", soapQNameInstance.Namespace);
        //</snippet19>
    }
Example #5
0
    static void Ctor4()
    {
        //<snippet24>
        // Create a SoapQName object.
        string    key            = "tns";
        string    name           = "SomeName";
        string    namespaceValue = "http://example.org";
        SoapQName qName          = new SoapQName(key, name, namespaceValue);

        Console.WriteLine(
            "The value of the SoapQName object is \"{0}\".",
            qName.ToString());
        //</snippet24>
    }
Example #6
0
        internal void WriteMember(NameInfo memberNameInfo, NameInfo typeNameInfo, object value)
        {
            this.attrList.Clear();
            if ((typeNameInfo.NItype != null) && (memberNameInfo.NItransmitTypeOnMember || (memberNameInfo.NItransmitTypeOnObject && !memberNameInfo.NIisArrayItem)))
            {
                this.attrList.Put("xsi:type", this.TypeNameTagResolver(typeNameInfo, true));
            }
            string str = null;

            if (value != null)
            {
                if (typeNameInfo.NIprimitiveTypeEnum == InternalPrimitiveTypeE.QName)
                {
                    SoapQName name = (SoapQName)value;
                    if ((name.Key == null) || (name.Key.Length == 0))
                    {
                        this.attrList.Put("xmlns", "");
                    }
                    else
                    {
                        this.attrList.Put("xmlns:" + name.Key, name.Namespace);
                    }
                    str = name.ToString();
                }
                else if (value is string)
                {
                    str = (string)value;
                }
                else
                {
                    str = Converter.SoapToString(value, typeNameInfo.NIprimitiveTypeEnum);
                }
            }
            NameInfo info = null;

            if (typeNameInfo.NInameSpaceEnum == InternalNameSpaceE.Interop)
            {
                info = typeNameInfo;
            }
            string str2 = this.MemberElementName(memberNameInfo, info);

            this.NamespaceAttribute();
            this.Write(InternalElementTypeE.Member, str2, this.attrList, str, true, Converter.IsEscaped(typeNameInfo.NIprimitiveTypeEnum));
        }
Example #7
0
        internal void WriteHeaderEntry(NameInfo nameInfo, NameInfo typeNameInfo, object value)
        {
            this.attrList.Clear();
            if (value == null)
            {
                this.attrList.Put("xsi:null", "1");
            }
            else
            {
                this.attrList.Put("xsi:type", this.TypeNameTagResolver(typeNameInfo, true));
            }
            if (nameInfo.NIisMustUnderstand)
            {
                this.attrList.Put("SOAP-ENV:mustUnderstand", "1");
                this.isUsedEnc = true;
            }
            this.attrList.Put("xmlns:" + nameInfo.NIheaderPrefix, nameInfo.NInamespace);
            this.attrList.Put("SOAP-ENC:root", "1");
            string str = null;

            if (value != null)
            {
                if ((typeNameInfo != null) && (typeNameInfo.NIprimitiveTypeEnum == InternalPrimitiveTypeE.QName))
                {
                    SoapQName name = (SoapQName)value;
                    if ((name.Key == null) || (name.Key.Length == 0))
                    {
                        this.attrList.Put("xmlns", "");
                    }
                    else
                    {
                        this.attrList.Put("xmlns:" + name.Key, name.Namespace);
                    }
                    str = name.ToString();
                }
                else
                {
                    str = Converter.SoapToString(value, typeNameInfo.NIprimitiveTypeEnum);
                }
            }
            this.NamespaceAttribute();
            this.Write(InternalElementTypeE.Member, nameInfo.NIheaderPrefix + ":" + nameInfo.NIname, this.attrList, str, true, true);
        }