Example #1
0
        protected YSynonym GetYSynonym(XmlElement node)
        {
            YSynonym synonym = new YSynonym
            {
                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")
                {
                    synonym.Synonym = nodeChild.InnerText;
                }
                if (nodeChild.LocalName == "tr")
                {
                    foreach (XmlElement nodeSynTr in nodeChild.ChildNodes)
                    {
                        if (nodeSynTr.LocalName == "text")
                        {
                            synonym.SynonymTranslation = nodeSynTr.InnerText;
                        }
                    }
                }
            }
            return(synonym);
        }
Example #2
0
        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);
        }