public void Error(string error) { CiscoIPPhoneTextType er = new CiscoIPPhoneTextType(); er.Prompt = "Erreur"; er.Title = "La requête a échouée"; er.Text = error; er.SoftKey = new CiscoIPPhoneSoftKeyType[1]; er.SoftKey[0] = new CiscoIPPhoneSoftKeyType(); er.SoftKey[0].Name = "Quitter"; er.SoftKey[0].Postion = 3; er.SoftKey[0].PostionSpecified = true; er.SoftKey[0].URL = "SoftKey:Exit"; er.SoftKey[0].URLDown = ""; //return er; CiscoIPPhoneTextTypeSerializer xml = new CiscoIPPhoneTextTypeSerializer(); System.Xml.XmlWriterSettings settings = new System.Xml.XmlWriterSettings();; settings.Encoding = System.Text.Encoding.UTF8; System.IO.MemoryStream ms = new System.IO.MemoryStream(); System.Xml.XmlWriter xw = System.Xml.XmlWriter.Create(ms, settings); System.Xml.Serialization.XmlSerializerNamespaces xmlnsEmpty = new System.Xml.Serialization.XmlSerializerNamespaces(); xmlnsEmpty.Add("", ""); xml.Serialize(xw, er, xmlnsEmpty); ms.Position = 0; this.Context.Response.ContentType = "text/xml"; this.Context.Response.ContentEncoding = System.Text.Encoding.UTF8; this.Context.Response.Write(GetStringFromStream(ms)); }
void Write20_CiscoIPPhoneTextType(string n, string ns, CiscoIPPhoneTextType o, bool isNullable, bool needType) { if ((object)o == null) { if (isNullable) WriteNullTagLiteral(n, ns); return; } if (!needType) { System.Type t = o.GetType(); if (t == typeof(CiscoIPPhoneTextType)) { } else { throw CreateUnknownTypeException(o); } } WriteStartElement(n, ns, o, false, null); if (needType) WriteXsiType(@"CiscoIPPhoneTextType", @""); WriteNullableStringLiteral(@"Title", @"", ((global::System.String)o.@Title)); WriteNullableStringLiteral(@"Prompt", @"", ((global::System.String)o.@Prompt)); WriteElementString(@"Text", @"", ((global::System.String)o.@Text)); { CiscoIPPhoneSoftKeyType[] a = (CiscoIPPhoneSoftKeyType[])o.@SoftKey; if (a != null) { for (int ia = 0; ia < a.Length; ia++) { Write3_CiscoIPPhoneSoftKeyType(@"SoftKeyItem", @"", ((CiscoIPPhoneSoftKeyType)a[ia]), false, false); } } } WriteEndElement(o); }
CiscoIPPhoneTextType Read20_CiscoIPPhoneTextType(bool isNullable, bool checkType) { System.Xml.XmlQualifiedName xsiType = checkType ? GetXsiType() : null; bool isNull = false; if (isNullable) isNull = ReadNull(); if (checkType) { if (xsiType == null || ((object) ((System.Xml.XmlQualifiedName)xsiType).Name == (object)id42_CiscoIPPhoneTextType && (object) ((System.Xml.XmlQualifiedName)xsiType).Namespace == (object)id2_Item)) { } else throw CreateUnknownTypeException((System.Xml.XmlQualifiedName)xsiType); } if (isNull) return null; CiscoIPPhoneTextType o; o = new CiscoIPPhoneTextType(); CiscoIPPhoneSoftKeyType[] a_3 = null; int ca_3 = 0; bool[] paramsRead = new bool[4]; while (Reader.MoveToNextAttribute()) { if (!IsXmlnsAttribute(Reader.Name)) { UnknownNode((object)o); } } Reader.MoveToElement(); if (Reader.IsEmptyElement) { Reader.Skip(); o.@SoftKey = (CiscoIPPhoneSoftKeyType[])ShrinkArray(a_3, ca_3, typeof(CiscoIPPhoneSoftKeyType), true); return o; } Reader.ReadStartElement(); Reader.MoveToContent(); int whileIterations6 = 0; int readerCount6 = ReaderCount; while (Reader.NodeType != System.Xml.XmlNodeType.EndElement && Reader.NodeType != System.Xml.XmlNodeType.None) { if (Reader.NodeType == System.Xml.XmlNodeType.Element) { if (!paramsRead[0] && ((object) Reader.LocalName == (object)id43_Title && (object) Reader.NamespaceURI == (object)id2_Item)) { if (ReadNull()) { o.@Title = null; } else { o.@Title = Reader.ReadElementString(); } paramsRead[0] = true; } else if (!paramsRead[1] && ((object) Reader.LocalName == (object)id44_Prompt && (object) Reader.NamespaceURI == (object)id2_Item)) { if (ReadNull()) { o.@Prompt = null; } else { o.@Prompt = Reader.ReadElementString(); } paramsRead[1] = true; } else if (!paramsRead[2] && ((object) Reader.LocalName == (object)id26_Text && (object) Reader.NamespaceURI == (object)id2_Item)) { { o.@Text = Reader.ReadElementString(); } paramsRead[2] = true; } else if (((object) Reader.LocalName == (object)id45_SoftKey && (object) Reader.NamespaceURI == (object)id2_Item)) { a_3 = (CiscoIPPhoneSoftKeyType[])EnsureArrayIndex(a_3, ca_3, typeof(CiscoIPPhoneSoftKeyType));a_3[ca_3++] = Read3_CiscoIPPhoneSoftKeyType(false, true); } else { UnknownNode((object)o, @":Title, :Prompt, :Text, :SoftKey"); } } else { UnknownNode((object)o, @":Title, :Prompt, :Text, :SoftKey"); } Reader.MoveToContent(); CheckReaderCount(ref whileIterations6, ref readerCount6); } o.@SoftKey = (CiscoIPPhoneSoftKeyType[])ShrinkArray(a_3, ca_3, typeof(CiscoIPPhoneSoftKeyType), true); ReadEndElement(); return o; }