コード例 #1
0
            private XmlNode m_node;             // need to remember the node so can put info for *all* writing systems into databas

            public static MasterCategory Create(Set <ICmPossibility> posSet, XmlNode node, FdoCache cache)
            {
                /*
                 * <item type="category" id="adjective">
                 *      <abbrev ws="en">adj</abbrev>
                 *      <term ws="en">adjective</term>
                 *      <def ws="en">An adjective is a part of speech whose members modify nouns. An adjective specifies the attributes of a noun referent. Note: this is one case among many. Adjectives are a class of modifiers.</def>
                 *      <citation ws="en">Crystal 1997:8</citation>
                 *      <citation ws="en">Mish et al. 1990:56</citation>
                 *      <citation ws="en">Payne 1997:63</citation>
                 * </item>
                 */

                MasterCategory mc = new MasterCategory();

                mc.m_isGroup = node.SelectNodes("item") != null;
                mc.m_id      = XmlUtils.GetManditoryAttributeValue(node, "id");
                mc.m_pos     = PartOfSpeech.GoldPOS(posSet, mc.m_id);

                mc.m_node = node;                 // remember node, too, so can put info for all WSes in database

                string sDefaultWS = cache.LangProject.DefaultAnalysisWritingSystemICULocale;
                string sContent;

                mc.m_abbrevWs = GetBestWritingSystemForNamedNode(node, "abbrev", sDefaultWS, cache, out sContent);
                mc.m_abbrev   = sContent;

                mc.m_termWs = GetBestWritingSystemForNamedNode(node, "term", sDefaultWS, cache, out sContent);
                mc.m_term   = NameFixer(sContent);

                mc.m_defWs = GetBestWritingSystemForNamedNode(node, "def", sDefaultWS, cache, out sContent);
                mc.m_def   = sContent;

                foreach (XmlNode citNode in node.SelectNodes("citation"))
                {
                    mc.m_citations.Add(new MasterCategoryCitation(XmlUtils.GetManditoryAttributeValue(citNode, "ws"), citNode.InnerText));
                }
                return(mc);
            }