Exemplo n.º 1
0
        public void Load(string fileName)
        {
            var doc = new XmlDocument();

            doc.Load(fileName);

            var categories = doc.SelectNodes("//category");

            for (var categoryIndex = 0; categoryIndex < categories.Count; categoryIndex++)
            {
                var category     = categories[categoryIndex];
                var categoryName = category.Attributes["name"].Value;
                _categories.Add(categoryName, new List <WordTeqacherItem>());
                for (var childIndex = 0; childIndex < category.ChildNodes.Count; childIndex++)
                {
                    var node = category.ChildNodes[childIndex];
                    var item = new WordTeqacherItem()
                    {
                        Word          = node.Attributes["word"].Value,
                        Trnascription = node.Attributes["transcription"].Value,
                        Translate     = node.Attributes["translate"].Value,
                    };
                    _categories[categoryName].Add(item);
                }
            }
        }
Exemplo n.º 2
0
		public void Load(string fileName)
		{
			var doc = new XmlDocument();
			doc.Load(fileName);

			var categories = doc.SelectNodes("//category");
			for (var categoryIndex = 0; categoryIndex < categories.Count; categoryIndex++)
			{
				var category = categories[categoryIndex];
				var categoryName = category.Attributes["name"].Value;
				_categories.Add(categoryName, new List<WordTeqacherItem>());
				for (var childIndex = 0; childIndex < category.ChildNodes.Count; childIndex++)
				{
					var node = category.ChildNodes[childIndex];
					var item = new WordTeqacherItem()
					{
						Word = node.Attributes["word"].Value,
						Trnascription = node.Attributes["transcription"].Value,
						Translate = node.Attributes["translate"].Value,
					};
					_categories[categoryName].Add(item);
				}
			}
		}