Пример #1
0
 public override string ToString()
 {
     //hack
     if (_lexicalForm != null)
     {
         return(_lexicalForm.GetFirstAlternative());
     }
     else
     {
         return("");
     }
 }
Пример #2
0
        private int ParsePossibilities(XmlTextReader reader)
        {
            int retCount               = 0;
            int semanticDomainCount    = 0;
            int semanticDomainEndCount = 0;

            try
            {
                if (!reader.ReadToDescendant("Possibilities"))
                {
                    Debug.Fail("Bad format, no Possibilities");
                }
                reader.ReadToDescendant("CmSemanticDomain");
                Option option = new Option();
                _searchKeys = new MultiText();
                MultiText     mtName         = new MultiText();
                MultiText     mtAbbreviation = new MultiText();
                MultiText     mtDescription  = new MultiText();
                String        name           = "";
                String        abbreviation   = "";
                List <String> questions      = new List <string>();

                reader.MoveToContent();
                while (!reader.EOF)
                {
                    if (reader.IsStartElement())
                    {
                        switch (reader.Name)
                        {
                        case "Name":
                            mtName = ParseMultiStringElement(reader, false);
                            name   = mtName.GetFirstAlternative();
                            break;

                        case "Abbreviation":
                            mtAbbreviation = ParseMultiStringElement(reader, false);
                            abbreviation   = mtAbbreviation.GetFirstAlternative();
                            break;

                        case "Description":
                            mtDescription = ParseDescriptions(reader);
                            break;

                        case "Questions":
                            XmlReader questionReader = reader.ReadSubtree();
                            questions = ParseQuestions(questionReader);
                            questionReader.Close();
                            reader.ReadToFollowing("CmSemanticDomain");
                            break;

                        case "CmSemanticDomain":
                            if (!(String.IsNullOrEmpty(name) || String.IsNullOrEmpty(abbreviation)))
                            {
                                CreateOptionEntry(abbreviation, name, questions, option,
                                                  mtAbbreviation, mtName, mtDescription);
                                retCount++;
                                option         = new Option();
                                _searchKeys    = new MultiText();
                                mtName         = new MultiText();
                                mtAbbreviation = new MultiText();
                                mtDescription  = new MultiText();
                                questions      = new List <string>();
                                name           = "";
                                abbreviation   = "";
                            }
                            reader.Read();
                            semanticDomainCount++;
                            break;

                        default:
                            reader.Read();
                            break;
                        }
                    }
                    else
                    {
                        if (IsEndElement(reader, "Possibilities"))
                        {
                            break;
                        }
                        if (IsEndElement(reader, "CmSemanticDomain"))
                        {
                            semanticDomainEndCount++;
                        }
                        reader.Read();
                    }
                }
                // Take care of last entry
                if (!(String.IsNullOrEmpty(name) || String.IsNullOrEmpty(abbreviation)))
                {
                    CreateOptionEntry(abbreviation, name, questions, option,
                                      mtAbbreviation, mtName, mtDescription);
                    retCount++;
                }
            }
            catch (XmlException e)
            {
                // log this;
                Logger.WriteEvent("XMLException on parsing Semantic Domain file: " + _pathToList + " " + e.Message);
            }
            return(retCount);
        }
Пример #3
0
        //        [ReflectorProperty("guid", Required = false)]
        //        public Guid Guid
        //        {
        //            get
        //            {
        //                if (_guid == null || _guid == Guid.Empty)
        //                {
        //                    return Guid.NewGuid();
        //                }
        //                return _guid;
        //            }
        //            set { _guid = value; }
        //        }

        public override string ToString()
        {
            return(_name.GetFirstAlternative());
        }