Ejemplo n.º 1
0
        private void _readFromOldFormat(XElement xml)
        {
            // Old format
            if (xml.Element(Consts.NodeGrammarPartOfSpeech) != null)
                PartOfSpeech = GrammarInfoPartOfSpeech.ReadFromString(xml.Element(Consts.NodeGrammarPartOfSpeech).Value);

            if (xml.Element(Consts.NodeGrammarCase) != null)
                Case = GrammarInfoCase.ReadFromString(xml.Element(Consts.NodeGrammarCase).Value);
        }
Ejemplo n.º 2
0
        private void _readFormNewFormat(XElement xml, bool useNamespaces)
        {
            // спускаемся на 1 уровень ниже, т.к. сначала определеяется тип грамматической информации:
            // <Linguistic:grammar_info>
            //   < Linguistic:NounInfo rdf:nodeID = "bnode549CD073-9527-47EB-9B46-9FC2094D0920" >
            xml = xml.FirstNode as XElement;

            var partOfSpeechNodeName = XName.Get(Consts.NodeGrammarPartOfSpeech, useNamespaces ? Namespaces.NamespaceLinguistic : "");
            var singularNodeName = XName.Get(Consts.NodeGrammarIsSingular, useNamespaces ? Namespaces.NamespaceLinguistic : "");

            var caseNodeName = XName.Get(Consts.NodeGrammarCase, useNamespaces ? Namespaces.NamespaceLinguistic : "");
            var resourceName = XName.Get(Consts.AttResourse, useNamespaces ? Namespaces.NamespaceRDF : "");

            if (xml.Element(partOfSpeechNodeName) != null)
                PartOfSpeech = GrammarInfoPartOfSpeech.ReadFromString(xml.Element(partOfSpeechNodeName).Attribute(resourceName).Value);
            if (xml.Element(caseNodeName) != null)
                Case = GrammarInfoCase.ReadFromString(xml.Element(caseNodeName).Attribute(resourceName).Value);
            if (xml.Element(singularNodeName) != null)
                IsSingular = bool.Parse(xml.Element(singularNodeName).Value);
        }