System.Runtime.Serialization.Formatters.Soap.SoapWriter.Write C# (CSharp) Method

Write() private method

private Write ( InternalElementTypeE use, String name, AttributeList attrList, String value, bool isNameEscape, bool isValueEscape ) : void
use InternalElementTypeE
name String
attrList AttributeList
value String
isNameEscape bool
isValueEscape bool
return void
		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(CultureInfo.CurrentCulture, SoapUtil.GetResourceString("Serialization_UseCode"),((Enum)use).ToString()));									
			}
			EmitLine();
		}