/// <summary> /// helper method to read a class node and store the fields /// </summary> /// <param name="node"></param> /// <returns></returns> private bool ReadAClassNode(System.Xml.XmlNode node) { bool success = true; System.Xml.XmlAttribute nameAttr = node.Attributes["name"]; if (nameAttr == null) { return(false); } string className = nameAttr.Value; System.Xml.XmlAttribute partOfAttr = node.Attributes["partOf"]; if (partOfAttr == null) { return(false); } string partOf = partOfAttr.Value; System.Xml.XmlNodeList idList = node.SelectNodes("Field"); foreach (System.Xml.XmlNode idNode in idList) { ILexImportField field = new LexImportField(); if (field.ReadNode(idNode)) { // is a abbrv field field.IsAbbrField = m_AbbrSignatures.Contains(field.Signature); AddField(className, partOf, field); List <string> classnames = null; if (!m_allFields.TryGetValue(field.ID, out classnames)) { m_allFields.Add(field.ID, new List <string>(new string[] { className })); } else { // Review DanH (RandyR): Why add more than one, since only one is ever used? // Maybe it should not be a List of strings, but only one string. classnames.Add(className); // Not used anywhere, other than adding stuff to it. // m_dupFields.Add(field.ID); // Set's won't add them more than once. } // Not used anywhere, other than adding stuff to it. // is a unique field // if (field.IsUnique) // m_uniqueFields.Add(field.ID); } else { // error case where the xml field wasn't able to be read success = false; // error } } return(success); }
private bool ReadAClassNode(System.Xml.XmlNode node) { bool success = true; System.Xml.XmlAttribute nameAttr = node.Attributes["name"]; if (nameAttr == null) return false; string className = nameAttr.Value; System.Xml.XmlAttribute partOfAttr = node.Attributes["partOf"]; if (partOfAttr == null) return false; string partOf = partOfAttr.Value; System.Xml.XmlNodeList idList = node.SelectNodes("Field"); foreach (System.Xml.XmlNode idNode in idList) { ILexImportField field = new LexImportField(); if (field.ReadNode(idNode)) { // is a abbrv field field.IsAbbrField = m_AbbrSignatures.Contains(field.Signature); AddField(className, partOf, field); List<string> classnames = null; if (!m_allFields.TryGetValue(field.ID, out classnames)) m_allFields.Add(field.ID, new List<string>(new string[] { className })); else { // Review DanH (RandyR): Why add more than one, since only one is ever used? // Maybe it should not be a List of strings, but only one string. classnames.Add(className); // Not used anywhere, other than adding stuff to it. // m_dupFields.Add(field.ID); // Set's won't add them more than once. } // Not used anywhere, other than adding stuff to it. // is a unique field // if (field.IsUnique) // m_uniqueFields.Add(field.ID); } else { // error case where the xml field wasn't able to be read success = false; // error } } return success; }