private void loadDatCats() { XmlReaderSettings settings = new XmlReaderSettings(); settings.DtdProcessing = DtdProcessing.Ignore; XmlReader reader = XmlReader.Create(filename, settings); bool start = false; int level = 0; while (reader.Read()) { if (reader.NodeType == XmlNodeType.Element && (reader.Name == "body" || reader.Name == "mtf")) { start = true; } if (start == true) { if (reader.Name == "back") { start = false; continue; } if (reader.Name == "conceptGrp" || reader.Name == "languageGrp" || reader.Name == "termGrp" || reader.Name == "termEntry" || reader.Name == "langSet" || reader.Name == "tig" || reader.Name == "conceptEntry" || reader.Name == "langSec" || reader.Name == "termSec") { switch (reader.Name) { case "conceptGrp": case "termEntry": case "conceptEntry": level = 1; break; case "languageGrp": case "langSet": case "langSec": level = 2; break; case "termGrp": case "tig": case "termSec": level = 3; break; } } if (reader.NodeType == XmlNodeType.Element && reader.HasAttributes && null != reader.GetAttribute("type") && reader.Name != "language") { string dc = reader.GetAttribute("type"); if (!Methods.inList(ref datcats, dc)) { datcats.Add(dc); mapping.Add(dc); switch (level) { case 1: mapping.levelMap["conceptGrp"].Add(dc); break; case 2: mapping.levelMap["languageGrp"].Add(dc); break; case 3: mapping.levelMap["termGrp"].Add(dc); break; } } //Pull out text for use later with picklists XmlReader textReader = reader.ReadSubtree(); while (textReader.Read()) { if (textReader.NodeType == XmlNodeType.Text) { List <string> values = mapping.getContentList(dc) as List <string>; if (!Methods.inList(ref values, reader.Value)) { mapping.getContentList(dc).Add(textReader.Value); } } } } } } datcats.Sort(); textTotal.Text = datcats.Count().ToString(); }