protected YDictionary GetYDictionary(XmlElement node) { YDictionary dict = new YDictionary { AttrGender = node.GetAttribute("gen"), AttrNum = node.GetAttribute("num"), AttrPartOfSpeech = node.GetAttribute("pos"), AttrTranscription = node.GetAttribute("ts") }; // getting all childnodes of node "def" foreach (XmlElement nodeChild in node.ChildNodes) { if (nodeChild.LocalName == "text") { dict.AttrText = nodeChild.InnerText; } if (nodeChild.LocalName == "tr") { YTranslation tr = GetYTranslation(nodeChild); if (tr != null) { dict.Translations.Add(tr); } } } return(dict); }
protected YTranslation GetYTranslation(XmlElement node) { YTranslation tr = new YTranslation { AttrGender = node.GetAttribute("gen"), AttrNum = node.GetAttribute("num"), AttrPartOfSpeech = node.GetAttribute("pos"), AttrText = node.GetAttribute("text") }; foreach (XmlElement nodeChild in node.ChildNodes) { if (nodeChild.LocalName == "text") { tr.AttrTranslation = nodeChild.InnerText; } if (nodeChild.LocalName == "mean") { YMean mean = GetYMean(nodeChild); tr.Means.Add(mean); } if (nodeChild.LocalName == "ex") { YExample example = GetYExample(nodeChild); tr.Examples.Add(example); } if (nodeChild.LocalName == "syn") { YSynonym synonym = GetYSynonym(nodeChild); tr.Synonyms.Add(synonym); } } return(tr); }