コード例 #1
0
        /// <summary> Saves the data rendered by this element to the provided bibliographic object during postback </summary>
        /// <param name="Bib"> Object into which to save the user's data, entered into the html rendered by this element </param>
        public override void Save_To_Bib(SobekCM_Item Bib)
        {
            string[] getKeys = HttpContext.Current.Request.Form.AllKeys;
            foreach (string thisKey in getKeys)
            {
                if (thisKey.IndexOf(html_element_name.Replace("_", "")) == 0)
                {
                    Thesis_Dissertation_Info etdInfo = Bib.Get_Metadata_Module(GlobalVar.THESIS_METADATA_MODULE_KEY) as Thesis_Dissertation_Info;

                    string value = HttpContext.Current.Request.Form[thisKey];
                    if (value.Length > 0)
                    {
                        if (etdInfo == null)
                        {
                            etdInfo = new Thesis_Dissertation_Info();
                            Bib.Add_Metadata_Module(GlobalVar.THESIS_METADATA_MODULE_KEY, etdInfo);
                        }
                        etdInfo.Committee_Chair = value;
                    }
                    else
                    {
                        if (etdInfo != null)
                            etdInfo.Committee_Chair = String.Empty;
                    }
                    return;
                }
            }
        }
        /// <summary> Reads the dmdSec at the current position in the XmlTextReader and associates it with the 
        /// entire package  </summary>
        /// <param name="Input_XmlReader"> Open XmlReader from which to read the metadata </param>
        /// <param name="Return_Package"> Package into which to read the metadata</param>
        /// <param name="Options"> Dictionary of any options which this METS section reader may utilize</param>
        /// <returns> TRUE if successful, otherwise FALSE</returns>
        public bool Read_dmdSec(XmlReader Input_XmlReader, SobekCM_Item Return_Package, Dictionary<string, object> Options)
        {
            // Ensure this metadata module extension exists
            Thesis_Dissertation_Info thesisInfo = Return_Package.Get_Metadata_Module(GlobalVar.THESIS_METADATA_MODULE_KEY) as Thesis_Dissertation_Info;
            if (thesisInfo == null)
            {
                thesisInfo = new Thesis_Dissertation_Info();
                Return_Package.Add_Metadata_Module(GlobalVar.THESIS_METADATA_MODULE_KEY, thesisInfo);
            }

            // Loop through reading each XML node
            do
            {
                // If this is the end of this section, return
                if ((Input_XmlReader.NodeType == XmlNodeType.EndElement) && ((Input_XmlReader.Name == "METS:mdWrap") || (Input_XmlReader.Name == "mdWrap")))
                    return true;

                // get the right division information based on node type
                if (Input_XmlReader.NodeType == XmlNodeType.Element)
                {
                    string name = Input_XmlReader.Name.ToLower();
                    if (name.IndexOf("palmm:") == 0)
                        name = name.Substring(6);
                    if (name.IndexOf("etd:") == 0)
                        name = name.Substring(4);

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

                        case "committeecochair":
                            Input_XmlReader.Read();
                            if ((Input_XmlReader.NodeType == XmlNodeType.Text) && (Input_XmlReader.Value.Trim().Length > 0))
                            {
                                thesisInfo.Committee_Co_Chair = Input_XmlReader.Value.Trim();
                            }
                            break;

                        case "committeemember":
                            Input_XmlReader.Read();
                            if ((Input_XmlReader.NodeType == XmlNodeType.Text) && (Input_XmlReader.Value.Trim().Length > 0))
                            {
                                thesisInfo.Add_Committee_Member(Input_XmlReader.Value);
                            }
                            break;

                        case "graduationdate":
                            Input_XmlReader.Read();
                            if ((Input_XmlReader.NodeType == XmlNodeType.Text) && (Input_XmlReader.Value.Trim().Length > 0))
                            {
                                DateTime convertedDate;
                                if (DateTime.TryParse(Input_XmlReader.Value, out convertedDate))
                                {
                                    thesisInfo.Graduation_Date = convertedDate;
                                }
                            }
                            break;

                        case "degree":
                            Input_XmlReader.Read();
                            if ((Input_XmlReader.NodeType == XmlNodeType.Text) && (Input_XmlReader.Value.Trim().Length > 0))
                            {
                                thesisInfo.Degree = Input_XmlReader.Value;
                            }
                            break;

                        case "degreediscipline":
                            Input_XmlReader.Read();
                            if ((Input_XmlReader.NodeType == XmlNodeType.Text) && (Input_XmlReader.Value.Trim().Length > 0))
                            {
                                string degreeDiscipline = Input_XmlReader.Value;
                                if (degreeDiscipline.IndexOf(";") > 0)
                                {
                                    string[] splitter = degreeDiscipline.Split(";".ToCharArray());
                                    foreach (string thisSplit in splitter)
                                        thesisInfo.Add_Degree_Discipline(thisSplit);
                                }
                                else
                                {
                                    thesisInfo.Add_Degree_Discipline(degreeDiscipline);
                                }
                            }
                            break;

                        case "degreedivision":
                            Input_XmlReader.Read();
                            if ((Input_XmlReader.NodeType == XmlNodeType.Text) && (Input_XmlReader.Value.Trim().Length > 0))
                            {
                                string degreeDivision = Input_XmlReader.Value;
                                if (degreeDivision.IndexOf(";") > 0)
                                {
                                    string[] splitter = degreeDivision.Split(";".ToCharArray());
                                    foreach (string thisSplit in splitter)
                                        thesisInfo.Add_Degree_Division(thisSplit);
                                }
                                else
                                {
                                    thesisInfo.Add_Degree_Division(degreeDivision);
                                }
                            }
                            break;

                        case "degreegrantor":
                            Input_XmlReader.Read();
                            if ((Input_XmlReader.NodeType == XmlNodeType.Text) && (Input_XmlReader.Value.Trim().Length > 0))
                            {
                                thesisInfo.Degree_Grantor = Input_XmlReader.Value;
                            }
                            break;

                        case "degreelevel":
                            Input_XmlReader.Read();
                            if ((Input_XmlReader.NodeType == XmlNodeType.Text) && (Input_XmlReader.Value.Trim().Length > 0))
                            {
                                string temp = Input_XmlReader.Value.ToLower();
                                if ((temp == "doctorate") || (temp == "doctoral"))
                                    thesisInfo.Degree_Level = Thesis_Dissertation_Info.Thesis_Degree_Level_Enum.Doctorate;
                                if ((temp == "masters") || (temp == "master's"))
                                    thesisInfo.Degree_Level = Thesis_Dissertation_Info.Thesis_Degree_Level_Enum.Masters;
                                if ((temp == "bachelors") || ( temp ==  "bachelor's"))
                                    thesisInfo.Degree_Level = Thesis_Dissertation_Info.Thesis_Degree_Level_Enum.Bachelors;
                                if ((temp == "post-doctorate") || ( temp ==  "post-doctoral"))
                                    thesisInfo.Degree_Level = Thesis_Dissertation_Info.Thesis_Degree_Level_Enum.Bachelors;

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

            return true;
        }
コード例 #3
0
        /// <summary> Saves the data rendered by this element to the provided bibliographic object during postback </summary>
        /// <param name="Bib"> Object into which to save the user's data, entered into the html rendered by this element </param>
        public override void Save_To_Bib(SobekCM_Item Bib)
        {
            string[] getKeys = HttpContext.Current.Request.Form.AllKeys;
            foreach (string thisKey in getKeys)
            {
                if (thisKey.IndexOf(html_element_name.Replace("_", "")) == 0)
                {
                    Thesis_Dissertation_Info etdInfo = Bib.Get_Metadata_Module(GlobalVar.THESIS_METADATA_MODULE_KEY) as Thesis_Dissertation_Info;

                    string value = HttpContext.Current.Request.Form[thisKey].Trim().ToLower();
                    if (value.Length > 0)
                    {
                        if (etdInfo == null)
                        {
                            etdInfo = new Thesis_Dissertation_Info();
                            Bib.Add_Metadata_Module(GlobalVar.THESIS_METADATA_MODULE_KEY, etdInfo);
                        }
                        switch (value)
                        {
                            case "bachelors":
                                etdInfo.Degree_Level = Thesis_Dissertation_Info.Thesis_Degree_Level_Enum.Bachelors;
                                break;

                            case "doctorate":
                                etdInfo.Degree_Level = Thesis_Dissertation_Info.Thesis_Degree_Level_Enum.Doctorate;
                                break;

                            case "masters":
                                etdInfo.Degree_Level = Thesis_Dissertation_Info.Thesis_Degree_Level_Enum.Masters;
                                break;

                            case "post-doctoratee":
                                etdInfo.Degree_Level = Thesis_Dissertation_Info.Thesis_Degree_Level_Enum.PostDoctorate;
                                break;

                            default:
                                etdInfo.Degree_Level = Thesis_Dissertation_Info.Thesis_Degree_Level_Enum.Unknown;
                                break;
                        }
                    }
                    else
                    {
                        if (etdInfo != null)
                            etdInfo.Degree_Level = Thesis_Dissertation_Info.Thesis_Degree_Level_Enum.Unknown;
                    }
                    return;
                }
            }
        }
コード例 #4
0
        /// <summary> Reads the Dublin Core-compliant section of XML and stores the data in the provided digital resource </summary>
        /// <param name="R"> XmlTextReader from which to read the dublin core data </param>
        /// <param name="BibInfo"> Digital resource object to save the data to </param>
        /// <param name="Return_Package"> The return package, if this is reading a top-level section of dublin core </param>
        public static void Read_Simple_Dublin_Core_Info(XmlReader R, Bibliographic_Info BibInfo, SobekCM_Item Return_Package )
        {
            while (R.Read())
            {
                if ((R.NodeType == XmlNodeType.EndElement) && ((R.Name == "METS:mdWrap") || (R.Name == "mdWrap")))
                    return;

                if (R.NodeType == XmlNodeType.Element)
                {
                    switch (R.Name)
                    {
                        case "dc:contributor":
                            R.Read();
                            if ((R.NodeType == XmlNodeType.Text) && (R.Value.Trim().Length > 0))
                            {
                                BibInfo.Add_Named_Entity(R.Value.Trim(), "Contributor");
                            }
                            break;

                        case "dc:coverage":
                            R.Read();
                            if ((R.NodeType == XmlNodeType.Text) && (R.Value.Trim().Length > 0))
                            {
                                Subject_Info_Standard thisSubject = new Subject_Info_Standard();
                                thisSubject.Add_Geographic(R.Value.Trim());
                                BibInfo.Add_Subject(thisSubject);
                            }
                            break;

                        case "dc:creator":
                            R.Read();
                            if ((R.NodeType == XmlNodeType.Text) && (R.Value.Trim().Length > 0))
                            {
                                if (BibInfo.Main_Entity_Name.hasData)
                                {
                                    BibInfo.Add_Named_Entity(R.Value.Trim());
                                }
                                else
                                {
                                    BibInfo.Main_Entity_Name.Full_Name = R.Value.Trim();
                                }
                            }
                            break;

                        case "dc:date":
                            R.Read();
                            if ((R.NodeType == XmlNodeType.Text) && (R.Value.Trim().Length > 0))
                            {
                                BibInfo.Origin_Info.Date_Issued = R.Value.Trim();
                            }
                            break;

                        case "dc:description":
                            R.Read();
                            if ((R.NodeType == XmlNodeType.Text) && (R.Value.Trim().Length > 0))
                            {
                                BibInfo.Add_Note(R.Value.Trim());
                            }
                            break;

                        case "dc:format":
                            R.Read();
                            if ((R.NodeType == XmlNodeType.Text) && (R.Value.Trim().Length > 0))
                            {
                                BibInfo.Original_Description.Extent = R.Value.Trim();
                            }
                            break;

                        case "dc:identifier":
                            R.Read();
                            if ((R.NodeType == XmlNodeType.Text) && (R.Value.Trim().Length > 0))
                            {
                                BibInfo.Add_Identifier(R.Value.Trim());
                            }
                            break;

                        case "dc:language":
                            R.Read();
                            if ((R.NodeType == XmlNodeType.Text) && (R.Value.Trim().Length > 0))
                            {
                                BibInfo.Add_Language(R.Value.Trim());
                            }
                            break;

                        case "dc:publisher":
                            R.Read();
                            if ((R.NodeType == XmlNodeType.Text) && (R.Value.Trim().Length > 0))
                            {
                                BibInfo.Add_Publisher(R.Value.Trim());
                            }
                            break;

                        case "dc:relation":
                            R.Read();
                            if ((R.NodeType == XmlNodeType.Text) && (R.Value.Trim().Length > 0))
                            {
                                Related_Item_Info newRelatedItem = new Related_Item_Info();
                                newRelatedItem.Main_Title.Title = R.Value.Trim();
                                BibInfo.Add_Related_Item(newRelatedItem);
                            }
                            break;

                        case "dc:rights":
                            R.Read();
                            if ((R.NodeType == XmlNodeType.Text) && (R.Value.Trim().Length > 0))
                            {
                                BibInfo.Access_Condition.Text = R.Value.Trim();
                            }
                            break;

                        case "dc:source":
                            R.Read();
                            if ((R.NodeType == XmlNodeType.Text) && (R.Value.Trim().Length > 0))
                            {
                                BibInfo.Add_Note(R.Value, Note_Type_Enum.source);
                            }
                            break;

                        case "dc:subject":
                            R.Read();
                            if ((R.NodeType == XmlNodeType.Text) && (R.Value.Trim().Length > 0))
                            {
                                if (R.Value.IndexOf(";") > 0)
                                {
                                    string[] splitter = R.Value.Split(";".ToCharArray());
                                    foreach (string thisSplit in splitter)
                                    {
                                        BibInfo.Add_Subject(thisSplit.Trim(), String.Empty);
                                    }
                                }
                                else
                                {
                                    BibInfo.Add_Subject(R.Value.Trim(), String.Empty);
                                }
                            }
                            break;

                        case "dc:title":
                            R.Read();
                            if ((R.NodeType == XmlNodeType.Text) && (R.Value.Trim().Length > 0))
                            {
                                if (BibInfo.Main_Title.Title.Length == 0)
                                {
                                    BibInfo.Main_Title.Title = R.Value.Trim();
                                }
                                else
                                {
                                    BibInfo.Add_Other_Title(R.Value.Trim(), Title_Type_Enum.alternative);
                                }
                            }
                            break;

                        case "dc:type":
                            R.Read();
                            if ((R.NodeType == XmlNodeType.Text) && (R.Value.Trim().Length > 0))
                            {
                                BibInfo.Type.Add_Uncontrolled_Type(R.Value.Trim());
                            }
                            break;

                        case "thesis.degree.name":
                            R.Read();
                            if ((R.NodeType == XmlNodeType.Text) && (R.Value.Trim().Length > 0) && ( Return_Package != null ))
                            {
                                // Ensure the thesis object exists and is added
                                Thesis_Dissertation_Info thesisInfo = Return_Package.Get_Metadata_Module(GlobalVar.THESIS_METADATA_MODULE_KEY) as Thesis_Dissertation_Info;
                                if (thesisInfo == null)
                                {
                                    thesisInfo = new Thesis_Dissertation_Info();
                                    Return_Package.Add_Metadata_Module(GlobalVar.THESIS_METADATA_MODULE_KEY, thesisInfo);
                                }

                                thesisInfo.Degree = R.Value.Trim();
                            }
                            break;

                        case "thesis.degree.level":
                            R.Read();
                            if ((R.NodeType == XmlNodeType.Text) && (R.Value.Trim().Length > 0) && (Return_Package != null))
                            {
                                // Ensure the thesis object exists and is added
                                Thesis_Dissertation_Info thesisInfo = Return_Package.Get_Metadata_Module(GlobalVar.THESIS_METADATA_MODULE_KEY) as Thesis_Dissertation_Info;
                                if (thesisInfo == null)
                                {
                                    thesisInfo = new Thesis_Dissertation_Info();
                                    Return_Package.Add_Metadata_Module(GlobalVar.THESIS_METADATA_MODULE_KEY, thesisInfo);
                                }

                                string temp = R.Value.Trim().ToLower();
                                if ((temp == "doctorate") || (temp == "doctoral"))
                                    thesisInfo.Degree_Level = Thesis_Dissertation_Info.Thesis_Degree_Level_Enum.Doctorate;
                                if ((temp == "masters") || (temp == "master's"))
                                    thesisInfo.Degree_Level = Thesis_Dissertation_Info.Thesis_Degree_Level_Enum.Masters;
                                if ((temp == "bachelors") || (temp == "bachelor's"))
                                    thesisInfo.Degree_Level = Thesis_Dissertation_Info.Thesis_Degree_Level_Enum.Bachelors;
                                if ((temp == "post-doctorate") || (temp == "post-doctoral"))
                                    thesisInfo.Degree_Level = Thesis_Dissertation_Info.Thesis_Degree_Level_Enum.Bachelors;
                            }
                            break;

                        case "thesis.degree.discipline":
                            R.Read();
                            if ((R.NodeType == XmlNodeType.Text) && (R.Value.Trim().Length > 0) && (Return_Package != null))
                            {
                                // Ensure the thesis object exists and is added
                                Thesis_Dissertation_Info thesisInfo = Return_Package.Get_Metadata_Module(GlobalVar.THESIS_METADATA_MODULE_KEY) as Thesis_Dissertation_Info;
                                if (thesisInfo == null)
                                {
                                    thesisInfo = new Thesis_Dissertation_Info();
                                    Return_Package.Add_Metadata_Module(GlobalVar.THESIS_METADATA_MODULE_KEY, thesisInfo);
                                }

                                thesisInfo.Add_Degree_Discipline(R.Value.Trim());
                            }
                            break;

                        case "thesis.degree.grantor":
                            R.Read();
                            if ((R.NodeType == XmlNodeType.Text) && (R.Value.Trim().Length > 0) && (Return_Package != null))
                            {
                                // Ensure the thesis object exists and is added
                                Thesis_Dissertation_Info thesisInfo = Return_Package.Get_Metadata_Module(GlobalVar.THESIS_METADATA_MODULE_KEY) as Thesis_Dissertation_Info;
                                if (thesisInfo == null)
                                {
                                    thesisInfo = new Thesis_Dissertation_Info();
                                    Return_Package.Add_Metadata_Module(GlobalVar.THESIS_METADATA_MODULE_KEY, thesisInfo);
                                }

                                thesisInfo.Degree_Grantor = R.Value.Trim();
                            }
                            break;
                    }
                }
            }
        }