private void read_taxon(XmlReader Input_XmlReader, LOM_TaxonPath taxonPath)
        {
            // Create the taxon path object
            LOM_Taxon taxon = new LOM_Taxon();

            // Loop through reading each XML node
            do
            {
                // get the right division information based on node type
                if (Input_XmlReader.NodeType == XmlNodeType.Element)
                {
                    string name = Input_XmlReader.Name.ToLower();
                    if ((lom_namespace.Length > 0) && (name.IndexOf(lom_namespace) == 0))
                        name = name.Substring(lom_namespace.Length);

                    switch (name)
                    {
                        case "id":
                            Input_XmlReader.Read();
                            if ((Input_XmlReader.NodeType == XmlNodeType.Text) && (Input_XmlReader.Value.Trim().Length > 0))
                            {
                                taxon.ID = Input_XmlReader.Value.Trim();
                            }
                            break;

                        case "entry":
                            // Need to gather all the language strings here
                            do
                            {
                                string subname = Input_XmlReader.Name.ToLower();
                                if ((lom_namespace.Length > 0) && (subname.IndexOf(lom_namespace) == 0))
                                    subname = subname.Substring(lom_namespace.Length);

                                // Stop when done looping through the language strings
                                if ((Input_XmlReader.NodeType == XmlNodeType.EndElement) && (subname == "entry"))
                                    break;

                                // Start of a new language string?
                                if ((Input_XmlReader.NodeType == XmlNodeType.Element) && (subname == "langstring"))
                                {
                                    LOM_LanguageString entry = new LOM_LanguageString();
                                    if (Input_XmlReader.MoveToAttribute("lang"))
                                        entry.Language = Input_XmlReader.Value.Trim();
                                    Input_XmlReader.Read();
                                    if ((Input_XmlReader.NodeType == XmlNodeType.Text) && (Input_XmlReader.Value.Trim().Length > 0))
                                    {
                                        entry.Value = Input_XmlReader.Value.Trim();
                                        taxon.Add_Entry(entry);
                                    }
                                }
                            } while (Input_XmlReader.Read());
                            break;
                    }
                }
            } while (Input_XmlReader.Read());

            // Do a little checking here before adding it
            if ((taxon.ID.Length > 0 ) || ( taxon.Entries.Count > 0 ))
                taxonPath.Add_Taxon(taxon);
        }
        private void read_taxonpath(XmlReader Input_XmlReader, LOM_Classification classification)
        {
            // Create the taxon path object
            LOM_TaxonPath taxonPath = new LOM_TaxonPath();

            // Loop through reading each XML node
            do
            {
                // get the right division information based on node type
                if (Input_XmlReader.NodeType == XmlNodeType.Element)
                {
                    string name = Input_XmlReader.Name.ToLower();
                    if ((lom_namespace.Length > 0) && (name.IndexOf(lom_namespace) == 0))
                        name = name.Substring(lom_namespace.Length);

                    switch (name)
                    {
                        case "source":
                            // Need to gather all the language strings here
                            do
                            {
                                string subname = Input_XmlReader.Name.ToLower();
                                if ((lom_namespace.Length > 0) && (subname.IndexOf(lom_namespace) == 0))
                                    subname = subname.Substring(lom_namespace.Length);

                                // Stop when done looping through the language strings
                                if ((Input_XmlReader.NodeType == XmlNodeType.EndElement) && (subname == "source"))
                                    break;

                                // Start of a new language string?
                                if ((Input_XmlReader.NodeType == XmlNodeType.Element) && (subname == "langstring"))
                                {
                                    LOM_LanguageString source = new LOM_LanguageString();
                                    if (Input_XmlReader.MoveToAttribute("lang"))
                                        source.Language = Input_XmlReader.Value.Trim();
                                    Input_XmlReader.Read();
                                    if ((Input_XmlReader.NodeType == XmlNodeType.Text) && (Input_XmlReader.Value.Trim().Length > 0))
                                    {
                                        source.Value = Input_XmlReader.Value.Trim();
                                        taxonPath.Add_SourceName(source);
                                    }
                                }
                            } while (Input_XmlReader.Read());
                            break;

                        case "taxon":
                            read_taxon(Input_XmlReader.ReadSubtree(), taxonPath);
                            break;

                    }
                }
            } while (Input_XmlReader.Read());

            // Do a little checking here before adding it
            if ( taxonPath.Taxons.Count > 0 )
                classification.Add_TaxonPath(taxonPath);
        }
예제 #3
0
 /// <summary> Add a new source name of the classification system ( IEEE-LOM 9.2.1 ) </summary>
 /// <param name="Value"> Name and language of the source classification system </param>
 public void Add_SourceName(LOM_LanguageString Value)
 {
     sourceNames.Add(Value);
 }
        private void read_educational(XmlReader Input_XmlReader, LearningObjectMetadata lomInfo)
        {
            // Loop through reading each XML node
            do
            {
                // get the right division information based on node type
                if (Input_XmlReader.NodeType == XmlNodeType.Element)
                {
                    string name = Input_XmlReader.Name.ToLower();
                    if (( lom_namespace.Length > 0 ) && ( name.IndexOf( lom_namespace ) == 0))
                        name = name.Substring(lom_namespace.Length);

                    switch (name)
                    {
                        //case "requirement":
                        case "interactivitytype":
                            Input_XmlReader.Read();
                            if ((Input_XmlReader.NodeType == XmlNodeType.Text) && (Input_XmlReader.Value.Trim().Length > 0))
                            {
                                string interactivityTemp = Input_XmlReader.Value.Trim();
                                switch( interactivityTemp )
                                {
                                    case "active":
                                        lomInfo.InteractivityType = InteractivityTypeEnum.active;
                                        break;

                                    case "expositive":
                                        lomInfo.InteractivityType = InteractivityTypeEnum.expositive;
                                        break;

                                    case "mixed":
                                        lomInfo.InteractivityType = InteractivityTypeEnum.mixed;
                                        break;
                                }
                            }
                            break;

                        case "learningresourcetype":
                            LOM_VocabularyState learningResourceType = new LOM_VocabularyState();
                            if (Input_XmlReader.MoveToAttribute("source"))
                                learningResourceType.Source = Input_XmlReader.Value.Trim();
                            Input_XmlReader.Read();
                            if ((Input_XmlReader.NodeType == XmlNodeType.Text) && (Input_XmlReader.Value.Trim().Length > 0))
                            {
                                learningResourceType.Value = Input_XmlReader.Value.Trim();
                                lomInfo.Add_LearningResourceType(learningResourceType);
                            }
                            break;

                        case "interactivitylevel":
                            Input_XmlReader.Read();
                            if ((Input_XmlReader.NodeType == XmlNodeType.Text) && (Input_XmlReader.Value.Trim().Length > 0))
                            {
                                string interactivityLevelTemp = Input_XmlReader.Value.ToLower().Trim();
                                switch( interactivityLevelTemp )
                                {
                                    case "very low":
                                        lomInfo.InteractivityLevel = InteractivityLevelEnum.very_low;
                                        break;

                                    case "low":
                                        lomInfo.InteractivityLevel = InteractivityLevelEnum.low;
                                        break;

                                    case "medium":
                                        lomInfo.InteractivityLevel = InteractivityLevelEnum.medium;
                                        break;

                                    case "high":
                                        lomInfo.InteractivityLevel = InteractivityLevelEnum.high;
                                        break;

                                    case "very high":
                                        lomInfo.InteractivityLevel = InteractivityLevelEnum.very_high;
                                        break;
                                }
                            }
                            break;

                        case "intendedenduserrole":
                            Input_XmlReader.Read();
                            if ((Input_XmlReader.NodeType == XmlNodeType.Text) && (Input_XmlReader.Value.Trim().Length > 0))
                            {
                                string endUserRoleTemp = Input_XmlReader.Value.ToLower().Trim();
                                switch (endUserRoleTemp)
                                {
                                    case "teacher":
                                        lomInfo.Add_IntendedEndUserRole( IntendedEndUserRoleEnum.teacher);
                                        break;

                                    case "author":
                                        lomInfo.Add_IntendedEndUserRole( IntendedEndUserRoleEnum.author);
                                        break;

                                    case "learner":
                                        lomInfo.Add_IntendedEndUserRole( IntendedEndUserRoleEnum.learner);
                                        break;

                                    case "manager":
                                        lomInfo.Add_IntendedEndUserRole( IntendedEndUserRoleEnum.manager);
                                        break;
                                }
                            }
                            break;

                        case "context":
                            LOM_VocabularyState context = new LOM_VocabularyState();
                            if (Input_XmlReader.MoveToAttribute("source"))
                                context.Source = Input_XmlReader.Value.Trim();
                            Input_XmlReader.Read();
                            if ((Input_XmlReader.NodeType == XmlNodeType.Text) && (Input_XmlReader.Value.Trim().Length > 0))
                            {
                                context.Value = Input_XmlReader.Value.Trim();
                                lomInfo.Add_Context(context);
                            }
                            break;

                        case "typicalagerange":
                            // Need to gather all the language strings here
                            do
                            {
                                string subname = Input_XmlReader.Name.ToLower();
                                if (( lom_namespace.Length > 0 ) && ( subname.IndexOf( lom_namespace ) == 0))
                                    subname = subname.Substring(lom_namespace.Length);

                                // Stop when done looping through the language strings
                                if ((Input_XmlReader.NodeType == XmlNodeType.EndElement) && (subname == "typicalagerange"))
                                    break;

                                // Start of a new language string?
                                if (( Input_XmlReader.NodeType == XmlNodeType.Element ) && ( subname == "langstring" ))
                                {
                                    LOM_LanguageString agerange = new LOM_LanguageString();
                                    if (Input_XmlReader.MoveToAttribute("lang"))
                                        agerange.Language = Input_XmlReader.Value.Trim();
                                    Input_XmlReader.Read();
                                    if ((Input_XmlReader.NodeType == XmlNodeType.Text) && (Input_XmlReader.Value.Trim().Length > 0))
                                    {
                                        agerange.Value = Input_XmlReader.Value.Trim();
                                        lomInfo.Add_TypicalAgeRange(agerange);
                                    }
                                }
                            } while (Input_XmlReader.Read());
                            break;

                        case "difficulty":
                            Input_XmlReader.Read();
                            if ((Input_XmlReader.NodeType == XmlNodeType.Text) && (Input_XmlReader.Value.Trim().Length > 0))
                            {
                                string difficultyTemp = Input_XmlReader.Value.ToLower().Trim();
                                switch (difficultyTemp)
                                {
                                    case "very easy":
                                        lomInfo.DifficultyLevel = DifficultyLevelEnum.very_easy;
                                        break;

                                    case "easy":
                                        lomInfo.DifficultyLevel = DifficultyLevelEnum.easy;
                                        break;

                                    case "medium":
                                        lomInfo.DifficultyLevel = DifficultyLevelEnum.medium;
                                        break;

                                    case "difficult":
                                        lomInfo.DifficultyLevel = DifficultyLevelEnum.difficult;
                                        break;

                                    case "very difficult":
                                        lomInfo.DifficultyLevel = DifficultyLevelEnum.very_difficult;
                                        break;
                                }
                            }
                            break;

                        case "typicallearningtime":
                            // Need to gather all the language strings here
                            do
                            {
                                string subname = Input_XmlReader.Name.ToLower();
                                if ((lom_namespace.Length > 0) && (subname.IndexOf(lom_namespace) == 0))
                                    subname = subname.Substring(lom_namespace.Length);

                                // Stop when done looping through the language strings
                                if ((Input_XmlReader.NodeType == XmlNodeType.EndElement) && (subname == "typicallearningtime"))
                                    break;

                                // Start of a new language string?
                                if ((Input_XmlReader.NodeType == XmlNodeType.Element) && (subname == "duration"))
                                {
                                    Input_XmlReader.Read();
                                    if ((Input_XmlReader.NodeType == XmlNodeType.Text) && (Input_XmlReader.Value.Trim().Length > 0))
                                    {
                                        lomInfo.TypicalLearningTime = Input_XmlReader.Value.Trim();
                                    }
                                }
                            } while (Input_XmlReader.Read());
                            break;
                    }
                }
            } while (Input_XmlReader.Read());
        }
 /// <summary> Add a new typical age range ( IEEE-LOM 5.7 )  </summary>
 /// <param name="Value"></param>
 public void Add_TypicalAgeRange(LOM_LanguageString Value)
 {
     typicalAgeRange.Add(Value);
 }
 /// <summary> Add a new taxonomic entry to this taxonomy ( IEEE-LOM 9.2.2.2 ) </summary>
 /// <param name="Entry"> New taxonomic term to add </param>
 public void Add_Entry(LOM_LanguageString Entry)
 {
     entries.Add(Entry);
 }
 /// <summary> Add a new source name of the classification system ( IEEE-LOM 9.2.1 ) </summary>
 /// <param name="Value"> Name and language of the source classification system </param>
 public void Add_SourceName( LOM_LanguageString Value)
 {
     sourceNames.Add( Value );
 }
 /// <summary> Add a new typical age range ( IEEE-LOM 5.7 )  </summary>
 /// <param name="Value"></param>
 public void Add_TypicalAgeRange(LOM_LanguageString Value)
 {
     typicalAgeRange.Add( Value );
 }
예제 #9
0
 /// <summary> Add a new taxonomic entry to this taxonomy ( IEEE-LOM 9.2.2.2 ) </summary>
 /// <param name="Entry"> New taxonomic term to add </param>
 public void Add_Entry(LOM_LanguageString Entry)
 {
     entries.Add(Entry);
 }