void Write18_Item(string n, string ns, CiscoIPPhoneGraphicFileMenuType 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(CiscoIPPhoneGraphicFileMenuType)) {
         }
         else {
             throw CreateUnknownTypeException(o);
         }
     }
     WriteStartElement(n, ns, o, false, null);
     if (needType) WriteXsiType(@"CiscoIPPhoneGraphicFileMenuType", @"");
     WriteNullableStringLiteral(@"Title", @"", ((global::System.String)o.@Title));
     WriteNullableStringLiteral(@"Prompt", @"", ((global::System.String)o.@Prompt));
     if (o.@LocationXSpecified) {
         WriteElementStringRaw(@"LocationX", @"", System.Xml.XmlConvert.ToString((global::System.Int16)((global::System.Int16)o.@LocationX)));
     }
     if (o.@LocationYSpecified) {
         WriteElementStringRaw(@"LocationY", @"", System.Xml.XmlConvert.ToString((global::System.Int16)((global::System.Int16)o.@LocationY)));
     }
     WriteElementString(@"URL", @"", ((global::System.String)o.@URL));
     {
         CiscoIPPhoneSoftKeyType[] a = (CiscoIPPhoneSoftKeyType[])o.@SoftKeyItem;
         if (a != null) {
             for (int ia = 0; ia < a.Length; ia++) {
                 Write3_CiscoIPPhoneSoftKeyType(@"SoftKeyItem", @"", ((CiscoIPPhoneSoftKeyType)a[ia]), false, false);
             }
         }
     }
     {
         CiscoIPPhoneTouchAreaMenuItemType[] a = (CiscoIPPhoneTouchAreaMenuItemType[])o.@MenuItem;
         if (a != null) {
             for (int ia = 0; ia < a.Length; ia++) {
                 Write9_Item(@"MenuItem", @"", ((CiscoIPPhoneTouchAreaMenuItemType)a[ia]), false, false);
             }
         }
     }
     WriteEndElement(o);
 }
 CiscoIPPhoneGraphicFileMenuType Read18_Item(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)id56_Item && (object) ((System.Xml.XmlQualifiedName)xsiType).Namespace == (object)id2_Item)) {
     }
     else
         throw CreateUnknownTypeException((System.Xml.XmlQualifiedName)xsiType);
     }
     if (isNull) return null;
     CiscoIPPhoneGraphicFileMenuType o;
     o = new CiscoIPPhoneGraphicFileMenuType();
     CiscoIPPhoneSoftKeyType[] a_5 = null;
     int ca_5 = 0;
     CiscoIPPhoneTouchAreaMenuItemType[] a_6 = null;
     int ca_6 = 0;
     bool[] paramsRead = new bool[7];
     while (Reader.MoveToNextAttribute()) {
         if (!IsXmlnsAttribute(Reader.Name)) {
             UnknownNode((object)o);
         }
     }
     Reader.MoveToElement();
     if (Reader.IsEmptyElement) {
         Reader.Skip();
         o.@SoftKeyItem = (CiscoIPPhoneSoftKeyType[])ShrinkArray(a_5, ca_5, typeof(CiscoIPPhoneSoftKeyType), true);
         o.@MenuItem = (CiscoIPPhoneTouchAreaMenuItemType[])ShrinkArray(a_6, ca_6, typeof(CiscoIPPhoneTouchAreaMenuItemType), true);
         return o;
     }
     Reader.ReadStartElement();
     Reader.MoveToContent();
     int whileIterations10 = 0;
     int readerCount10 = 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)id28_LocationX && (object) Reader.NamespaceURI == (object)id2_Item)) {
                 o.@LocationXSpecified = true;
                 {
                     o.@LocationX = System.Xml.XmlConvert.ToInt16(Reader.ReadElementString());
                 }
                 paramsRead[2] = true;
             }
             else if (!paramsRead[3] && ((object) Reader.LocalName == (object)id29_LocationY && (object) Reader.NamespaceURI == (object)id2_Item)) {
                 o.@LocationYSpecified = true;
                 {
                     o.@LocationY = System.Xml.XmlConvert.ToInt16(Reader.ReadElementString());
                 }
                 paramsRead[3] = true;
             }
             else if (!paramsRead[4] && ((object) Reader.LocalName == (object)id38_URL && (object) Reader.NamespaceURI == (object)id2_Item)) {
                 {
                     o.@URL = Reader.ReadElementString();
                 }
                 paramsRead[4] = true;
             }
             else if (((object) Reader.LocalName == (object)id51_SoftKeyItem && (object) Reader.NamespaceURI == (object)id2_Item)) {
                 a_5 = (CiscoIPPhoneSoftKeyType[])EnsureArrayIndex(a_5, ca_5, typeof(CiscoIPPhoneSoftKeyType));a_5[ca_5++] = Read3_CiscoIPPhoneSoftKeyType(false, true);
             }
             else if (((object) Reader.LocalName == (object)id57_MenuItem && (object) Reader.NamespaceURI == (object)id2_Item)) {
                 a_6 = (CiscoIPPhoneTouchAreaMenuItemType[])EnsureArrayIndex(a_6, ca_6, typeof(CiscoIPPhoneTouchAreaMenuItemType));a_6[ca_6++] = Read9_Item(false, true);
             }
             else {
                 UnknownNode((object)o, @":Title, :Prompt, :LocationX, :LocationY, :URL, :SoftKeyItem, :MenuItem");
             }
         }
         else {
             UnknownNode((object)o, @":Title, :Prompt, :LocationX, :LocationY, :URL, :SoftKeyItem, :MenuItem");
         }
         Reader.MoveToContent();
         CheckReaderCount(ref whileIterations10, ref readerCount10);
     }
     o.@SoftKeyItem = (CiscoIPPhoneSoftKeyType[])ShrinkArray(a_5, ca_5, typeof(CiscoIPPhoneSoftKeyType), true);
     o.@MenuItem = (CiscoIPPhoneTouchAreaMenuItemType[])ShrinkArray(a_6, ca_6, typeof(CiscoIPPhoneTouchAreaMenuItemType), true);
     ReadEndElement();
     return o;
 }