Exemple #1
0
        internal void Write(InternalElementTypeE use, string name, AttributeList attrList, string value, bool isNameEscape, bool isValueEscape)
        {
            string s = name;

            if (isNameEscape)
            {
                s = this.NameEscape(name);
            }
            if (use == InternalElementTypeE.ObjectEnd)
            {
                this.instanceIndent--;
            }
            this.InternalWrite("<");
            if (use == InternalElementTypeE.ObjectEnd)
            {
                this.InternalWrite("/");
            }
            this.InternalWrite(s);
            this.WriteAttributeList(attrList);
            switch (use)
            {
            case InternalElementTypeE.ObjectBegin:
                this.InternalWrite(">");
                this.instanceIndent++;
                break;

            case InternalElementTypeE.ObjectEnd:
                this.InternalWrite(">");
                break;

            case InternalElementTypeE.Member:
                if (value != null)
                {
                    this.InternalWrite(">");
                    if (isValueEscape)
                    {
                        this.InternalWrite(this.Escape(value));
                    }
                    else
                    {
                        this.InternalWrite(value);
                    }
                    this.InternalWrite("</");
                    this.InternalWrite(s);
                    this.InternalWrite(">");
                    break;
                }
                this.InternalWrite("/>");
                break;

            default:
                throw new SerializationException(string.Format(CultureInfo.CurrentCulture, SoapUtil.GetResourceString("Serialization_UseCode"), new object[] { use.ToString() }));
            }
            this.EmitLine();
        }
        internal void Write(InternalElementTypeE use, string name, AttributeList attrList, string value, bool isNameEscape, bool isValueEscape)
        {
            string s = name;
            if (isNameEscape)
            {
                s = this.NameEscape(name);
            }
            if (use == InternalElementTypeE.ObjectEnd)
            {
                this.instanceIndent--;
            }
            this.InternalWrite("<");
            if (use == InternalElementTypeE.ObjectEnd)
            {
                this.InternalWrite("/");
            }
            this.InternalWrite(s);
            this.WriteAttributeList(attrList);
            switch (use)
            {
                case InternalElementTypeE.ObjectBegin:
                    this.InternalWrite(">");
                    this.instanceIndent++;
                    break;

                case InternalElementTypeE.ObjectEnd:
                    this.InternalWrite(">");
                    break;

                case InternalElementTypeE.Member:
                    if (value != null)
                    {
                        this.InternalWrite(">");
                        if (isValueEscape)
                        {
                            this.InternalWrite(this.Escape(value));
                        }
                        else
                        {
                            this.InternalWrite(value);
                        }
                        this.InternalWrite("</");
                        this.InternalWrite(s);
                        this.InternalWrite(">");
                        break;
                    }
                    this.InternalWrite("/>");
                    break;

                default:
                    throw new SerializationException(string.Format(CultureInfo.CurrentCulture, SoapUtil.GetResourceString("Serialization_UseCode"), new object[] { use.ToString() }));
            }
            this.EmitLine();
        }
Exemple #3
0
		// Write an XML element
		internal void Write(InternalElementTypeE use, String name, AttributeList attrList, String value, bool isNameEscape, bool isValueEscape)
		{
			InternalST.Soap( this,"Write ",((Enum)use).ToString(),", name "+name+", value ",value, " isNameEscape ",isNameEscape," isValueEscape ",isValueEscape);

			String elementName = name;
			if (isNameEscape)
				elementName = NameEscape(name);

			if (use == InternalElementTypeE.ObjectEnd)
				instanceIndent--;
			
			EmitIndent(instanceIndent);			

			InternalWrite("<");
			if (use == InternalElementTypeE.ObjectEnd)
				InternalWrite("/");
			InternalWrite(elementName);

			WriteAttributeList(attrList);
			
			switch(use)
			{
				case InternalElementTypeE.ObjectBegin:
					InternalWrite(">");
					instanceIndent++;
					break;
				case InternalElementTypeE.ObjectEnd:
					InternalWrite(">");
					break;
				case InternalElementTypeE.Member:
					if (value == null)
						InternalWrite("/>");
					else
					{
						InternalWrite(">");
						if (isValueEscape)
							InternalWrite(Escape(value));
						else
							InternalWrite(value);
						InternalWrite("</");
						InternalWrite(elementName);
						InternalWrite(">");					
					}
					break;
				default:
					throw new SerializationException(String.Format(SoapUtil.GetResourceString("Serialization_UseCode"),((Enum)use).ToString()));									
			}
			EmitLine();
		}