/// <summary> /// Get EditorsTable from response xml. /// </summary> /// <param name="responseXml">The response xml about EditorsTable.</param> /// <returns>The instance of EditorsTable.</returns> public static EditorsTable GetEditorsTable(string responseXml) { responseXml = System.Text.RegularExpressions.Regex.Replace(responseXml, "^[^<]", string.Empty); XmlDocument doc = new XmlDocument(); doc.LoadXml(responseXml); XmlNodeList nodeList = doc.GetElementsByTagName("Editor"); List <Editor> list = new List <Editor>(); if (nodeList.Count > 0) { foreach (XmlNode node in nodeList) { list.Add(GetEditor(node)); } } EditorsTable table = new EditorsTable(); table.Editors = list.ToArray(); return(table); }
/// <summary> /// A method used to find editor table by table's id. /// </summary> /// <param name="editorsTable">A parameter represents an editor table object.</param> /// <param name="id">A parameter represents editor table's id.</param> /// <returns>A return value represents a editor table object.</returns> private Editor FindEditorById(EditorsTable editorsTable, string id) { return editorsTable.Editors.FirstOrDefault(e => new System.Guid(e.CacheID) == new System.Guid(id)); }
/// <summary> /// Get EditorsTable from response xml. /// </summary> /// <param name="responseXml">The response xml about EditorsTable.</param> /// <returns>The instance of EditorsTable.</returns> public static EditorsTable GetEditorsTable(string responseXml) { responseXml = System.Text.RegularExpressions.Regex.Replace(responseXml, "^[^<]", string.Empty); XmlDocument doc = new XmlDocument(); doc.LoadXml(responseXml); XmlNodeList nodeList = doc.GetElementsByTagName("Editor"); List<Editor> list = new List<Editor>(); if (nodeList.Count > 0) { foreach (XmlNode node in nodeList) { list.Add(GetEditor(node)); } } EditorsTable table = new EditorsTable(); table.Editors = list.ToArray(); return table; }