/// <summary> Flag indicates if this active reader/writer will write a dmdSec </summary>
 /// <param name="METS_Item"> Package with all the metadata to save</param>
 /// <param name="Options"> Dictionary of any options which this METS section writer may utilize</param>
 /// <returns> TRUE if the package has data to be written, otherwise fALSE </returns>
 public bool Include_dmdSec(SobekCM_Item METS_Item, Dictionary<string, object> Options)
 {
     // Ensure this metadata module extension exists and has data
     Zoological_Taxonomy_Info taxonInfo = METS_Item.Get_Metadata_Module(GlobalVar.ZOOLOGICAL_TAXONOMY_METADATA_MODULE_KEY) as Zoological_Taxonomy_Info;
     if ((taxonInfo == null) || (!taxonInfo.hasData))
         return false;
     return true;
 }
 /// <summary> Flag indicates if this active reader/writer will write an amdSec </summary>
 /// <param name="METS_Item"> Package with all the metadata to save</param>
 /// <param name="Options"> Dictionary of any options which this METS section writer may utilize</param>
 /// <returns> TRUE if the package has data to be written, otherwise fALSE </returns>
 public bool Include_amdSec(SobekCM_Item METS_Item, Dictionary<string, object> Options)
 {
     // Ensure this metadata module extension exists and has data
     DAITSS_Info daitssInfo = METS_Item.Get_Metadata_Module(GlobalVar.DAITSS_METADATA_MODULE_KEY) as DAITSS_Info;
     if ((daitssInfo == null) || (!daitssInfo.hasData))
         return false;
     return true;
 }
 /// <summary> Flag indicates if this active reader/writer will write a dmdSec </summary>
 /// <param name="METS_Item"> Package with all the metadata to save</param>
 /// <param name="Options"> Dictionary of any options which this METS section writer may utilize</param>
 /// <returns> TRUE if the package has data to be written, otherwise fALSE </returns>
 public bool Include_dmdSec(SobekCM_Item METS_Item, Dictionary<string, object> Options)
 {
     // Ensure this metadata module extension exists and has data
     LearningObjectMetadata lomInfo = METS_Item.Get_Metadata_Module(GlobalVar.IEEE_LOM_METADATA_MODULE_KEY) as LearningObjectMetadata;
     if ((lomInfo == null) || (!lomInfo.hasData))
         return false;
     return true;
 }
 /// <summary> Flag indicates if this active reader/writer will write a dmdSec </summary>
 /// <param name="METS_Item"> Package with all the metadata to save</param>
 /// <returns> TRUE if the package has data to be written, otherwise fALSE </returns>
 public bool Include_dmdSec(SobekCM_Item METS_Item, Dictionary<string, object> Options)
 {
     // Ensure this metadata module extension exists and has data
     VRACore_Info vraInfo = METS_Item.Get_Metadata_Module(GlobalVar.VRACORE_METADATA_MODULE_KEY) as VRACore_Info;
     if ((vraInfo == null) || (!vraInfo.hasData))
         return false;
     return true;
 }
 /// <summary> Flag indicates if this active reader/writer will write an amdSec </summary>
 /// <param name="METS_Item"> Package with all the metadata to save</param>
 /// <param name="Options"> Dictionary of any options which this METS section writer may utilize</param>
 /// <returns> TRUE if the package has data to be written, otherwise fALSE </returns>
 public bool Include_amdSec(SobekCM_Item METS_Item, Dictionary<string, object> Options)
 {
     // Ensure this metadata module extension exists and has data
     RightsMD_Info rightsInfo = METS_Item.Get_Metadata_Module( GlobalVar.PALMM_RIGHTSMD_METADATA_MODULE_KEY)  as RightsMD_Info;
     if ((rightsInfo == null) || (!rightsInfo.hasData))
         return false;
     return true;
 }
 /// <summary> Flag indicates if this active reader/writer will write a dmdSec </summary>
 /// <param name="METS_Item"> Package with all the metadata to save</param>
 /// <param name="Options"> Dictionary of any options which this METS section writer may utilize</param>
 /// <returns> TRUE if the package has data to be written, otherwise fALSE </returns>
 public bool Include_dmdSec(SobekCM_Item METS_Item, Dictionary<string, object> Options)
 {
     // GEt the geo-spatial information if it exists
     GeoSpatial_Information geoInfo = METS_Item.Get_Metadata_Module(GlobalVar.GEOSPATIAL_METADATA_MODULE_KEY) as GeoSpatial_Information;
     if ((geoInfo == null) || (!geoInfo.hasData))
         return false;
     return true;
 }
 /// <summary> Flag indicates if this active reader/writer will write a dmdSec </summary>
 /// <param name="METS_Item"> Package with all the metadata to save</param>
 /// <param name="Options"> Dictionary of any options which this METS section writer may utilize</param>
 /// <returns> TRUE if the package has data to be written, otherwise fALSE </returns>
 public bool Include_dmdSec(SobekCM_Item METS_Item, Dictionary<string, object> Options)
 {
     // Ensure this metadata module extension exists and has data
     Thesis_Dissertation_Info thesisInfo = METS_Item.Get_Metadata_Module(GlobalVar.THESIS_METADATA_MODULE_KEY) as Thesis_Dissertation_Info;
     if ((thesisInfo == null) || (!thesisInfo.hasData))
         return false;
     return true;
 }
 /// <summary> Flag indicates if this active reader/writer will write a dmdSec </summary>
 /// <param name="METS_Item"> Package with all the metadata to save</param>
 /// <param name="Options"> Dictionary of any options which this METS section writer may utilize</param>
 /// <returns> TRUE if the package has data to be written, otherwise fALSE </returns>
 public bool Include_dmdSec(SobekCM_Item METS_Item, Dictionary<string, object> Options)
 {
     // Ensure this metadata module extension exists and has data
     Map_Info mapInfo = METS_Item.Get_Metadata_Module(GlobalVar.SOBEKCM_MAPS_METADATA_MODULE_KEY) as Map_Info;
     if ((mapInfo == null) || (!mapInfo.hasData))
         return false;
     return true;
 }
        /// <summary> Writes the dmdSec for the entire package to the text writer </summary>
        /// <param name="Output_Stream">Stream to which the formatted text is written </param>
        /// <param name="METS_Item">Package with all the metadata to save</param>
        /// <param name="Options"> Dictionary of any options which this METS section writer may utilize</param>
        /// <returns>TRUE if successful, otherwise FALSE </returns>
        public override bool Write_dmdSec(TextWriter Output_Stream, SobekCM_Item METS_Item, Dictionary<string, object> Options)
        {
            // Ensure this metadata module extension exists and has data
            Thesis_Dissertation_Info thesisInfo = METS_Item.Get_Metadata_Module(GlobalVar.THESIS_METADATA_MODULE_KEY) as Thesis_Dissertation_Info;
            if ((thesisInfo == null) || (!thesisInfo.hasData))
                return true;

            Output_Stream.WriteLine("<palmm:thesis>");
            if (!String.IsNullOrEmpty(thesisInfo.Committee_Chair))
                Output_Stream.WriteLine("<palmm:committeeChair>" + Convert_String_To_XML_Safe(thesisInfo.Committee_Chair) + "</palmm:committeeChair>");
            if (!String.IsNullOrEmpty(thesisInfo.Committee_Co_Chair))
                Output_Stream.WriteLine("<palmm:committeeCoChair>" + Convert_String_To_XML_Safe(thesisInfo.Committee_Co_Chair) + "</palmm:committeeCoChair>");
            if (thesisInfo.Committee_Members_Count > 0)
            {
                foreach (string thisCommitteeMember in thesisInfo.Committee_Members)
                {
                    Output_Stream.WriteLine("<palmm:committeeMember>" + Convert_String_To_XML_Safe(thisCommitteeMember) + "</palmm:committeeMember>");
                }
            }
            if (thesisInfo.Graduation_Date.HasValue)
            {
                string encoded_date = thesisInfo.Graduation_Date.Value.Year + "-" + thesisInfo.Graduation_Date.Value.Month.ToString().PadLeft(2, '0') + "-" + thesisInfo.Graduation_Date.Value.Day.ToString().PadLeft(2, '0');
                Output_Stream.WriteLine("<palmm:graduationDate>" + encoded_date + "</palmm:graduationDate>");
            }
            if (!String.IsNullOrEmpty(thesisInfo.Degree))
                Output_Stream.WriteLine("<palmm:degree>" + Convert_String_To_XML_Safe(thesisInfo.Degree) + "</palmm:degree>");
            if (thesisInfo.Degree_Disciplines_Count > 0)
            {
                if ( thesisInfo.Degree_Disciplines_Count == 1 )
                    Output_Stream.WriteLine("<palmm:degreeDiscipline>" + Convert_String_To_XML_Safe(thesisInfo.Degree_Disciplines[0]) + "</palmm:degreeDiscipline>");
                else
                {
                    Output_Stream.Write("<palmm:degreeDiscipline>");
                    bool first = true;
                    foreach (string thisDiscipline in thesisInfo.Degree_Disciplines)
                    {
                        if ( !first )
                            Output_Stream.Write(";");
                        else
                            first = false;

                        Output_Stream.Write( Convert_String_To_XML_Safe(thisDiscipline));
                    }
                    Output_Stream.WriteLine("</palmm:degreeDiscipline>");
                }
            }
            if (!String.IsNullOrEmpty(thesisInfo.Degree_Grantor))
                Output_Stream.WriteLine("<palmm:degreeGrantor>" + Convert_String_To_XML_Safe(thesisInfo.Degree_Grantor) + "</palmm:degreeGrantor>");
            if (thesisInfo.Degree_Level == Thesis_Dissertation_Info.Thesis_Degree_Level_Enum.Bachelors)
                Output_Stream.WriteLine("<palmm:degreeLevel>Bachelors</palmm:degreeLevel>");
            if (thesisInfo.Degree_Level == Thesis_Dissertation_Info.Thesis_Degree_Level_Enum.Masters)
                Output_Stream.WriteLine("<palmm:degreeLevel>Masters</palmm:degreeLevel>");
            if (thesisInfo.Degree_Level == Thesis_Dissertation_Info.Thesis_Degree_Level_Enum.Doctorate)
                Output_Stream.WriteLine("<palmm:degreeLevel>Doctorate</palmm:degreeLevel>");
            Output_Stream.WriteLine("</palmm:thesis>");
            return true;
        }
        /// <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)
        {
            // Get the geo-spatial information if it exists or create a new one
            GeoSpatial_Information geoInfo = Return_Package.Get_Metadata_Module(GlobalVar.GEOSPATIAL_METADATA_MODULE_KEY) as GeoSpatial_Information;
            if (geoInfo == null)
            {
                geoInfo = new GeoSpatial_Information();
                Return_Package.Add_Metadata_Module(GlobalVar.GEOSPATIAL_METADATA_MODULE_KEY, geoInfo);
            }

            return Read_Metadata_Section(Input_XmlReader, geoInfo, Options);
        }
        /// <summary> Saves the data stored in this instance of the
        /// element to the provided bibliographic object </summary>
        /// <param name="Bib"> Object to populate this element from </param>
        public override void Populate_From_Bib(SobekCM_Item Bib)
        {
            Thesis_Dissertation_Info thesisInfo = Bib.Get_Metadata_Module(GlobalVar.THESIS_METADATA_MODULE_KEY) as Thesis_Dissertation_Info;

            if (thesisInfo != null)
            {
                if (thesisInfo.Graduation_Date.HasValue)
                {
                    base.thisBox.Text = thesisInfo.Graduation_Date.Value.ToShortDateString();
                }
            }
        }
        /// <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
            LearningObjectMetadata lomInfo = Return_Package.Get_Metadata_Module(GlobalVar.IEEE_LOM_METADATA_MODULE_KEY) as LearningObjectMetadata;
            if (lomInfo == null)
            {
                lomInfo = new LearningObjectMetadata();
                Return_Package.Add_Metadata_Module(GlobalVar.IEEE_LOM_METADATA_MODULE_KEY, lomInfo);
            }

            // 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 (( lom_namespace.Length > 0 ) && ( name.IndexOf( lom_namespace ) == 0))
                        name = name.Substring(lom_namespace.Length);

                    switch (name)
                    {
                        case "general":
                            read_general(Input_XmlReader.ReadSubtree(), lomInfo);
                            break;

                        case "lifecycle":
                            read_lifecycle(Input_XmlReader.ReadSubtree(), lomInfo);
                            break;

                        case "technical":
                            read_technical(Input_XmlReader.ReadSubtree(), lomInfo);
                            break;

                        case "educational":
                            read_educational(Input_XmlReader.ReadSubtree(), lomInfo);
                            break;

                        case "classification":
                            read_classification(Input_XmlReader.ReadSubtree(), lomInfo);
                            break;

                    }
                }

            } while (Input_XmlReader.Read());

            return true;
        }
Esempio n. 13
0
        /// <summary> Writes the dmdSec for the entire package to the text writer </summary>
        /// <param name="Output_Stream">Stream to which the formatted text is written </param>
        /// <param name="METS_Item">Package with all the metadata to save</param>
        /// <param name="Options"> Dictionary of any options which this METS section writer may utilize</param>
        /// <returns>TRUE if successful, otherwise FALSE </returns>
        public bool Write_dmdSec(TextWriter Output_Stream, SobekCM_Item METS_Item, Dictionary <string, object> Options)
        {
            // GEt the geo-spatial information if it exists
            GeoSpatial_Information geoInfo = METS_Item.Get_Metadata_Module(GlobalVar.GEOSPATIAL_METADATA_MODULE_KEY) as GeoSpatial_Information;

            if ((geoInfo == null) || (!geoInfo.hasData))
            {
                return(true);
            }

            return(Write_Metadata_Section(Output_Stream, geoInfo, Options));
        }
        /// <summary> Renders the HTML for this element </summary>
        /// <param name="Output"> Textwriter to write the HTML for this element </param>
        /// <param name="Bib"> Object to populate this element from </param>
        /// <param name="Skin_Code"> Code for the current skin </param>
        /// <param name="IsMozilla"> Flag indicates if the current browse is Mozilla Firefox (different css choices for some elements)</param>
        /// <param name="PopupFormBuilder"> Builder for any related popup forms for this element </param>
        /// <param name="Current_User"> Current user, who's rights may impact the way an element is rendered </param>
        /// <param name="CurrentLanguage"> Current user-interface language </param>
        /// <param name="Translator"> Language support object which handles simple translational duties </param>
        /// <param name="Base_URL"> Base URL for the current request </param>
        /// <remarks> This simple element does not append any popup form to the popup_form_builder</remarks>
        public override void Render_Template_HTML(TextWriter Output, SobekCM_Item Bib, string Skin_Code, bool IsMozilla, StringBuilder PopupFormBuilder, User_Object Current_User, Web_Language_Enum CurrentLanguage, Language_Support_Info Translator, string Base_URL)
        {
            // Check that an acronym exists
            if (Acronym.Length == 0)
            {
                const string defaultAcronym = "Predominant mode of learning supported by this learning object.";
                switch (CurrentLanguage)
                {
                case Web_Language_Enum.English:
                    Acronym = defaultAcronym;
                    break;

                case Web_Language_Enum.Spanish:
                    Acronym = defaultAcronym;
                    break;

                case Web_Language_Enum.French:
                    Acronym = defaultAcronym;
                    break;

                default:
                    Acronym = defaultAcronym;
                    break;
                }
            }

            // Determine the value from the enum
            string value = String.Empty;

            // Try to get the learning metadata here
            LearningObjectMetadata lomInfo = Bib.Get_Metadata_Module(GlobalVar.IEEE_LOM_METADATA_MODULE_KEY) as LearningObjectMetadata;

            if (lomInfo != null)
            {
                switch (lomInfo.InteractivityType)
                {
                case InteractivityTypeEnum.active:
                    value = level1_text;
                    break;

                case InteractivityTypeEnum.expositive:
                    value = level2_text;
                    break;

                case InteractivityTypeEnum.mixed:
                    value = level3_text;
                    break;
                }
            }

            render_helper(Output, value, Skin_Code, Current_User, CurrentLanguage, Translator, Base_URL);
        }
Esempio n. 15
0
        /// <summary> Renders the HTML for this element </summary>
        /// <param name="Output"> Textwriter to write the HTML for this element </param>
        /// <param name="Bib"> Object to populate this element from </param>
        /// <param name="Skin_Code"> Code for the current skin </param>
        /// <param name="isMozilla"> Flag indicates if the current browse is Mozilla Firefox (different css choices for some elements)</param>
        /// <param name="popup_form_builder"> Builder for any related popup forms for this element </param>
        /// <param name="Current_User"> Current user, who's rights may impact the way an element is rendered </param>
        /// <param name="CurrentLanguage"> Current user-interface language </param>
        /// <param name="Translator"> Language support object which handles simple translational duties </param>
        /// <param name="Base_URL"> Base URL for the current request </param>
        /// <remarks> This simple element does not append any popup form to the popup_form_builder</remarks>
        public override void Render_Template_HTML(TextWriter Output, SobekCM_Item Bib, string Skin_Code, bool isMozilla, StringBuilder popup_form_builder, User_Object Current_User, Web_Language_Enum CurrentLanguage, Language_Support_Info Translator, string Base_URL)
        {
            // Check that an acronym exists
            if (Acronym.Length == 0)
            {
                const string defaultAcronym = "The completion status or condition of this learning object.";
                switch (CurrentLanguage)
                {
                case Web_Language_Enum.English:
                    Acronym = defaultAcronym;
                    break;

                case Web_Language_Enum.Spanish:
                    Acronym = defaultAcronym;
                    break;

                case Web_Language_Enum.French:
                    Acronym = defaultAcronym;
                    break;

                default:
                    Acronym = defaultAcronym;
                    break;
                }
            }

            // Determine the value from the enum
            string value = String.Empty;

            // Try to get the learning metadata here
            LearningObjectMetadata lomInfo = Bib.Get_Metadata_Module(GlobalVar.IEEE_LOM_METADATA_MODULE_KEY) as LearningObjectMetadata;

            if (lomInfo != null)
            {
                switch (lomInfo.Status)
                {
                case StatusEnum.draft:
                    value = level1_text;
                    break;

                case StatusEnum.final:
                    value = level2_text;
                    break;

                case StatusEnum.revised:
                    value = level3_text;
                    break;
                }
            }

            render_helper(Output, value, Skin_Code, Current_User, CurrentLanguage, Translator, Base_URL);
        }
Esempio n. 16
0
 /// <summary> Saves the data stored in this instance of the
 /// element to the provided bibliographic object </summary>
 /// <param name="Bib"> Object into which to save this element's data </param>
 public override void Save_To_Bib(SobekCM_Item Bib)
 {
     if (thisBox.Text.Trim().Length > 0)
     {
         DAITSS_Info daitssInfo = Bib.Get_Metadata_Module(GlobalVar.DAITSS_METADATA_MODULE_KEY) as DAITSS_Info;
         if (daitssInfo == null)
         {
             daitssInfo = new DAITSS_Info();
             Bib.Add_Metadata_Module(GlobalVar.DAITSS_METADATA_MODULE_KEY, daitssInfo);
         }
         daitssInfo.Project = thisBox.Text.Trim();
     }
 }
Esempio n. 17
0
 /// <summary> Saves the constants to the bib id </summary>
 /// <param name="Bib"> Object into which to save this element's constant data </param>
 public override void Save_Constant_To_Bib(SobekCM_Item Bib)
 {
     if ((DefaultValues != null) && (DefaultValues.Count > 0))
     {
         Thesis_Dissertation_Info etdInfo = Bib.Get_Metadata_Module(GlobalVar.THESIS_METADATA_MODULE_KEY) as Thesis_Dissertation_Info;
         if (etdInfo == null)
         {
             etdInfo = new Thesis_Dissertation_Info();
             Bib.Add_Metadata_Module(GlobalVar.THESIS_METADATA_MODULE_KEY, etdInfo);
         }
         etdInfo.Degree_Grantor = DefaultValues[0];
     }
 }
        /// <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)
        {
            // Get the geo-spatial information if it exists or create a new one
            GeoSpatial_Information geoInfo = Return_Package.Get_Metadata_Module(GlobalVar.GEOSPATIAL_METADATA_MODULE_KEY) as GeoSpatial_Information;

            if (geoInfo == null)
            {
                geoInfo = new GeoSpatial_Information();
                Return_Package.Add_Metadata_Module(GlobalVar.GEOSPATIAL_METADATA_MODULE_KEY, geoInfo);
            }

            return(Read_Metadata_Section(Input_XmlReader, geoInfo, Options));
        }
        /// <summary> Map one or more data elements from the original METS-based object to the
        /// BriefItem object </summary>
        /// <param name="Original"> Original METS-based object </param>
        /// <param name="New"> New object to populate some data from the original </param>
        /// <returns> TRUE if successful, FALSE if an exception is encountered </returns>
        public bool MapToBriefItem(SobekCM_Item Original, BriefItemInfo New)
        {
            // Try to get the rights information from the object
            RightsMD_Info rightsInfo = Original.Get_Metadata_Module(GlobalVar.PALMM_RIGHTSMD_METADATA_MODULE_KEY) as RightsMD_Info;

            // Add eembargo date, if there is one
            if ((rightsInfo != null) && (rightsInfo.Has_Embargo_End))
            {
                New.Add_Description("Embargo Date", rightsInfo.Embargo_End.ToShortDateString());
            }

            return(true);
        }
 /// <summary> Saves the data stored in this instance of the
 /// element to the provided bibliographic object </summary>
 /// <param name="Bib"> Object into which to save this element's data </param>
 public override void Save_To_Bib(SobekCM_Item Bib)
 {
     if (base.thisBox.Text.Trim().Length > 0)
     {
         Zoological_Taxonomy_Info darwinCoreInfo = Bib.Get_Metadata_Module(GlobalVar.ZOOLOGICAL_TAXONOMY_METADATA_MODULE_KEY) as Zoological_Taxonomy_Info;
         if (darwinCoreInfo == null)
         {
             darwinCoreInfo = new Zoological_Taxonomy_Info();
             Bib.Add_Metadata_Module(GlobalVar.ZOOLOGICAL_TAXONOMY_METADATA_MODULE_KEY, darwinCoreInfo);
         }
         darwinCoreInfo.Specific_Epithet = base.thisBox.Text.Trim();
     }
 }
Esempio n. 21
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;
                }
            }
        }
        /// <summary> Saves the data stored in this instance of the
        /// element to the provided bibliographic object </summary>
        /// <param name="Bib"> Object into which to save this element's data </param>
        public override void Save_To_Bib(SobekCM_Item Bib)
        {
            if (thisBox.Text.Trim().Length > 0)
            {
                PALMM_Info palmmInfo = Bib.Get_Metadata_Module(GlobalVar.PALMM_METADATA_MODULE_KEY) as PALMM_Info;
                if (palmmInfo == null)
                {
                    palmmInfo = new PALMM_Info();
                    Bib.Add_Metadata_Module(GlobalVar.PALMM_METADATA_MODULE_KEY, palmmInfo);
                }

                palmmInfo.PALMM_Project = thisBox.Text.Trim();
            }
        }
        /// <summary> Saves the data stored in this instance of the
        /// element to the provided bibliographic object </summary>
        /// <param name="Bib"> Object into which to save this element's data </param>
        public override void Save_To_Bib(SobekCM_Item Bib)
        {
            if (base.thisBox.Text.Trim().Length > 0)
            {
                Thesis_Dissertation_Info thesisInfo = Bib.Get_Metadata_Module(GlobalVar.THESIS_METADATA_MODULE_KEY) as Thesis_Dissertation_Info;
                if (thesisInfo == null)
                {
                    thesisInfo = new Thesis_Dissertation_Info();
                    Bib.Add_Metadata_Module(GlobalVar.THESIS_METADATA_MODULE_KEY, thesisInfo);
                }

                thesisInfo.Degree_Discipline = base.thisBox.Text.Trim();
            }
        }
        /// <summary> Saves the data stored in this instance of the
        /// element to the provided bibliographic object </summary>
        /// <param name="Bib"> Object to populate this element from </param>
        public override void Populate_From_Bib(SobekCM_Item Bib)
        {
            VRACore_Info vraInfo = Bib.Get_Metadata_Module(GlobalVar.VRACORE_METADATA_MODULE_KEY) as VRACore_Info;

            if ((vraInfo != null) && (base.index < vraInfo.Material_Count))
            {
                base.thisKeywordBox.Text = vraInfo.Materials[base.index].Materials;
                base.thisSchemeBox.Text  = vraInfo.Materials[base.index].Type;
            }
            else
            {
                base.thisSchemeBox.Text = "medium";
            }
        }
        /// <summary> Saves the data stored in this instance of the
        /// element to the provided bibliographic object </summary>
        /// <param name="Bib"> Object into which to save this element's data </param>
        public override void Save_To_Bib(SobekCM_Item Bib)
        {
            if (thisBox.Text.Trim().Length > 0)
            {
                VRACore_Info vraInfo = Bib.Get_Metadata_Module(GlobalVar.VRACORE_METADATA_MODULE_KEY) as VRACore_Info;
                if (vraInfo == null)
                {
                    vraInfo = new VRACore_Info();
                    Bib.Add_Metadata_Module(GlobalVar.VRACORE_METADATA_MODULE_KEY, vraInfo);
                }

                vraInfo.Add_Style_Period(thisBox.Text.Trim());
            }
        }
        /// <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)
                {
                    // Get the value from the combo box
                    string value = HttpContext.Current.Request.Form[thisKey].Trim();

                    // Try to get any existing learning object metadata module
                    LearningObjectMetadata lomInfo = Bib.Get_Metadata_Module(GlobalVar.IEEE_LOM_METADATA_MODULE_KEY) as LearningObjectMetadata;

                    if (value.Length == 0)
                    {
                        // I fhte learning object metadata does exist, set it to undefined
                        if (lomInfo != null)
                        {
                            lomInfo.InteractivityType = InteractivityTypeEnum.UNDEFINED;
                        }
                    }
                    else
                    {
                        // There is a value, so ensure learning object metadata does exist
                        if (lomInfo == null)
                        {
                            lomInfo = new LearningObjectMetadata();
                            Bib.Add_Metadata_Module(GlobalVar.IEEE_LOM_METADATA_MODULE_KEY, lomInfo);
                        }

                        // Save the new value
                        switch (value)
                        {
                        case level1_text:
                            lomInfo.InteractivityType = InteractivityTypeEnum.active;
                            break;

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

                        case level3_text:
                            lomInfo.InteractivityType = InteractivityTypeEnum.mixed;
                            break;
                        }
                    }
                    return;
                }
            }
        }
Esempio n. 27
0
        /// <summary> Saves the data stored in this instance of the
        /// element to the provided bibliographic object </summary>
        /// <param name="Bib"> Object to populate this element from </param>
        public override void Populate_From_Bib(SobekCM_Item Bib)
        {
            PALMM_Info palmmInfo = Bib.Get_Metadata_Module(GlobalVar.PALMM_METADATA_MODULE_KEY) as PALMM_Info;

            if ((palmmInfo != null) && (palmmInfo.toPALMM))
            {
                palmmFlagCheckBox.Checked = true;
            }
            else
            {
                palmmFlagCheckBox.Checked = false;
            }

            DAITSS_Info daitssInfo = Bib.Get_Metadata_Module(GlobalVar.DAITSS_METADATA_MODULE_KEY) as DAITSS_Info;

            if ((daitssInfo != null) && (daitssInfo.toArchive))
            {
                fdaFlagCheckBox.Checked = true;
            }
            else
            {
                fdaFlagCheckBox.Checked = false;
            }
        }
        /// <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
            Sample_FavColor_Metadata_Module taxonInfo = Return_Package.Get_Metadata_Module(Sample_FavColor_Metadata_Module.Module_Name_Static) as Sample_FavColor_Metadata_Module;

            if (taxonInfo == null)
            {
                taxonInfo = new Sample_FavColor_Metadata_Module();
                Return_Package.Add_Metadata_Module(Sample_FavColor_Metadata_Module.Module_Name_Static, taxonInfo);
            }

            // 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();

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

                    case "additionalFavoriteColor":
                        Input_XmlReader.Read();
                        if ((Input_XmlReader.NodeType == XmlNodeType.Text) && (Input_XmlReader.Value.Trim().Length > 0))
                        {
                            taxonInfo.Other_Favorite_Color.Add(Input_XmlReader.Value.Trim());
                        }
                        break;
                    }
                }
            } while (Input_XmlReader.Read());

            return(true);
        }
        /// <summary> Reads the amdSec 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_amdSec(XmlReader Input_XmlReader, SobekCM_Item Return_Package, Dictionary <string, object> Options)
        {
            // Ensure this metadata module extension exists
            DAITSS_Info daitssInfo = Return_Package.Get_Metadata_Module(GlobalVar.DAITSS_METADATA_MODULE_KEY) as DAITSS_Info;

            if (daitssInfo == null)
            {
                daitssInfo = new DAITSS_Info();
                Return_Package.Add_Metadata_Module(GlobalVar.DAITSS_METADATA_MODULE_KEY, daitssInfo);
            }

            // 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
                switch (Input_XmlReader.NodeType)
                {
                case XmlNodeType.Element:
                    if ((Input_XmlReader.Name.ToLower() == "daitss:agreement_info") && (Input_XmlReader.HasAttributes))
                    {
                        if (Input_XmlReader.MoveToAttribute("ACCOUNT"))
                        {
                            daitssInfo.Account = Input_XmlReader.Value;
                        }

                        if (Input_XmlReader.MoveToAttribute("SUB_ACCOUNT"))
                        {
                            daitssInfo.SubAccount = Input_XmlReader.Value;
                        }

                        if (Input_XmlReader.MoveToAttribute("PROJECT"))
                        {
                            daitssInfo.Project = Input_XmlReader.Value;
                        }
                    }
                    break;
                }
            } while (Input_XmlReader.Read());

            // Return false since this read all the way to the end of the steam
            return(false);
        }
        /// <summary> Writes the dmdSec for the entire package to the text writer </summary>
        /// <param name="Output_Stream">Stream to which the formatted text is written </param>
        /// <param name="METS_Item">Package with all the metadata to save</param>
        /// <param name="Options"> Dictionary of any options which this METS section writer may utilize</param>
        /// <returns>TRUE if successful, otherwise FALSE </returns>
        public bool Write_dmdSec(TextWriter Output_Stream, SobekCM_Item METS_Item, Dictionary <string, object> Options)
        {
            // Ensure this metadata module extension exists and has data
            Map_Info mapInfo = METS_Item.Get_Metadata_Module(GlobalVar.SOBEKCM_MAPS_METADATA_MODULE_KEY) as Map_Info;

            if ((mapInfo == null) || (!mapInfo.hasData))
            {
                return(true);
            }

            // Now, collect the data to include here
            string map_data = mapInfo.ToXML("map:", false);

            Output_Stream.Write(map_data);
            return(true);
        }
Esempio n. 31
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)
        {
            List <Coordinate_Point> points = new List <Coordinate_Point>();

            string[] getKeys  = HttpContext.Current.Request.Form.AllKeys;
            string   latitude = String.Empty;

            foreach (string thisKey in getKeys)
            {
                if (thisKey.IndexOf(html_element_name.Replace("_", "") + "_first") == 0)
                {
                    latitude = HttpContext.Current.Request.Form[thisKey];
                }

                if (thisKey.IndexOf(html_element_name.Replace("_", "") + "_second") != 0)
                {
                    continue;
                }

                string longitude = HttpContext.Current.Request.Form[thisKey];
                if ((latitude.Length > 0) && (longitude.Length > 0))
                {
                    double latitude_double, longitude_double;
                    if ((Double.TryParse(latitude, out latitude_double)) && (Double.TryParse(longitude, out longitude_double)))
                    {
                        points.Add(new Coordinate_Point(latitude_double, longitude_double));
                    }
                    latitude = String.Empty;
                }
            }

            // GEt the geospatial metadata module
            if (points.Count > 0)
            {
                GeoSpatial_Information geoInfo = Bib.Get_Metadata_Module(GlobalVar.GEOSPATIAL_METADATA_MODULE_KEY) as GeoSpatial_Information;
                if (geoInfo == null)
                {
                    geoInfo = new GeoSpatial_Information();
                    Bib.Add_Metadata_Module(GlobalVar.GEOSPATIAL_METADATA_MODULE_KEY, geoInfo);
                }

                foreach (Coordinate_Point thisPoint in points)
                {
                    geoInfo.Add_Point(thisPoint);
                }
            }
        }
        /// <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
            Map_Info mapInfo = Return_Package.Get_Metadata_Module(GlobalVar.SOBEKCM_MAPS_METADATA_MODULE_KEY) as Map_Info;

            if (mapInfo == null)
            {
                mapInfo = new Map_Info();
                Return_Package.Add_Metadata_Module(GlobalVar.SOBEKCM_MAPS_METADATA_MODULE_KEY, mapInfo);
            }

            // Try to get the attributes from here first
            if (Input_XmlReader.MoveToAttribute("id"))
            {
                mapInfo.MapID = Input_XmlReader.Value;
            }

            // Step through each field
            while (Input_XmlReader.Read())
            {
                if ((Input_XmlReader.NodeType == XmlNodeType.EndElement) && (Input_XmlReader.Name == "map:ufdc_map"))
                {
                    return(true);
                }

                if (Input_XmlReader.NodeType == XmlNodeType.Element)
                {
                    switch (Input_XmlReader.Name)
                    {
                    case "map:indexes":
                        read_map_indexes(Input_XmlReader, mapInfo);
                        break;

                    case "map:entities":
                        read_map_entities(Input_XmlReader, mapInfo);
                        break;

                    case "map:sheets":
                        read_map_sheets(Input_XmlReader, mapInfo);
                        break;
                    }
                }
            }

            // Return false since this read all the way to the end of the steam
            return(false);
        }
        /// <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)
        {
            // Try to get any existing VRAcore metadata module
            VRACore_Info vraInfo = Bib.Get_Metadata_Module(GlobalVar.VRACORE_METADATA_MODULE_KEY) as VRACore_Info;

            Dictionary <string, string> terms   = new Dictionary <string, string>();
            Dictionary <string, string> schemes = new Dictionary <string, string>();

            string[] getKeys = HttpContext.Current.Request.Form.AllKeys;
            foreach (string thisKey in getKeys)
            {
                if (thisKey.IndexOf(html_element_name.Replace("_", "") + "_first") == 0)
                {
                    string term  = HttpContext.Current.Request.Form[thisKey];
                    string index = thisKey.Replace(html_element_name.Replace("_", "") + "_first", "");
                    terms[index] = term;
                }

                if (thisKey.IndexOf(html_element_name.Replace("_", "") + "_second") == 0)
                {
                    string scheme = HttpContext.Current.Request.Form[thisKey];
                    string index  = thisKey.Replace(html_element_name.Replace("_", "") + "_second", "");
                    schemes[index] = scheme;
                }
            }

            // Were values found?
            if (terms.Count > 0)
            {
                // There is a value, so ensure VRAcore metadata does exist
                if (vraInfo == null)
                {
                    vraInfo = new VRACore_Info();
                    Bib.Add_Metadata_Module(GlobalVar.VRACORE_METADATA_MODULE_KEY, vraInfo);
                }

                // Add each value
                foreach (string index in terms.Keys)
                {
                    if (!String.IsNullOrEmpty(terms[index]))
                    {
                        vraInfo.Add_Material(terms[index], schemes.ContainsKey(index) ? schemes[index] : String.Empty);
                    }
                }
            }
        }
        /// <summary> Renders the HTML for this element </summary>
        /// <param name="Output"> Textwriter to write the HTML for this element </param>
        /// <param name="Bib"> Object to populate this element from </param>
        /// <param name="Skin_Code"> Code for the current skin </param>
        /// <param name="isMozilla"> Flag indicates if the current browse is Mozilla Firefox (different css choices for some elements)</param>
        /// <param name="popup_form_builder"> Builder for any related popup forms for this element </param>
        /// <param name="Current_User"> Current user, who's rights may impact the way an element is rendered </param>
        /// <param name="CurrentLanguage"> Current user-interface language </param>
        /// <param name="Translator"> Language support object which handles simple translational duties </param>
        /// <param name="Base_URL"> Base URL for the current request </param>
        /// <remarks> This simple element does not append any popup form to the popup_form_builder</remarks>
        public override void Render_Template_HTML(TextWriter Output, SobekCM_Item Bib, string Skin_Code, bool isMozilla, StringBuilder popup_form_builder, User_Object Current_User, Web_Language_Enum CurrentLanguage, Language_Support_Info Translator, string Base_URL)
        {
            // Check that an acronym exists
            if (Acronym.Length == 0)
            {
                const string defaultAcronym = "Specific kind of learning object.  The most dominant kind should be first.";
                switch (CurrentLanguage)
                {
                case Web_Language_Enum.English:
                    Acronym = defaultAcronym;
                    break;

                case Web_Language_Enum.Spanish:
                    Acronym = defaultAcronym;
                    break;

                case Web_Language_Enum.French:
                    Acronym = defaultAcronym;
                    break;

                default:
                    Acronym = defaultAcronym;
                    break;
                }
            }

            // Start the list to collect all current instance values
            List <string> instanceValues = new List <string>();

            // Try to get any existing learning object metadata module
            LearningObjectMetadata lomInfo = Bib.Get_Metadata_Module(GlobalVar.IEEE_LOM_METADATA_MODULE_KEY) as LearningObjectMetadata;

            if (lomInfo != null)
            {
                foreach (LOM_VocabularyState thisType in lomInfo.LearningResourceTypes)
                {
                    if (thisType.Value.Trim().Length > 0)
                    {
                        instanceValues.Add(thisType.Value);
                    }
                }
            }

            // Add to the current template (stream)
            render_helper(Output, instanceValues, Skin_Code, Current_User, CurrentLanguage, Translator, Base_URL);
        }
Esempio n. 35
0
        /// <summary> Writes the amdSec for the entire package to the text writer </summary>
        /// <param name="Output_Stream">Stream to which the formatted text is written </param>
        /// <param name="METS_Item">Package with all the metadata to save</param>
        /// <param name="Options"> Dictionary of any options which this METS section writer may utilize</param>
        /// <returns>TRUE if successful, otherwise FALSE </returns>
        public bool Write_amdSec(TextWriter Output_Stream, SobekCM_Item METS_Item, Dictionary <string, object> Options)
        {
            // Ensure this metadata module extension exists and has data
            RightsMD_Info rightsInfo = METS_Item.Get_Metadata_Module(GlobalVar.PALMM_RIGHTSMD_METADATA_MODULE_KEY) as RightsMD_Info;

            if ((rightsInfo == null) || (!rightsInfo.hasData))
            {
                return(true);
            }

            if (!String.IsNullOrEmpty(rightsInfo.Version_Statement))
            {
                Output_Stream.WriteLine("<rightsmd:versionStatement>" + XML_Writing_Base_Type.Convert_String_To_XML_Safe_Static(rightsInfo.Version_Statement) + "</rightsmd:versionStatement>");
            }
            if (!String.IsNullOrEmpty(rightsInfo.Copyright_Statement))
            {
                Output_Stream.WriteLine("<rightsmd:copyrightStatement>" + XML_Writing_Base_Type.Convert_String_To_XML_Safe_Static(rightsInfo.Copyright_Statement) + "</rightsmd:copyrightStatement>");
            }
            if (rightsInfo.Access_Code != RightsMD_Info.AccessCode_Enum.NOT_SPECIFIED)
            {
                Output_Stream.Write("<rightsmd:accessCode>");
                switch (rightsInfo.Access_Code)
                {
                case RightsMD_Info.AccessCode_Enum.Public:
                    Output_Stream.Write("public");
                    break;

                case RightsMD_Info.AccessCode_Enum.Private:
                    Output_Stream.Write("private");
                    break;

                case RightsMD_Info.AccessCode_Enum.Campus:
                    Output_Stream.Write("campus");
                    break;
                }
                Output_Stream.WriteLine("</rightsmd:accessCode>");
            }
            if (rightsInfo.Has_Embargo_End)
            {
                string encoded_date = rightsInfo.Embargo_End.Year + "-" + rightsInfo.Embargo_End.Month.ToString().PadLeft(2, '0') + "-" + rightsInfo.Embargo_End.Day.ToString().PadLeft(2, '0');

                Output_Stream.WriteLine("<rightsmd:embargoEnd>" + encoded_date + "</rightsmd:embargoEnd>");
            }

            return(true);
        }
        /// <summary> Renders the HTML for this element </summary>
        /// <param name="Output"> Textwriter to write the HTML for this element </param>
        /// <param name="Bib"> Object to populate this element from </param>
        /// <param name="Skin_Code"> Code for the current skin </param>
        /// <param name="IsMozilla"> Flag indicates if the current browse is Mozilla Firefox (different css choices for some elements)</param>
        /// <param name="PopupFormBuilder"> Builder for any related popup forms for this element </param>
        /// <param name="Current_User"> Current user, who's rights may impact the way an element is rendered </param>
        /// <param name="CurrentLanguage"> Current user-interface language </param>
        /// <param name="Translator"> Language support object which handles simple translational duties </param>
        /// <param name="Base_URL"> Base URL for the current request </param>
        /// <remarks> This simple element does not append any popup form to the popup_form_builder</remarks>
        public override void Render_Template_HTML(TextWriter Output, SobekCM_Item Bib, string Skin_Code, bool IsMozilla, StringBuilder PopupFormBuilder, User_Object Current_User, Web_Language_Enum CurrentLanguage, Language_Support_Info Translator, string Base_URL)
        {
            // Check that an acronym exists
            if (Acronym.Length == 0)
            {
                const string defaultAcronym = "Age (range) of the typical intended user.";
                switch (CurrentLanguage)
                {
                case Web_Language_Enum.English:
                    Acronym = defaultAcronym;
                    break;

                case Web_Language_Enum.Spanish:
                    Acronym = defaultAcronym;
                    break;

                case Web_Language_Enum.French:
                    Acronym = defaultAcronym;
                    break;

                default:
                    Acronym = defaultAcronym;
                    break;
                }
            }

            // Start the list to collect all current instance values
            List <string> instanceValues = new List <string>();

            // Try to get any existing learning object metadata module
            LearningObjectMetadata lomInfo = Bib.Get_Metadata_Module(GlobalVar.IEEE_LOM_METADATA_MODULE_KEY) as LearningObjectMetadata;

            if (lomInfo != null)
            {
                foreach (LOM_LanguageString ageRange in lomInfo.TypicalAgeRanges)
                {
                    if (ageRange.Value.Trim().Length > 0)
                    {
                        instanceValues.Add(ageRange.Value);
                    }
                }
            }

            // Add to the current template (stream)
            render_helper(Output, instanceValues, Skin_Code, Current_User, CurrentLanguage, Translator, Base_URL);
        }
Esempio n. 37
0
        /// <summary> Renders the HTML for this element </summary>
        /// <param name="Output"> Textwriter to write the HTML for this element </param>
        /// <param name="Bib"> Object to populate this element from </param>
        /// <param name="Skin_Code"> Code for the current skin </param>
        /// <param name="IsMozilla"> Flag indicates if the current browse is Mozilla Firefox (different css choices for some elements)</param>
        /// <param name="PopupFormBuilder"> Builder for any related popup forms for this element </param>
        /// <param name="Current_User"> Current user, who's rights may impact the way an element is rendered </param>
        /// <param name="CurrentLanguage"> Current user-interface language </param>
        /// <param name="Translator"> Language support object which handles simple translational duties </param>
        /// <param name="Base_URL"> Base URL for the current request </param>
        /// <remarks> This simple element does not append any popup form to the popup_form_builder</remarks>
        public override void Render_Template_HTML(TextWriter Output, SobekCM_Item Bib, string Skin_Code, bool IsMozilla, StringBuilder PopupFormBuilder, User_Object Current_User, Web_Language_Enum CurrentLanguage, Language_Support_Info Translator, string Base_URL)
        {
            // Check that an acronym exists
            if (Acronym.Length == 0)
            {
                const string defaultAcronym = "Enter latitude and longitude for a coordinate related to this item";
                switch (CurrentLanguage)
                {
                case Web_Language_Enum.English:
                    Acronym = defaultAcronym;
                    break;

                case Web_Language_Enum.Spanish:
                    Acronym = defaultAcronym;
                    break;

                case Web_Language_Enum.French:
                    Acronym = defaultAcronym;
                    break;

                default:
                    Acronym = defaultAcronym;
                    break;
                }
            }

            List <string> latitudes  = new List <string>();
            List <string> longitudes = new List <string>();

            // GEt the geospatial metadata module
            GeoSpatial_Information geoInfo = Bib.Get_Metadata_Module(GlobalVar.GEOSPATIAL_METADATA_MODULE_KEY) as GeoSpatial_Information;

            if (geoInfo != null)
            {
                if (geoInfo.hasData)
                {
                    for (int i = 0; i < geoInfo.Point_Count; i++)
                    {
                        latitudes.Add(geoInfo.Points[i].Latitude.ToString());
                        longitudes.Add(geoInfo.Points[i].Longitude.ToString());
                    }
                }
            }

            render_helper(Output, latitudes, longitudes, Skin_Code, Current_User, CurrentLanguage, Translator, Base_URL);
        }
        /// <summary> Saves the data stored in this instance of the
        /// element to the provided bibliographic object </summary>
        /// <param name="Bib"> Object to populate this element from </param>
        public override void Populate_From_Bib(SobekCM_Item Bib)
        {
            // Just save this object
            coordObject = Bib.Get_Metadata_Module(GlobalVar.GEOSPATIAL_METADATA_MODULE_KEY) as GeoSpatial_Information;
            if (coordObject == null)
            {
                coordObject = new GeoSpatial_Information();
            }

            if (Bib.Bib_Info.Type.MODS_Type == TypeOfResource_MODS_Enum.Cartographic)
            {
                isMap = true;
            }
            else
            {
                isMap = false;
            }
        }
        /// <summary> Saves the data stored in this instance of the
        /// element to the provided bibliographic object </summary>
        /// <param name="Bib"> Object to populate this element from </param>
        public override void Populate_From_Bib(SobekCM_Item Bib)
        {
            Thesis_Dissertation_Info thesisInfo = Bib.Get_Metadata_Module(GlobalVar.THESIS_METADATA_MODULE_KEY) as Thesis_Dissertation_Info;

            if (thesisInfo != null)
            {
                switch (thesisInfo.Degree_Level)
                {
                case Thesis_Dissertation_Info.Thesis_Degree_Level_Enum.Doctorate:
                    base.thisBox.Text = "Doctorate";
                    break;

                case Thesis_Dissertation_Info.Thesis_Degree_Level_Enum.Masters:
                    base.thisBox.Text = "Masters";
                    break;
                }
            }
        }
Esempio n. 40
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)
        {
            // Try to get any existing learning object metadata module
            LearningObjectMetadata lomInfo = Bib.Get_Metadata_Module(GlobalVar.IEEE_LOM_METADATA_MODULE_KEY) as LearningObjectMetadata;

            string[] getKeys = HttpContext.Current.Request.Form.AllKeys;
            foreach (string thisKey in getKeys)
            {
                if (thisKey.IndexOf(html_element_name.Replace("_", "")) == 0)
                {
                    // Get the value from the combo box
                    string value = HttpContext.Current.Request.Form[thisKey].Trim();
                    if (value.Length > 0)
                    {
                        // There is a value, so ensure learning object metadata does exist
                        if (lomInfo == null)
                        {
                            lomInfo = new LearningObjectMetadata();
                            Bib.Add_Metadata_Module(GlobalVar.IEEE_LOM_METADATA_MODULE_KEY, lomInfo);
                        }

                        // Save the new value
                        switch (value)
                        {
                        case level1_text:
                            lomInfo.Add_IntendedEndUserRole(IntendedEndUserRoleEnum.teacher);
                            break;

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

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

                        case level4_text:
                            lomInfo.Add_IntendedEndUserRole(IntendedEndUserRoleEnum.manager);
                            break;
                        }
                    }
                }
            }
        }
        /// <summary> Renders the HTML for this element </summary>
        /// <param name="Output"> Textwriter to write the HTML for this element </param>
        /// <param name="Bib"> Object to populate this element from </param>
        /// <param name="Skin_Code"> Code for the current skin </param>
        /// <param name="IsMozilla"> Flag indicates if the current browse is Mozilla Firefox (different css choices for some elements)</param>
        /// <param name="PopupFormBuilder"> Builder for any related popup forms for this element </param>
        /// <param name="Current_User"> Current user, who's rights may impact the way an element is rendered </param>
        /// <param name="CurrentLanguage"> Current user-interface language </param>
        /// <param name="Translator"> Language support object which handles simple translational duties </param>
        /// <param name="Base_URL"> Base URL for the current request </param>
        /// <remarks> This simple element does not append any popup form to the popup_form_builder</remarks>
        public override void Render_Template_HTML(TextWriter Output, SobekCM_Item Bib, string Skin_Code, bool IsMozilla, StringBuilder PopupFormBuilder, User_Object Current_User, Web_Language_Enum CurrentLanguage, Language_Support_Info Translator, string Base_URL)
        {
            // Check that an acronym exists
            if (Acronym.Length == 0)
            {
                Acronym = "Enter the name of the committee co-chair for this thesis/dissertation";
            }

            // Is there an ETD object?
            string valueToDisplay            = string.Empty;
            Thesis_Dissertation_Info etdInfo = Bib.Get_Metadata_Module(GlobalVar.THESIS_METADATA_MODULE_KEY) as Thesis_Dissertation_Info;

            if (etdInfo != null)
            {
                valueToDisplay = etdInfo.Committee_Co_Chair;
            }

            render_helper(Output, valueToDisplay, Skin_Code, Current_User, CurrentLanguage, Translator, Base_URL);
        }
        /// <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
            Map_Info mapInfo = Return_Package.Get_Metadata_Module(GlobalVar.SOBEKCM_MAPS_METADATA_MODULE_KEY) as Map_Info;
            if (mapInfo == null)
            {
                mapInfo = new Map_Info();
                Return_Package.Add_Metadata_Module(GlobalVar.SOBEKCM_MAPS_METADATA_MODULE_KEY, mapInfo);
            }

            // Try to get the attributes from here first
            if (Input_XmlReader.MoveToAttribute("id"))
                mapInfo.MapID = Input_XmlReader.Value;

            // Step through each field
            while (Input_XmlReader.Read())
            {
                if ((Input_XmlReader.NodeType == XmlNodeType.EndElement) && (Input_XmlReader.Name == "map:ufdc_map"))
                    return true;

                if (Input_XmlReader.NodeType == XmlNodeType.Element)
                {
                    switch (Input_XmlReader.Name)
                    {
                        case "map:indexes":
                            read_map_indexes(Input_XmlReader, mapInfo);
                            break;

                        case "map:entities":
                            read_map_entities(Input_XmlReader, mapInfo);
                            break;

                        case "map:sheets":
                            read_map_sheets(Input_XmlReader, mapInfo);
                            break;
                    }
                }
            }

            // Return false since this read all the way to the end of the steam
            return false;
        }
        /// <summary> Reads the amdSec 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_amdSec(XmlReader Input_XmlReader, SobekCM_Item Return_Package, Dictionary<string, object> Options)
        {
            // Ensure this metadata module extension exists
            DAITSS_Info daitssInfo = Return_Package.Get_Metadata_Module(GlobalVar.DAITSS_METADATA_MODULE_KEY) as DAITSS_Info;
            if (daitssInfo == null)
            {
                daitssInfo = new DAITSS_Info();
                Return_Package.Add_Metadata_Module(GlobalVar.DAITSS_METADATA_MODULE_KEY, daitssInfo);
            }

            // 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
                switch (Input_XmlReader.NodeType)
                {
                    case XmlNodeType.Element:
                        if ((Input_XmlReader.Name.ToLower() == "daitss:agreement_info") && (Input_XmlReader.HasAttributes))
                        {
                            if (Input_XmlReader.MoveToAttribute("ACCOUNT"))
                                daitssInfo.Account = Input_XmlReader.Value;

                            if (Input_XmlReader.MoveToAttribute("SUB_ACCOUNT"))
                                daitssInfo.SubAccount = Input_XmlReader.Value;

                            if (Input_XmlReader.MoveToAttribute("PROJECT"))
                                daitssInfo.Project = Input_XmlReader.Value;
                        }
                        break;
                }
            } while (Input_XmlReader.Read());

            // Return false since this read all the way to the end of the steam
            return false;
        }
        /// <summary> Writes the dmdSec for the entire package to the text writer </summary>
        /// <param name="Output_Stream">Stream to which the formatted text is written </param>
        /// <param name="METS_Item">Package with all the metadata to save</param>
        /// <param name="Options"> Dictionary of any options which this METS section writer may utilize</param>
        /// <returns>TRUE if successful, otherwise FALSE </returns>
        /// <remarks>This utilized the DC writer in the base class and just adds the ETD information </remarks>
        public override bool Write_dmdSec(System.IO.TextWriter Output_Stream, SobekCM_Item METS_Item, Dictionary<string, object> Options)
        {
            // Write the base stuff
            base.Write_dmdSec(Output_Stream, METS_Item, Options);

            // Ensure this metadata module extension exists and has data
            Thesis_Dissertation_Info thesisInfo = METS_Item.Get_Metadata_Module(GlobalVar.THESIS_METADATA_MODULE_KEY) as Thesis_Dissertation_Info;
            if ((thesisInfo == null) || (!thesisInfo.hasData))
                return true;

            // Add the ETD stuff if the ETD metadata module exists
            if (!String.IsNullOrEmpty(thesisInfo.Degree))
                Output_Stream.WriteLine("<thesis.degree.name>" + Convert_String_To_XML_Safe(thesisInfo.Degree) + "</thesis.degree.name>");

            if (thesisInfo.Degree_Level == Thesis_Dissertation_Info.Thesis_Degree_Level_Enum.Bachelors)
                Output_Stream.WriteLine("<thesis.degree.level>Bachelors</thesis.degree.level>");
            if (thesisInfo.Degree_Level == Thesis_Dissertation_Info.Thesis_Degree_Level_Enum.Masters)
                Output_Stream.WriteLine("<thesis.degree.level>Masters</thesis.degree.level>");
            if (thesisInfo.Degree_Level == Thesis_Dissertation_Info.Thesis_Degree_Level_Enum.Doctorate)
                Output_Stream.WriteLine("<thesis.degree.level>Doctorate</thesis.degree.level>");
            if (thesisInfo.Degree_Level == Thesis_Dissertation_Info.Thesis_Degree_Level_Enum.PostDoctorate)
                Output_Stream.WriteLine("<thesis.degree.level>Post-Doctorate</thesis.degree.level>");

            if (thesisInfo.Degree_Disciplines_Count > 0)
            {
                foreach (string thisDiscipline in thesisInfo.Degree_Disciplines)
                {
                    Output_Stream.WriteLine("<thesis.degree.discipline>" + Convert_String_To_XML_Safe(thisDiscipline) + "</thesis.degree.discipline>");
                }
            }

            if (!String.IsNullOrEmpty(thesisInfo.Degree_Grantor))
                Output_Stream.WriteLine("<thesis.degree.grantor>" + Convert_String_To_XML_Safe(thesisInfo.Degree_Grantor) + "</thesis.degree.grantor>");

            return true;
        }
        /// <summary> Adds a bit of data to a bibliographic package using the mapping </summary>
        /// <param name="Package">Bibliographic package to receive the data</param>
        /// <param name="Data">Text of the data</param>
        /// <param name="Field">Mapped field</param>
        /// <returns> TRUE if the field was mapped, FALSE if there was data and no mapping was found </returns>
        public bool Add_Data(SobekCM_Item Package, string Data, string Field)
        {
            // If no field listed, just skip (but not a mapping error, so return TRUE)
            if (String.IsNullOrEmpty(Field))
                return true;

            // If no data listed, just skip (but not a mapping error, so return TRUE)
            if (String.IsNullOrWhiteSpace(Data))
                return true;

            // Trim the data
            Data = Data.Trim();

            // Normalize the field name
            string correctName = Field.ToLower().Replace("(s)", "").Replace("#", "").Replace(" ", "").Replace(".", "").Replace(":", "").Replace("\\", "").Replace("/", "").Replace(")", "").Replace("(", "").Trim();

            // Everything depends on the field which is mapped
            switch (correctName)
            {
                case "acknowledgements":
                case "acknowledgments":
                    Package.Bib_Info.Add_Note(Data, Note_Type_Enum.CreationCredits, "Acknowledgments");
                    return true;

                case "bulletincommitteemembers":
                    Package.Bib_Info.Add_Named_Entity(Data, "Bulletin Committee Member").Name_Type = Name_Info_Type_Enum.Personal;
                    return true;

                case "collectionlocation":
                    Package.Bib_Info.Add_Note(Data, Note_Type_Enum.AdditionalPhysicalForm, "Collection Location");
                    return true;

                case "columnist":
                    Package.Bib_Info.Add_Named_Entity(Data, "Columnist").Name_Type = Name_Info_Type_Enum.Personal;
                    return true;

                case "contents":
                    Package.Bib_Info.Get_TableOfContents("Contents").Add(Data);
                    return true;

                case "contributinginstitution":
                    Package.Bib_Info.Add_Named_Entity(Data, "Contributing Institution").Name_Type = Name_Info_Type_Enum.Corporate;
                    return true;

                case "contributor":
                    Package.Bib_Info.Add_Named_Entity(Data, "Contributing Institution").Name_Type = Name_Info_Type_Enum.Personal;
                    return true;

                case "coverstories":
                    Package.Bib_Info.Get_TableOfContents("Cover Stories").Add(Data);
                    return true;

                case "coverstoriescontents":
                    Package.Bib_Info.Get_TableOfContents("Cover Stories / Contents").Add(Data);
                    return true;

                case "covertitle":
                    Package.Bib_Info.Get_TableOfContents("Contents").Add(Data);
                    return true;

                case "creator":
                    Package.Bib_Info.Add_Named_Entity(Data, "Creator").Name_Type = Name_Info_Type_Enum.Personal;
                    return true;

                case "creator,performer":
                    Package.Bib_Info.Add_Named_Entity(Data, "Creator / Performer").Name_Type = Name_Info_Type_Enum.Personal;
                    return true;

                case "date":
                    Package.Bib_Info.Origin_Info.Date_Created = Data;
                    return true;

                case "dateoriginal":
                    Package.Bib_Info.Origin_Info.Date_Created = Data;
                    return true;

                case "description":
                    Package.Bib_Info.Add_Abstract(new Abstract_Info { Abstract_Text = Data, Type = "Summary", Display_Label = "Description" });
                    return true;

                case "designer":
                    Package.Bib_Info.Add_Named_Entity(Data, "Designer").Name_Type = Name_Info_Type_Enum.Personal;
                    return true;

                case "digitalid":
                    Package.Bib_Info.Add_Identifier(Data, "Digital Id");
                    return true;

                case "digitizationspecifications":
                    Package.Bib_Info.Add_Note(Data, Note_Type_Enum.Ownership, "Digitization Specifications");
                    return true;

                case "editing":
                case "editor":
                    Package.Bib_Info.Add_Named_Entity(Data, "Editor").Name_Type = Name_Info_Type_Enum.Personal;
                    return true;

                case "editorwriter":
                    Package.Bib_Info.Add_Named_Entity(Data, "Editor / Writer").Name_Type = Name_Info_Type_Enum.Personal;
                    return true;

                case "emcee":
                    Package.Bib_Info.Add_Named_Entity(Data, "Emcee").Name_Type = Name_Info_Type_Enum.Personal;
                    return true;

                case "features":
                    Package.Bib_Info.Get_TableOfContents("Features").Add(Data);
                    return true;

                case "filesizeandduration":
                    // Get the duration from the parantheses
                    int fsd_start = Data.IndexOf("(");
                    int fsd_end = Data.IndexOf(")");
                    if ((fsd_start > 0) && (fsd_end > fsd_start))
                    {
                        string duration_string = Data.Substring(fsd_start + 1, fsd_end - fsd_start - 1);
                        if (( duration_string.IndexOf("second", StringComparison.OrdinalIgnoreCase) > 0 ) || (duration_string.IndexOf("minute", StringComparison.OrdinalIgnoreCase) > 0 ))
                            Package.Bib_Info.Original_Description.Extent = duration_string;
                    }
                    return true;

                case "founder":
                    Package.Bib_Info.Add_Named_Entity(Data, "Founder").Name_Type = Name_Info_Type_Enum.Personal;
                    return true;

                case "frontpageheadlines":
                    Package.Bib_Info.Get_TableOfContents("Front Page Headlines").Add(Data);
                    return true;

                case "generalsubjects":
                    split_add_subjects(Package, Data);
                    return true;

                case "genre":
                    Package.Bib_Info.Add_Genre(Data);
                    return true;

                case "geographiccoverage":
                    Package.Bib_Info.Add_Spatial_Subject(Data);
                    return true;

                case "historicalnarrative":
                    Package.Bib_Info.Add_Named_Entity(Data, "Historical Narrative").Name_Type = Name_Info_Type_Enum.Personal;
                    return true;

                case "identifiedindividuals":
                    Subject_Info_Name nameSubj = Package.Bib_Info.Add_Name_Subject();
                    nameSubj.Full_Name = Data;
                    nameSubj.Name_Type = Name_Info_Type_Enum.Personal;
                    nameSubj.Description = "Identified Individuals";
                    return true;

                case "image-specificsubjects":
                    split_add_subjects(Package, Data);
                    return true;

                case "internalnote":
                    Package.Bib_Info.Add_Note(Data, Note_Type_Enum.InternalComments, "Acknowledgments");
                    return true;

                case "interviewdate":
                    Package.Bib_Info.Origin_Info.Add_Date_Other(Data, "Interview Date");
                    return true;

                case "interviewlocation":
                    Package.Bib_Info.Origin_Info.Add_Place(Data);
                    return true;

                case "interviewee":
                    Package.Bib_Info.Add_Named_Entity(Data, "Interviewee").Name_Type = Name_Info_Type_Enum.Personal;
                    return true;

                case "interviewer":
                    Package.Bib_Info.Add_Named_Entity(Data, "Interviewer").Name_Type = Name_Info_Type_Enum.Personal;
                    return true;

                case "issue":
                case "issuenumber":
                    // If there is already an enumberation (1), use (2)
                    if (!String.IsNullOrWhiteSpace(Package.Bib_Info.Series_Part_Info.Enum1))
                    {
                        int issue_number = -1;
                        if (Int32.TryParse(Data, out issue_number))
                        {
                            Package.Bib_Info.Series_Part_Info.Enum1 = "Issue " + Data;
                            Package.Bib_Info.Series_Part_Info.Enum1_Index = issue_number;
                        }
                        else
                        {
                            Package.Bib_Info.Series_Part_Info.Enum1 = Data + " Issue";
                        }
                    }
                    else
                    {
                        int issue_number = -1;
                        if (Int32.TryParse(Data, out issue_number))
                        {
                            Package.Bib_Info.Series_Part_Info.Enum2 = "Issue " + Data;
                            Package.Bib_Info.Series_Part_Info.Enum2_Index = issue_number;
                        }
                        else
                        {
                            Package.Bib_Info.Series_Part_Info.Enum2 = Data + " Issue";
                        }
                    }
                    return true;

                case "issue-specificsubjects":
                    split_add_subjects(Package, Data);
                    return true;

                case "item-specificsubjects":
                    split_add_subjects(Package, Data);
                    return true;

                case "language":
                    Package.Bib_Info.Add_Language(Data);
                    return true;

                case "layout":
                    Package.Bib_Info.Add_Named_Entity(Data, "Layout").Name_Type = Name_Info_Type_Enum.Personal;
                    return true;

                case "location":
                    Package.Bib_Info.Origin_Info.Add_Place(Data);
                    return true;

                case "locationdepicted":
                    Package.Bib_Info.Add_Spatial_Subject(Data);
                    return true;

                case "monthseason":
                    Package.Bib_Info.Series_Part_Info.Month = Data;
                    return true;

                case "monthscovered":
                    Package.Bib_Info.Series_Part_Info.Month = Data;
                    return true;

                case "namesorganizations":
                    Package.Bib_Info.Add_Name_Subject().Full_Name = Data;
                    return true;

                case "originaldate":
                    Package.Bib_Info.Origin_Info.Date_Issued = Data;
                    return true;

                case "originalitemid":
                    Package.Bib_Info.Add_Identifier(Data, "Original ItemID");
                    return true;

                case "originalmedium":
                    VRACore_Info vraCoreInfo2 = Package.Get_Metadata_Module("VRACore") as VRACore_Info;
                    if (vraCoreInfo2 == null)
                    {
                        vraCoreInfo2 = new VRACore_Info();
                        Package.Add_Metadata_Module("VRACore", vraCoreInfo2);
                    }
                    vraCoreInfo2.Add_Material(Data, "medium");
                    return true;

                case "originalpublisher":
                    Package.Bib_Info.Add_Publisher(Data);
                    return true;

                case "photographer":
                    Package.Bib_Info.Add_Named_Entity(Data, "Photographer").Name_Type = Name_Info_Type_Enum.Personal;
                    return true;

                case "photographs":
                    Package.Bib_Info.Add_Named_Entity(Data, "Photograph Studio").Name_Type = Name_Info_Type_Enum.Corporate;
                    return true;

                case "physicalcollection":
                    Package.Bib_Info.Location.Holding_Name = Data;
                    return true;

                case "presentedatboardmeeting":
                    Package.Bib_Info.Origin_Info.Add_Date_Other(Data, "Presented at board meeting");
                    return true;

                case "presenter":
                    Package.Bib_Info.Add_Named_Entity(Data, "Presenter").Name_Type = Name_Info_Type_Enum.Personal;
                    return true;

                case "president":
                    Package.Bib_Info.Add_Named_Entity(Data, "President").Name_Type = Name_Info_Type_Enum.Personal;
                    return true;

                case "projectcoordinator":
                    Package.Bib_Info.Add_Named_Entity(Data, "Project Coordinator").Name_Type = Name_Info_Type_Enum.Personal;
                    return true;

                case "projectcreator":
                    Package.Bib_Info.Add_Named_Entity(Data, "Project Creator").Name_Type = Name_Info_Type_Enum.Personal;
                    return true;

                case "publicationdate":
                    Package.Bib_Info.Origin_Info.Date_Issued = Data;
                    return true;

                case "publisher":
                    Package.Bib_Info.Add_Publisher(Data);
                    return true;

                case "relatedbminewsletter":
                    Related_Item_Info relatedNewsletter = new Related_Item_Info();
                    relatedNewsletter.Main_Title.Title = Data;
                    relatedNewsletter.Relationship = Related_Item_Type_Enum.UNKNOWN;
                    relatedNewsletter.Add_Note("Related BMI Newsletter");
                    Package.Bib_Info.Add_Related_Item(relatedNewsletter);
                    return true;

                case "relatedbmiphoto":
                    Related_Item_Info relatedPhoto = new Related_Item_Info();
                    relatedPhoto.Main_Title.Title = Data;
                    relatedPhoto.Relationship = Related_Item_Type_Enum.UNKNOWN;
                    relatedPhoto.Add_Note("Related BMI Photograph");
                    Package.Bib_Info.Add_Related_Item(relatedPhoto);
                    return true;

                case "resourcetype":
                    Package.Bib_Info.Type.Add_Uncontrolled_Type(Data);
                    return true;

                case "rightsinformation":
                    Package.Bib_Info.Access_Condition.Text = Data;
                    return true;

                case "scrapbook-specificsubjects":
                    split_add_subjects(Package, Data);
                    return true;

                case "seasonmonth":
                    Package.Bib_Info.Series_Part_Info.Month = Data;
                    return true;

                case "subjects":
                    split_add_subjects(Package, Data);
                    return true;

                case "timeperiodcovered":
                    // Was this either a number, or a range?
                    int dash_count = 0;
                    bool isNumbers = true;
                    string dns = Data.Replace(" ", "");
                    foreach (char thisChar in dns)
                    {
                        if ((!Char.IsNumber(thisChar)) && (thisChar != '-'))
                        {
                            isNumbers = false;
                            break;
                        }

                        if (thisChar == '-')
                            dash_count++;
                    }

                    // Just add as is, if not number or range
                    if ((!isNumbers) || (dash_count > 1))
                        Package.Bib_Info.Add_Temporal_Subject(-1, -1, Data);
                    else
                    {
                        int start_year = -1;
                        int end_year = -1;
                        // Was it a range?
                        if (dash_count == 1)
                        {
                            string[] splitter = dns.Split("-".ToCharArray());
                            if (splitter.Length == 2)
                            {
                                if (( Int32.TryParse(splitter[0], out start_year)) && ( Int32.TryParse(splitter[1], out end_year )))
                                    Package.Bib_Info.Add_Temporal_Subject(start_year, end_year, Data);
                                else
                                    Package.Bib_Info.Add_Temporal_Subject(-1, -1, Data);
                            }
                        }
                        else
                        {
                            if ( Int32.TryParse(Data, out start_year))
                                Package.Bib_Info.Add_Temporal_Subject(start_year, -1, Data);
                            else
                                Package.Bib_Info.Add_Temporal_Subject(-1, -1, Data);
                        }
                    }
                    return true;

                case "title":
                    Package.Bib_Info.Main_Title.Title = Data;
                    return true;

                case "topics":
                    split_add_subjects(Package, Data);
                    return true;

                case "transcriptionprovidedby":
                    Package.Bib_Info.Add_Note(Data, Note_Type_Enum.CreationCredits, "Transcription Provided By");
                    return true;

                case "videofilesizeandduration":
                    // Get the duration from the parantheses
                    int vfsd_start = Data.IndexOf("(");
                    int vfsd_end = Data.IndexOf(")");
                    if ((vfsd_start > 0) && (vfsd_end > vfsd_start))
                    {
                        string duration_string = Data.Substring(vfsd_start + 1, vfsd_end - vfsd_start - 1);
                        Package.Bib_Info.Original_Description.Extent = duration_string;
                    }
                    return true;

                case "videographer":
                    Package.Bib_Info.Add_Named_Entity(Data, "Videographer").Name_Type = Name_Info_Type_Enum.Personal;
                    return true;

                case "volume":
                    // If there is already an enumberation (1), move it to (2)
                    if (!String.IsNullOrWhiteSpace(Package.Bib_Info.Series_Part_Info.Enum1))
                    {
                        Package.Bib_Info.Series_Part_Info.Enum2 = Package.Bib_Info.Series_Part_Info.Enum1;
                        Package.Bib_Info.Series_Part_Info.Enum2_Index = Package.Bib_Info.Series_Part_Info.Enum1_Index;
                    }

                    // Now, add the volume
                    int volume_number = -1;
                    if (Int32.TryParse(Data, out volume_number))
                    {
                        Package.Bib_Info.Series_Part_Info.Enum1 = "Volume " + Data;
                        Package.Bib_Info.Series_Part_Info.Enum1_Index = volume_number;
                    }
                    else
                    {
                        Package.Bib_Info.Series_Part_Info.Enum1 = Data + " Volume";
                        Package.Bib_Info.Series_Part_Info.Enum1_Index = -1;
                    }
                    return true;

                case "wars":
                    if ( Data.IndexOf("World War") >= 0 )
                        Package.Bib_Info.Add_Temporal_Subject(1939, 1945, "World War");
                    else if ( Data.IndexOf("Vietnam") >= 0 )
                        Package.Bib_Info.Add_Temporal_Subject(1961, 1975, "Vietnam War");
                    else if ( Data.IndexOf("Korean") >= 0 )
                        Package.Bib_Info.Add_Temporal_Subject(1950, 1953, "Korean War");
                    return true;

                case "writer":
                    Package.Bib_Info.Add_Named_Entity(Data, "Writer").Name_Type = Name_Info_Type_Enum.Personal;
                    return true;

                case "writerscontributors":
                    Package.Bib_Info.Add_Named_Entity(Data, "Writer / Contributor").Name_Type = Name_Info_Type_Enum.Personal;
                    return true;

                case "year":
                    Package.Bib_Info.Series_Part_Info.Year = Data;
                    return true;

                default:
                    // No mapping exists and this is a non-known no-mapping
                    return false;
            }
        }
        //new CSV Writer
        private bool Write_CSVFILE(TextWriter CsvOutput, SobekCM_Item METS_Item, Dictionary<string, object> Options)
        {
            //2do confirm that this outputs a string of goodies ready to place in a CSV file

            // GEt the geo-spatial information if it exists
            GeoSpatial_Information geoInfo = METS_Item.Get_Metadata_Module(GlobalVar.GEOSPATIAL_METADATA_MODULE_KEY) as GeoSpatial_Information;
            if (geoInfo == null)
                return true;

            string imageURL = "http://ufdc.ufl.edu/"; //create imageURL
            imageURL += METS_Item.BibID;
            imageURL += "/";
            imageURL += METS_Item.VID;

            CsvOutput.WriteLine("BIBID, VID, Title, Date, ImageURL, Latitude1, Longitude1, Latitude2, Longitude2, Latitude3, Longitude3, Latitude4, Longitude4"); //output csv header //2do, make definable?

            //for points
            foreach (Coordinate_Point thisPoint in geoInfo.Points)
            {
                //iURL writer
                string csvImageURL = imageURL;

                CsvOutput.Write(METS_Item.BibID + ", " + METS_Item.VID + ", " + METS_Item.Bib_Title.Replace(",", " ") + ", " + METS_Item.Bib_Info.Origin_Info.Date_Issued + ", " + csvImageURL + ", ");
                CsvOutput.Write(thisPoint.Latitude + ", " + thisPoint.Longitude + ", ");
                CsvOutput.WriteLine(); //add line break
            }

            //for lines
            foreach (Coordinate_Line thisLine in geoInfo.Lines)
            {
                //URL writer
                string csvImageURL = imageURL;

                CsvOutput.Write(METS_Item.BibID + ", " + METS_Item.VID + ", " + METS_Item.Bib_Title.Replace(",", " ") + ", " + METS_Item.Bib_Info.Origin_Info.Date_Issued + ", " + csvImageURL + ", ");
                foreach (Coordinate_Point thisPoint in thisLine.Points) //for each lat/long
                {
                    CsvOutput.Write(thisPoint.Latitude + ", " + thisPoint.Longitude + ", ");
                }
                CsvOutput.WriteLine(); //add line break
            }

            //for polygons
            foreach (Coordinate_Polygon thisPolygon in geoInfo.Polygons) //for each polygon with coordinates
            {
                //URL writer
                string csvImageURL = imageURL;
                if (geoInfo.Polygon_Count > 1) //this fixes bug where imageURL could be set to 0
                {
                    csvImageURL += "/";
                    csvImageURL += thisPolygon.Page_Sequence;
                }

                CsvOutput.Write(METS_Item.BibID + ", " + METS_Item.VID + ", " + METS_Item.Bib_Title.Replace(",", " ") + ", " + METS_Item.Bib_Info.Origin_Info.Date_Issued + ", " + csvImageURL + ", ");
                foreach (Coordinate_Point thisPoint in thisPolygon.Edge_Points) //for each lat/long
                {
                    CsvOutput.Write(thisPoint.Latitude + ", " + thisPoint.Longitude + ", "); //csv
                }
                CsvOutput.WriteLine(); //add line break
            }

            return true;
        }
        //new GML Writer
        private bool Write_GMLFile(TextWriter GmlOutput, SobekCM_Item METS_Item, Dictionary<string, object> Options)
        {
            //2do confirm that this outputs a string of goodies ready to place in a GML file

            // GEt the geo-spatial information if it exists
            GeoSpatial_Information geoInfo = METS_Item.Get_Metadata_Module(GlobalVar.GEOSPATIAL_METADATA_MODULE_KEY) as GeoSpatial_Information;
            if (geoInfo == null)
                return true;

            string GMLSchemaURL = "http://www.opengis.net/gml"; //create header  //2do: add custom schema
            string imageURL = "http://ufdc.ufl.edu/"; //create imageURL
            imageURL += METS_Item.BibID;
            imageURL += "/";
            imageURL += METS_Item.VID;
            string featureCollectionURL = imageURL; //create collectionURL

            GmlOutput.WriteLine("<?xml version=\"1.0\" encoding=\"UTF-8\"?>"); //write header
            GmlOutput.WriteLine("<gml:FeatureCollection xmlns:gml=\"" + GMLSchemaURL + "\">");
            GmlOutput.WriteLine("<sobekCM:Collection URI=\"" + featureCollectionURL + "\">"); //write collectionURL

            //for points
            foreach (Coordinate_Point thisPoint in geoInfo.Points)
            {
                string featureMemberURL = imageURL;

                GmlOutput.WriteLine("<gml:featureMember>");
                GmlOutput.WriteLine("<sobekCM:Item URL=\"" + featureMemberURL + "\">");
                GmlOutput.WriteLine("<gml:Point>");
                GmlOutput.Write("<gml:Coordinates>");
                GmlOutput.Write(thisPoint.Latitude + "," + thisPoint.Longitude + " ");
                GmlOutput.Write("</gml:Coordinates>");
                GmlOutput.WriteLine(); //add line break
                GmlOutput.WriteLine("</gml:Point>");
                GmlOutput.WriteLine("</sobekCM:Item>");
                GmlOutput.WriteLine("</gml:featureMember>");

            }

            //for lines
            foreach (Coordinate_Line thisLine in geoInfo.Lines)
            {
                string featureMemberURL = imageURL;

                GmlOutput.WriteLine("<gml:featureMember>");
                GmlOutput.WriteLine("<sobekCM:Item URL=\"" + featureMemberURL + "\">");
                GmlOutput.WriteLine("<gml:boundedBy>");
                GmlOutput.WriteLine("<gml:Box>");
                GmlOutput.Write("<gml:Coordinates>");
                foreach (Coordinate_Point thisPoint in thisLine.Points) //for each lat/long
                {
                    GmlOutput.Write(thisPoint.Latitude + "," + thisPoint.Longitude + " ");
                }
                GmlOutput.Write("</gml:Coordinates>");
                GmlOutput.WriteLine(); //add line break
                GmlOutput.WriteLine("</gml:Box>");
                GmlOutput.WriteLine("</gml:boundedBy>");
                GmlOutput.WriteLine("</sobekCM:Item>");
                GmlOutput.WriteLine("</gml:featureMember>");
            }

            //for polygons
            foreach (Coordinate_Polygon thisPolygon in geoInfo.Polygons) //for each polygon with coordinates
            {
                string featureMemberURL = imageURL;
                featureMemberURL += "/";
                featureMemberURL += thisPolygon.Page_Sequence;

                GmlOutput.WriteLine("<gml:featureMember>");
                GmlOutput.WriteLine("<sobekCM:Item URL=\"" + featureMemberURL + "\">");
                GmlOutput.WriteLine("<gml:Polygon>");
                GmlOutput.WriteLine("<gml:exterior>");
                GmlOutput.WriteLine("<gml:LinearRing>");
                GmlOutput.Write("<gml:Coordinates>");
                foreach (Coordinate_Point thisPoint in thisPolygon.Edge_Points) //for each lat/long
                {
                    GmlOutput.Write(thisPoint.Latitude + "," + thisPoint.Longitude + " "); //gml
                }
                GmlOutput.Write("</gml:Coordinates>");
                GmlOutput.WriteLine(); //gml, add line break
                GmlOutput.WriteLine("</gml:LinearRing>");
                GmlOutput.WriteLine("</gml:exterior>");
                GmlOutput.WriteLine("</gml:Polygon>");
                GmlOutput.WriteLine("<sobekCM:/Item>");
                GmlOutput.WriteLine("</gml:featureMember>");
            }

            //send closing gml tags and close gml file
            GmlOutput.WriteLine("</sobekCM:Collection>");
            GmlOutput.WriteLine("</gml:FeatureCollection>");
            GmlOutput.Flush();
            GmlOutput.Close();

            return true;
        }
 /// <summary> Flag indicates if this active reader/writer needs to append schema reference information
 /// to the METS XML header by analyzing the contents of the digital resource item </summary>
 /// <param name="METS_Item"> Package with all the metadata to save</param>
 /// <returns> TRUE if the schema should be attached, otherwise fALSE </returns>
 public bool Schema_Reference_Required_Package(SobekCM_Item METS_Item)
 {
     DAITSS_Info daitssInfo = METS_Item.Get_Metadata_Module(GlobalVar.DAITSS_METADATA_MODULE_KEY) as DAITSS_Info;
     if (daitssInfo == null)
         return false;
     return daitssInfo.hasData;
 }
        private void read_coordinates_info(XmlReader Input_XmlReader, SobekCM_Item Return_Package)
        {
            GeoSpatial_Information geoInfo = Return_Package.Get_Metadata_Module(GlobalVar.GEOSPATIAL_METADATA_MODULE_KEY) as GeoSpatial_Information;
            if (geoInfo == null)
            {
                geoInfo = new GeoSpatial_Information();
                Return_Package.Add_Metadata_Module(GlobalVar.GEOSPATIAL_METADATA_MODULE_KEY, geoInfo);
            }

            while (Input_XmlReader.Read())
            {
                if ((Input_XmlReader.NodeType == XmlNodeType.EndElement) && (Input_XmlReader.Name == sobekcm_namespace + ":Coordinates"))
                {
                    return;
                }

                if (Input_XmlReader.NodeType == XmlNodeType.Element)
                {
                    switch (Input_XmlReader.Name.Replace(sobekcm_namespace + ":", ""))
                    {
                        case "KML":
                            if (!Input_XmlReader.IsEmptyElement)
                            {
                                Input_XmlReader.Read();
                                if (Input_XmlReader.NodeType == XmlNodeType.Text)
                                    geoInfo.KML_Reference = Input_XmlReader.Value;
                            }
                            break;
                        case "Point":
                            geoInfo.Add_Point(read_point(Input_XmlReader));
                            break;

                        case "Line":
                            Coordinate_Line newLine = new Coordinate_Line();
                            if (Input_XmlReader.MoveToAttribute("label"))
                                newLine.Label = Input_XmlReader.Value;
                            while (Input_XmlReader.Read())
                            {
                                if ((Input_XmlReader.NodeType == XmlNodeType.EndElement) && (Input_XmlReader.Name == sobekcm_namespace + ":Line"))
                                {
                                    geoInfo.Add_Line(newLine);
                                    break;
                                }

                                if ((Input_XmlReader.NodeType == XmlNodeType.Element) && (Input_XmlReader.Name == sobekcm_namespace + ":Point"))
                                {
                                    newLine.Add_Point(read_point(Input_XmlReader));
                                }
                            }
                            break;

                        case "Polygon":
                            Coordinate_Polygon newPolygon = new Coordinate_Polygon();
                            if (Input_XmlReader.MoveToAttribute("label"))
                                newPolygon.Label = Input_XmlReader.Value;
                            if (Input_XmlReader.MoveToAttribute("ID"))
                                newPolygon.ID = Input_XmlReader.Value;
                            if (Input_XmlReader.MoveToAttribute("pageSeq"))
                            {
                                try
                                {
                                    newPolygon.Page_Sequence = Convert.ToUInt16(Input_XmlReader.Value);
                                }
                                catch
                                {
                                }
                            }

                            while (Input_XmlReader.Read())
                            {
                                if ((Input_XmlReader.NodeType == XmlNodeType.EndElement) && (Input_XmlReader.Name == sobekcm_namespace + ":Polygon"))
                                {
                                    geoInfo.Add_Polygon(newPolygon);
                                    break;
                                }

                                if (Input_XmlReader.NodeType == XmlNodeType.Element)
                                {
                                    if (Input_XmlReader.Name == sobekcm_namespace + ":Edge")
                                    {
                                        while (Input_XmlReader.Read())
                                        {
                                            if ((Input_XmlReader.NodeType == XmlNodeType.EndElement) && (Input_XmlReader.Name == sobekcm_namespace + ":Edge"))
                                            {
                                                break;
                                            }

                                            if ((Input_XmlReader.NodeType == XmlNodeType.Element) && (Input_XmlReader.Name == sobekcm_namespace + ":Point"))
                                            {
                                                newPolygon.Add_Edge_Point(read_point(Input_XmlReader));
                                            }
                                        }
                                    }

                                    if (Input_XmlReader.Name == sobekcm_namespace + ":Internal")
                                    {
                                        while (Input_XmlReader.Read())
                                        {
                                            if ((Input_XmlReader.NodeType == XmlNodeType.EndElement) && (Input_XmlReader.Name == sobekcm_namespace + ":Internal"))
                                            {
                                                break;
                                            }

                                            if ((Input_XmlReader.NodeType == XmlNodeType.Element) && (Input_XmlReader.Name == sobekcm_namespace + ":Point"))
                                            {
                                                newPolygon.Add_Inner_Point(read_point(Input_XmlReader));
                                            }
                                        }
                                    }
                                }
                            }
                            break;
                    }
                }
            }
        }
        /// <summary> Reads the MARC Core-compliant section of XML and stores the data in the provided digital resource </summary>
        /// <param name="r"> XmlTextReader from which to read the marc data </param>
        /// <param name="thisBibInfo">Bibliographic object into which most the values are read</param>
        /// <param name="package"> Digital resource object to save the data to if this is reading the top-level bibDesc (OPTIONAL)</param>
        /// <param name="Importing_Record"> Importing record flag is used to determine if special treatment should be applied to the 001 identifier.  If this is reading MarcXML from a dmdSec, this is set to false </param>
        /// <param name="Options"> Dictionary of any options which this metadata reader/writer may utilize </param>
        public static void Read_MarcXML_Info(XmlReader r, Bibliographic_Info thisBibInfo, SobekCM_Item package, bool Importing_Record, Dictionary<string, object> Options )
        {
            // Create the MARC_XML_Reader to load everything into first
            MARC_Record record = new MARC_Record();

            // Read from the file
            record.Read_MARC_Info(r);

            // Handle optional mapping first for retaining the 856 as a related link
            if ((Options != null) && (Options.ContainsKey("MarcXML_File_ReaderWriter.Retain_856_As_Related_Link")))
            {
                if (Options["MarcXML_File_ReaderWriter.Retain_856_As_Related_Link"].ToString().ToUpper() == "TRUE")
                {
                    if ((record.Get_Data_Subfield(856, 'u').Length > 0) && (record.Get_Data_Subfield(856, 'y').Length > 0))
                    {
                        string url856 = record.Get_Data_Subfield(856, 'u');
                        string label856 = record.Get_Data_Subfield(856, 'y');

                        thisBibInfo.Location.Other_URL = url856;
                        thisBibInfo.Location.Other_URL_Note = label856;
                    }
                }
            }

            // Now, load values into the bib package
            // Load the date ( 260 |c )
            thisBibInfo.Origin_Info.MARC_DateIssued = Remove_Trailing_Punctuation(record.Get_Data_Subfield(260, 'c'));

            // Load the descriptions and notes about this item
            Add_Descriptions(thisBibInfo, record);

            // Look for the 786  with special identifiers to map back into the source notes
            foreach (MARC_Field thisRecord in record[786])
            {
                if ((thisRecord.Indicators == "0 ") && (thisRecord.Subfield_Count == 1) && (thisRecord.has_Subfield('n')))
                    thisBibInfo.Add_Note(thisRecord.Subfields[0].Data, Note_Type_Enum.Source);
            }

            // Add the contents (505)
            if (record.Get_Data_Subfield(505, 'a').Length > 2)
            {
                thisBibInfo.Add_TableOfContents(record.Get_Data_Subfield(505, 'a'));
            }

            // Get the scale information (034)
            if (record.Get_Data_Subfield(034, 'b').Length > 2)
            {
                thisBibInfo.Add_Scale(record.Get_Data_Subfield(034, 'b'), "SUBJ034");
            }

            // Get the scale information (255)
            if ((record.Get_Data_Subfield(255, 'a').Length > 2) || (record.Get_Data_Subfield(255, 'b').Length > 2) || (record.Get_Data_Subfield(255, 'c').Length > 2))
            {
                thisBibInfo.Add_Scale(record.Get_Data_Subfield(255, 'a'), record.Get_Data_Subfield(255, 'b'), record.Get_Data_Subfield(255, 'c'), "SUBJ255");
            }

            // Get the coordinate information (034)
            if ((record.Get_Data_Subfield(034, 'd').Length > 0) && (record.Get_Data_Subfield(034, 'e').Length > 0) && (record.Get_Data_Subfield(034, 'f').Length > 0) && (record.Get_Data_Subfield(034, 'g').Length > 0))
            {
                // This is an extra metadata component
                GeoSpatial_Information geoInfo = package.Get_Metadata_Module(GlobalVar.GEOSPATIAL_METADATA_MODULE_KEY) as GeoSpatial_Information;
                if (geoInfo == null)
                {
                    geoInfo = new GeoSpatial_Information();
                    package.Add_Metadata_Module(GlobalVar.GEOSPATIAL_METADATA_MODULE_KEY, geoInfo);
                }

                if (geoInfo.Polygon_Count == 0)
                {
                    try
                    {

                        string d_field = record.Get_Data_Subfield(034, 'd').Replace("O", "0");
                        string e_field = record.Get_Data_Subfield(034, 'e').Replace("O", "0");
                        string f_field = record.Get_Data_Subfield(034, 'f').Replace("O", "0");
                        string g_field = record.Get_Data_Subfield(034, 'g').Replace("O", "0");

                        double d_value = 1;
                        double e_value = 1;
                        double f_value = 1;
                        double g_value = 1;

                        if (d_field.Contains("."))
                        {
                            if (d_field.Contains("W"))
                            {
                                d_value = -1*Convert.ToDouble(d_field.Replace("W", ""));
                            }
                            else
                            {
                                d_value = Convert.ToDouble(d_field.Replace("E", ""));
                            }
                        }
                        else
                        {
                            d_value = Convert.ToDouble(d_field.Substring(1, 3)) + (Convert.ToDouble(d_field.Substring(4, 2))/60);

                            if ((d_field[0] == '-') || (d_field[0] == 'W'))
                            {
                                d_value = -1*d_value;
                            }
                        }

                        if (d_value < -180)
                            d_value = d_value + 360;

                        if (e_field.Contains("."))
                        {
                            if (e_field.Contains("W"))
                            {
                                e_value = -1*Convert.ToDouble(e_field.Replace("W", ""));
                            }
                            else
                            {
                                e_value = Convert.ToDouble(e_field.Replace("E", ""));
                            }
                        }
                        else
                        {
                            e_value = Convert.ToDouble(e_field.Substring(1, 3)) + (Convert.ToDouble(e_field.Substring(4, 2))/60);

                            if ((e_field[0] == '-') || (e_field[0] == 'W'))
                            {
                                e_value = -1*e_value;
                            }
                        }

                        if (e_value < -180)
                            e_value = e_value + 360;

                        if (f_field.Contains("."))
                        {
                            if (f_field.Contains("S"))
                            {
                                f_value = -1*Convert.ToDouble(f_field.Replace("S", ""));
                            }
                            else
                            {
                                f_value = Convert.ToDouble(f_field.Replace("N", ""));
                            }
                        }
                        else
                        {
                            f_value = Convert.ToDouble(f_field.Substring(1, 3)) + (Convert.ToDouble(f_field.Substring(4, 2))/60);

                            if ((f_field[0] == '-') || (f_field[0] == 'S'))
                            {
                                f_value = -1*f_value;
                            }
                        }

                        if (g_field.Contains("."))
                        {
                            if (g_field.Contains("S"))
                            {
                                g_value = -1*Convert.ToDouble(g_field.Replace("S", ""));
                            }
                            else
                            {
                                g_value = Convert.ToDouble(g_field.Replace("N", ""));
                            }
                        }
                        else
                        {
                            g_value = Convert.ToDouble(g_field.Substring(1, 3)) + (Convert.ToDouble(g_field.Substring(4, 2))/60);

                            if ((g_field[0] == '-') || (g_field[0] == 'S'))
                            {
                                g_value = -1*g_value;
                            }
                        }
                        Coordinate_Polygon polygon = new Coordinate_Polygon();
                        polygon.Add_Edge_Point(f_value, d_value);
                        polygon.Add_Edge_Point(g_value, d_value);
                        polygon.Add_Edge_Point(g_value, e_value);
                        polygon.Add_Edge_Point(f_value, e_value);
                        polygon.Label = "Map Coverage";
                        geoInfo.Add_Polygon(polygon);
                    }
                    catch {   }
                }
            }

            // Add the abstract ( 520 |a )
            foreach (MARC_Field thisRecord in record[520])
            {
                if (thisRecord.has_Subfield('a'))
                {
                    Abstract_Info newAbstract = new Abstract_Info();
                    switch (thisRecord.Indicator1)
                    {
                        case ' ':
                            newAbstract.Type = "summary";
                            newAbstract.Display_Label = "Summary";
                            break;

                        case '0':
                            newAbstract.Type = "subject";
                            newAbstract.Display_Label = "Subject";
                            break;

                        case '1':
                            newAbstract.Type = "review";
                            newAbstract.Display_Label = "Review";
                            break;

                        case '2':
                            newAbstract.Type = "scope and content";
                            newAbstract.Display_Label = "Scope and Content";
                            break;

                        case '4':
                            newAbstract.Type = "content advice";
                            newAbstract.Display_Label = "Content Advice";
                            break;

                        default:
                            newAbstract.Display_Label = "Abstract";
                            break;
                    }

                    if (thisRecord.has_Subfield('b'))
                    {
                        newAbstract.Abstract_Text = thisRecord['a'] + " " + thisRecord['b'];
                    }
                    else
                    {
                        newAbstract.Abstract_Text = thisRecord['a'];
                    }
                    thisBibInfo.Add_Abstract(newAbstract);
                }
            }

            // Load the format ( 300 )
            if (record.has_Field(300))
            {
                StringBuilder builder300 = new StringBuilder();
                if (record.Get_Data_Subfield(300, 'a').Length > 0)
                {
                    builder300.Append(record.Get_Data_Subfield(300, 'a').Replace(":", "").Replace(";", "").Trim());
                }
                builder300.Append(" : ");
                if (record.Get_Data_Subfield(300, 'b').Length > 0)
                {
                    builder300.Append(record.Get_Data_Subfield(300, 'b').Replace(";", "").Trim());
                }
                builder300.Append(" ; ");
                if (record.Get_Data_Subfield(300, 'c').Length > 0)
                {
                    builder300.Append(record.Get_Data_Subfield(300, 'c'));
                }
                thisBibInfo.Original_Description.Extent = builder300.ToString().Trim();
                if (thisBibInfo.Original_Description.Extent.Replace(" ", "").Replace(":", "").Replace(";", "") == "v.")
                    thisBibInfo.Original_Description.Extent = String.Empty;
            }

            // Load the current frequency (310)
            foreach (MARC_Field thisRecord in record[310])
            {
                if (thisRecord.has_Subfield('a'))
                {
                    if (thisRecord.has_Subfield('b'))
                    {
                        thisBibInfo.Origin_Info.Add_Frequency(Remove_Trailing_Punctuation(thisRecord['a']).Replace("[", "(").Replace("]", ")") + "[" + thisRecord['b'].Replace("[", "(").Replace("]", ")") + "]");
                    }
                    else
                    {
                        thisBibInfo.Origin_Info.Add_Frequency(Remove_Trailing_Punctuation(thisRecord['a']).Replace("[", "(").Replace("]", ")"));
                    }
                }
            }

            // Load the previous frequency (321)
            foreach (MARC_Field thisRecord in record[321])
            {
                if (thisRecord.has_Subfield('a'))
                {
                    if (thisRecord.has_Subfield('b'))
                    {
                        thisBibInfo.Origin_Info.Add_Frequency(Remove_Trailing_Punctuation(thisRecord['a']).Replace("[", "(").Replace("]", ")") + "[ FORMER " + thisRecord['b'].Replace("[", "(").Replace("]", ")") + "]");
                    }
                    else
                    {
                        thisBibInfo.Origin_Info.Add_Frequency(Remove_Trailing_Punctuation(thisRecord['a']).Replace("[", "(").Replace("]", ")") + "[ FORMER ]");
                    }
                }
            }

            // Load the edition ( 250 )
            if (record.has_Field(250))
            {
                if (record.Get_Data_Subfield(250, 'b').Length > 0)
                {
                    thisBibInfo.Origin_Info.Edition = record.Get_Data_Subfield(250, 'a').Replace("/", "").Replace("=", "").Trim() + " -- " + record.Get_Data_Subfield(250, 'b');
                }
                else
                {
                    thisBibInfo.Origin_Info.Edition = record.Get_Data_Subfield(250, 'a');
                }
            }

            // Load the language ( 008 )
            if (record.has_Field(8))
            {
                string field_08 = record[8][0].Control_Field_Value;
                if (field_08.Length > 5)
                {
                    // Get the language code
                    string languageCode = field_08.Substring(field_08.Length - 5, 3);

                    // Add as the language of the item
                    Language_Info thisLanguage = thisBibInfo.Add_Language(String.Empty, languageCode, String.Empty);

                    // Add as the language of the cataloging
                    thisBibInfo.Record.Add_Catalog_Language(new Language_Info(thisLanguage.Language_Text, thisLanguage.Language_ISO_Code, String.Empty));
                }
            }

            // Load any additional languages (041)
            foreach (MARC_Field thisRecord in record[041])
            {
                foreach (MARC_Subfield thisSubfield in thisRecord.Subfields)
                {
                    if ((thisSubfield.Subfield_Code == 'a') || (thisSubfield.Subfield_Code == 'b') || (thisSubfield.Subfield_Code == 'd') ||
                        (thisSubfield.Subfield_Code == 'e') || (thisSubfield.Subfield_Code == 'f') || (thisSubfield.Subfield_Code == 'g') ||
                        (thisSubfield.Subfield_Code == 'h'))
                    {
                        thisBibInfo.Add_Language(thisSubfield.Data);
                    }
                }
            }

            // Load the publisher ( 260 |b )
            if (record.has_Field(260))
            {
                string[] special_260_splitter = record[260][0].Control_Field_Value.Split("|".ToCharArray());
                Publisher_Info thisInfo = new Publisher_Info();
                foreach (string thisSplitter in special_260_splitter)
                {
                    if (thisSplitter.Length > 2)
                    {
                        if (thisSplitter[0] == 'a')
                        {
                            thisInfo.Add_Place(Remove_Trailing_Punctuation(thisSplitter.Substring(2).Replace(" :", "").Trim()));
                            thisInfo.Name = "[s.n.]";
                            thisBibInfo.Add_Publisher(thisInfo);
                        }

                        if (thisSplitter[0] == 'b')
                        {
                            string pubname = thisSplitter.Substring(2).Replace(";", "").Trim();
                            if ((pubname.Length > 1) && (pubname[pubname.Length - 1] == ','))
                            {
                                pubname = pubname.Substring(0, pubname.Length - 1);
                            }

                            thisInfo.Name = pubname;
                            thisBibInfo.Add_Publisher(thisInfo);
                            thisInfo = new Publisher_Info();
                        }

                        if (thisSplitter[0] == 'e')
                        {
                            thisInfo.Add_Place(thisSplitter.Substring(2).Replace("(", "").Replace(" :", "").Trim());
                        }

                        if (thisSplitter[0] == 'f')
                        {
                            string manname = thisSplitter.Substring(2).Replace(")", "").Trim();
                            if ((manname.Length > 1) && (manname[manname.Length - 1] == ','))
                            {
                                manname = manname.Substring(0, manname.Length - 1);
                            }

                            thisInfo.Name = manname;
                            thisBibInfo.Add_Manufacturer(thisInfo);
                            thisInfo = new Publisher_Info();
                        }
                    }
                }
            }

            // Load the dates from the 008
            string field_008 = String.Empty;
            if (record.has_Field(008))
            {
                field_008 = record[8][0].Control_Field_Value;
                if (field_008.Length > 14)
                {
                    // Save the two date points
                    thisBibInfo.Origin_Info.MARC_DateIssued_Start = field_008.Substring(7, 4).Trim();
                    thisBibInfo.Origin_Info.MARC_DateIssued_End = field_008.Substring(11, 4).Trim();

                    // See what type of dates they are (if they are special)
                    char date_type = field_008[6];
                    switch (date_type)
                    {
                        case 'r':
                            thisBibInfo.Origin_Info.Date_Reprinted = thisBibInfo.Origin_Info.MARC_DateIssued_Start;
                            break;

                        case 't':
                            thisBibInfo.Origin_Info.Date_Copyrighted = thisBibInfo.Origin_Info.MARC_DateIssued_End;
                            break;
                    }
                }

                if (field_008.Length > 5)
                {
                    thisBibInfo.Record.MARC_Creation_Date = field_008.Substring(0, 6);
                }
            }

            // Load the location from the 008
            if (field_008.Length > 17)
            {
                thisBibInfo.Origin_Info.Add_Place(String.Empty, field_008.Substring(15, 3), String.Empty);
            }

            // Load the main record number ( 001 )
            string idValue;
            string oclc = String.Empty;
            if (record.has_Field(1))
            {
                idValue = record[1][0].Control_Field_Value.Trim();
                if (idValue.Length > 0)
                {
                    thisBibInfo.Record.Main_Record_Identifier.Identifier = idValue;
                    if (Importing_Record)
                    {
                        if (Char.IsNumber(idValue[0]))
                        {
                            // Add this ALEPH number
                            if (thisBibInfo.ALEPH_Record != idValue)
                            {
                                thisBibInfo.Add_Identifier(idValue, "ALEPH");
                            }
                            thisBibInfo.Record.Record_Origin = "Imported from (ALEPH)" + idValue;
                        }
                        else
                        {
                            if (idValue.Length >= 7)
                            {
                                if ((idValue.IndexOf("ocm") == 0) || (idValue.IndexOf("ocn") == 0))
                                {
                                    oclc = idValue.Replace("ocn", "").Replace("ocm", "");
                                    if (thisBibInfo.OCLC_Record != oclc)
                                    {
                                        thisBibInfo.Add_Identifier(oclc, "OCLC");
                                    }
                                    thisBibInfo.Record.Record_Origin = "Imported from (OCLC)" + oclc;
                                }
                                else
                                {
                                    thisBibInfo.Add_Identifier(idValue.Substring(0, 7), "NOTIS");
                                    thisBibInfo.Record.Record_Origin = "Imported from (NOTIS)" + idValue.Substring(0, 7);
                                }
                            }
                        }
                    }
                }
            }

            // If this was OCLC record (non-local) look for a 599 added during time of export
            if (oclc.Length > 0)
            {
                if (record.has_Field(599))
                {
                    // Tracking box number will be in the |a field
                    if ((package != null) && (record[599][0].has_Subfield('a')))
                    {
                        package.Tracking.Tracking_Box = record[599][0]['a'];
                    }

                    // Disposition advice will be in the |b field
                    if ((package != null) && (record[599][0].has_Subfield('b')))
                    {
                        package.Tracking.Disposition_Advice_Notes = record[599][0]['b'];
                        string advice_notes_as_caps = package.Tracking.Disposition_Advice_Notes.ToUpper();
                        if ((advice_notes_as_caps.IndexOf("RETURN") >= 0) || (advice_notes_as_caps.IndexOf("RETAIN") >= 0))
                        {
                            package.Tracking.Disposition_Advice = 1;
                        }
                        else
                        {
                            if (advice_notes_as_caps.IndexOf("WITHDRAW") >= 0)
                            {
                                package.Tracking.Disposition_Advice = 2;
                            }
                            else if (advice_notes_as_caps.IndexOf("DISCARD") >= 0)
                            {
                                package.Tracking.Disposition_Advice = 3;
                            }
                        }
                    }

                    // Do not overlay record in the future will be in the |c field
                    if (record[599][0].has_Subfield('c'))
                    {
                        string record_overlay_notes = record[599][0]['c'].Trim();
                        if (record_overlay_notes.Length > 0)
                        {
                            if (package != null)
                            {
                                package.Tracking.Never_Overlay_Record = true;
                                package.Tracking.Internal_Comments = record_overlay_notes;
                            }
                            thisBibInfo.Record.Record_Content_Source = thisBibInfo.Record.Record_Content_Source + " (" + record_overlay_notes + ")";
                        }
                    }
                }
            }

            // Step through all of the identifiers
            foreach (MARC_Field thisRecord in record[35])
            {
                // Only continue if there is an id in this record
                if (thisRecord.has_Subfield('a'))
                {
                    // Was this the old NOTIS number?
                    if (thisRecord.Indicators == "9 ")
                    {
                        thisBibInfo.Add_Identifier(thisRecord['a'], "NOTIS");
                    }

                    // Was this the OCLC number?
                    if ((oclc.Length == 0) && (thisRecord['a'].ToUpper().IndexOf("OCOLC") >= 0))
                    {
                        thisBibInfo.Add_Identifier(thisRecord['a'].ToUpper().Replace("(OCOLC)", "").Trim(), "OCLC");
                    }

                    // Was this the BIB ID?
                    if ((package != null) && (thisRecord['a'].ToUpper().IndexOf("IID") >= 0))
                    {
                        package.BibID = thisRecord['a'].ToUpper().Replace("(IID)", "").Trim();
                    }
                }
            }

            // Also, look for the old original OCLC in the 776 10 |w
            if (thisBibInfo.OCLC_Record.Length == 0)
            {
                foreach (MARC_Field thisRecord in record[776])
                {
                    if ((thisRecord.Indicators == "1 ") && (thisRecord.has_Subfield('w')) && (thisRecord['w'].ToUpper().IndexOf("OCOLC") >= 0))
                    {
                        thisBibInfo.Add_Identifier(thisRecord['w'].ToUpper().Replace("(OCOLC)", "").Trim(), "OCLC");
                    }
                }
            }

            // Look for the LCCN in field 10
            if (record.Get_Data_Subfield(10, 'a').Length > 0)
                thisBibInfo.Add_Identifier(record.Get_Data_Subfield(10, 'a'), "LCCN");

            // Look for ISBN in field 20
            if (record.Get_Data_Subfield(20, 'a').Length > 0)
                thisBibInfo.Add_Identifier(record.Get_Data_Subfield(20, 'a'), "ISBN");

            // Look for ISSN in field 22
            if (record.Get_Data_Subfield(22, 'a').Length > 0)
                thisBibInfo.Add_Identifier(record.Get_Data_Subfield(22, 'a'), "ISSN");

            // Look for classification ( LCC ) in field 50
            if (record.Get_Data_Subfield(50, 'a').Length > 0)
            {
                string subfield_3 = String.Empty;
                if (record.Get_Data_Subfield(50, '3').Length > 0)
                {
                    subfield_3 = record.Get_Data_Subfield(50, '3');
                }
                if (record.Get_Data_Subfield(50, 'b').Length > 0)
                    thisBibInfo.Add_Classification(record.Get_Data_Subfield(50, 'a') + " " + record.Get_Data_Subfield(50, 'b'), "lcc").Display_Label = subfield_3;
                else
                    thisBibInfo.Add_Classification(record.Get_Data_Subfield(50, 'a'), "lcc").Display_Label = subfield_3;
            }

            // Look for classification ( DDC ) in field 82
            if (record.Get_Data_Subfield(82, 'a').Length > 0)
            {
                string subfield_2 = String.Empty;
                if (record.Get_Data_Subfield(82, '2').Length > 0)
                {
                    subfield_2 = record.Get_Data_Subfield(82, '2');
                }
                if (record.Get_Data_Subfield(82, 'b').Length > 0)
                    thisBibInfo.Add_Classification(record.Get_Data_Subfield(82, 'a') + " " + record.Get_Data_Subfield(82, 'b'), "ddc").Edition = subfield_2;
                else
                    thisBibInfo.Add_Classification(record.Get_Data_Subfield(82, 'a'), "ddc").Edition = subfield_2;
            }

            // Look for classification ( UDC ) in field 80
            if (record.Get_Data_Subfield(80, 'a').Length > 0)
            {
                StringBuilder builder = new StringBuilder();
                builder.Append(record.Get_Data_Subfield(80, 'a'));
                if (record.Get_Data_Subfield(80, 'b').Length > 0)
                    builder.Append(" " + record.Get_Data_Subfield(80, 'b'));
                if (record.Get_Data_Subfield(80, 'x').Length > 0)
                    builder.Append(" " + record.Get_Data_Subfield(80, 'x'));
                thisBibInfo.Add_Classification(builder.ToString(), "udc");
            }

            // Look for classification ( NLM ) in field 60
            if (record.Get_Data_Subfield(60, 'a').Length > 0)
            {
                if (record.Get_Data_Subfield(60, 'b').Length > 0)
                    thisBibInfo.Add_Classification(record.Get_Data_Subfield(60, 'a') + " " + record.Get_Data_Subfield(60, 'b'), "nlm");
                else
                    thisBibInfo.Add_Classification(record.Get_Data_Subfield(60, 'a'), "nlm");
            }

            // Look for classification ( SUDOCS or CANDOCS ) in field 86
            foreach (MARC_Field thisRecord in record[84])
            {
                string authority = String.Empty;
                switch (thisRecord.Indicator1)
                {
                    case '0':
                        authority = "sudocs";
                        break;

                    case '1':
                        authority = "candocs";
                        break;

                    default:
                        if (thisRecord.has_Subfield('2'))
                            authority = thisRecord['2'];
                        break;
                }

                if (thisRecord.has_Subfield('a'))
                    thisBibInfo.Add_Classification(thisRecord['a'], authority);
            }

            // Look for other classifications in field 084
            foreach (MARC_Field thisRecord in record[84])
            {
                if (thisRecord.has_Subfield('a'))
                {
                    string subfield_2 = String.Empty;
                    if (thisRecord.has_Subfield('2'))
                    {
                        subfield_2 = thisRecord['2'];
                    }
                    if (thisRecord.has_Subfield('b'))
                        thisBibInfo.Add_Classification(thisRecord['a'] + " " + thisRecord['b'], subfield_2);
                    else
                        thisBibInfo.Add_Classification(thisRecord['a'], subfield_2);
                }
            }

            // Look for any other identifiers in field 24
            foreach (MARC_Field thisRecord in record[24])
            {
                string identifier_source = String.Empty;
                switch (thisRecord.Indicator1)
                {
                    case '0':
                        identifier_source = "isrc";
                        break;

                    case '1':
                        identifier_source = "upc";
                        break;

                    case '2':
                        identifier_source = "ismn";
                        break;

                    case '3':
                        identifier_source = "ian";
                        break;

                    case '4':
                        identifier_source = "sici";
                        break;

                    case '7':
                        identifier_source = thisRecord['2'];
                        break;
                }

                if (thisRecord.has_Subfield('d'))
                {
                    thisBibInfo.Add_Identifier(thisRecord['a'] + " (" + thisRecord['d'] + ")", identifier_source);
                }
                else
                {
                    thisBibInfo.Add_Identifier(thisRecord['a'], identifier_source);
                }
            }

            // Look for the ISSN in the 440 and 490 |x and LCCN in the 490 |l
            foreach (MARC_Field thisRecord in record[440])
            {
                if (thisRecord.has_Subfield('x'))
                {
                    thisBibInfo.Add_Identifier(thisRecord['x'], "ISSN");
                }
            }
            foreach (MARC_Field thisRecord in record[490])
            {
                if (thisRecord.has_Subfield('x'))
                {
                    thisBibInfo.Add_Identifier(thisRecord['x'], "ISSN");
                }
                if (thisRecord.has_Subfield('l'))
                {
                    thisBibInfo.Add_Identifier(thisRecord['l'], "LCCN");
                }
            }

            // Load all the MARC Content Sources (040)
            if (record.has_Field(40))
            {
                if (record.Get_Data_Subfield(40, 'a').Length > 0)
                {
                    thisBibInfo.Record.Add_MARC_Record_Content_Sources(record.Get_Data_Subfield(40, 'a'));
                }
                if (record.Get_Data_Subfield(40, 'b').Length > 0)
                {
                    thisBibInfo.Record.Add_MARC_Record_Content_Sources(record.Get_Data_Subfield(40, 'b'));
                }
                if (record.Get_Data_Subfield(40, 'c').Length > 0)
                {
                    thisBibInfo.Record.Add_MARC_Record_Content_Sources(record.Get_Data_Subfield(40, 'c'));
                }
                string modifying = record.Get_Data_Subfield(40, 'd');
                if (modifying.Length > 0)
                {
                    string[] modSplitter = modifying.Split("|".ToCharArray());
                    foreach (string split in modSplitter)
                    {
                        thisBibInfo.Record.Add_MARC_Record_Content_Sources(split.Trim());
                    }
                }
                if (record.Get_Data_Subfield(40, 'e').Length > 0)
                {
                    thisBibInfo.Record.Description_Standard = record.Get_Data_Subfield(40, 'e');
                }
            }

            // Add the spatial information ( 752, 662 )
            Add_Hierarchical_Subject(thisBibInfo, record, 752);
            Add_Hierarchical_Subject(thisBibInfo, record, 662);

            // Add all the subjects ( 600... 658, excluding 655 )
            Add_Personal_Name(thisBibInfo, record, 600, 4);
            Add_Corporate_Name(thisBibInfo, record, 610, 4);
            Add_Conference_Name(thisBibInfo, record, 611, 4);
            Add_Main_Title(thisBibInfo, record, 630, Title_Type_Enum.UNSPECIFIED, 1, 4);

            // Add all additional subjects
            // Letters indicate which fields are: TOPICAL, GEOGRAPHIC, TEMPORAL, GENRE, OCCUPATION
            Add_Subject(thisBibInfo, record, 648, "x", "z", "ay", "v", "");
            Add_Subject(thisBibInfo, record, 650, "ax", "z", "y", "v", "");
            Add_Subject(thisBibInfo, record, 651, "x", "az", "y", "v", "");
            Add_Subject(thisBibInfo, record, 653, "a", "", "", "", "");
            Add_Subject(thisBibInfo, record, 654, "av", "y", "z", "", "");
            Add_Subject(thisBibInfo, record, 655, "x", "z", "y", "av", "");
            Add_Subject(thisBibInfo, record, 656, "x", "z", "y", "v", "a");
            Add_Subject(thisBibInfo, record, 657, "ax", "z", "y", "v", "");
            Add_Subject(thisBibInfo, record, 690, "ax", "z", "y", "v", "");
            Add_Subject(thisBibInfo, record, 691, "x", "az", "y", "v", "");

            // Add the genres (655 -- again)
            foreach (MARC_Field thisRecord in record[655])
            {
                if (thisRecord.has_Subfield('a'))
                {
                    if (thisRecord.has_Subfield('2'))
                        thisBibInfo.Add_Genre(thisRecord['a'], thisRecord['2']);
                    else
                        thisBibInfo.Add_Genre(thisRecord['a']);
                }
            }

            // Add the abbreviated title (210)
            foreach (MARC_Field thisRecord in record[210])
            {
                if (thisRecord.has_Subfield('a'))
                {
                    Title_Info abbrTitle = new Title_Info(thisRecord['a'], Title_Type_Enum.Abbreviated);
                    if (thisRecord.has_Subfield('b'))
                        abbrTitle.Subtitle = thisRecord['b'];
                    thisBibInfo.Add_Other_Title(abbrTitle);
                }
            }

            // Add the title ( 245 |a, |b )
            Add_Main_Title(thisBibInfo, record, 245, Title_Type_Enum.UNSPECIFIED, 2, 1);

            // Add the translated titles ( 242 )
            Add_Main_Title(thisBibInfo, record, 242, Title_Type_Enum.Translated, 2, 2);

            // Add the alternative titles ( 246, 740 )
            Add_Main_Title(thisBibInfo, record, 246, Title_Type_Enum.Alternative, 0, 2);
            Add_Main_Title(thisBibInfo, record, 740, Title_Type_Enum.Alternative, 1, 2);

            // Add the uniform titles (130, 240, 730 )
            Add_Main_Title(thisBibInfo, record, 130, Title_Type_Enum.Uniform, 1, 2);
            Add_Main_Title(thisBibInfo, record, 240, Title_Type_Enum.Uniform, 2, 2);
            Add_Main_Title(thisBibInfo, record, 730, Title_Type_Enum.Uniform, 1, 2);

            // Add the series titles ( 440, 490 )
            Add_Main_Title(thisBibInfo, record, 440, Title_Type_Enum.UNSPECIFIED, 2, 3);
            Add_Main_Title(thisBibInfo, record, 490, Title_Type_Enum.UNSPECIFIED, 0, 3);

            // Add the creators and contributors ( 100, 110 , 111, 700, 710, 711, 720, 796, 797 )
            Add_Personal_Name(thisBibInfo, record, 100, 1);
            Add_Personal_Name(thisBibInfo, record, 700, 2);
            Add_Personal_Name(thisBibInfo, record, 796, 3);
            Add_Corporate_Name(thisBibInfo, record, 110, 1);
            Add_Corporate_Name(thisBibInfo, record, 710, 2);
            Add_Corporate_Name(thisBibInfo, record, 797, 3);
            Add_Conference_Name(thisBibInfo, record, 111, 1);
            Add_Conference_Name(thisBibInfo, record, 711, 2);

            // Add the Other Edition Value (775)
            foreach (MARC_Field thisRecord in record[775])
            {
                Related_Item_Info otherEditionItem = new Related_Item_Info();
                otherEditionItem.Relationship = Related_Item_Type_Enum.OtherVersion;
                if (thisRecord.has_Subfield('t'))
                    otherEditionItem.Main_Title.Title = thisRecord['t'];
                if (thisRecord.has_Subfield('x'))
                    otherEditionItem.Add_Identifier(thisRecord['x'], "issn");
                if (thisRecord.has_Subfield('z'))
                    otherEditionItem.Add_Identifier(thisRecord['z'], "isbn");
                if (thisRecord.has_Subfield('w'))
                {
                    string[] splitter = thisRecord['w'].Split("|".ToCharArray());
                    foreach (string thisSplitter in splitter)
                    {
                        if (thisSplitter.IndexOf("(DLC)sn") >= 0)
                        {
                            otherEditionItem.Add_Identifier(thisSplitter.Replace("(DLC)sn", "").Trim(), "lccn");
                        }
                        if (thisSplitter.IndexOf("(OCoLC)") >= 0)
                        {
                            otherEditionItem.Add_Identifier(thisSplitter.Replace("(OCoLC)", "").Trim(), "oclc");
                        }
                    }
                }
                thisBibInfo.Add_Related_Item(otherEditionItem);
            }

            // Add the Preceding Entry (780)
            foreach (MARC_Field thisRecord in record[780])
            {
                Related_Item_Info precedingItem = new Related_Item_Info();
                precedingItem.Relationship = Related_Item_Type_Enum.Preceding;
                if (thisRecord.has_Subfield('t'))
                    precedingItem.Main_Title.Title = thisRecord['t'];
                if (thisRecord.has_Subfield('x'))
                    precedingItem.Add_Identifier(thisRecord['x'], "issn");
                if (thisRecord.has_Subfield('z'))
                    precedingItem.Add_Identifier(thisRecord['z'], "isbn");
                if (thisRecord.has_Subfield('w'))
                {
                    string[] splitter = thisRecord['w'].Split("|".ToCharArray());
                    foreach (string thisSplitter in splitter)
                    {
                        if ((thisSplitter.IndexOf("(DLC)sn") >= 0) || (thisSplitter.IndexOf("(OCoLC)") >= 0))
                        {
                            if (thisSplitter.IndexOf("(DLC)sn") >= 0)
                            {
                                precedingItem.Add_Identifier(thisSplitter.Replace("(DLC)sn", "").Trim(), "lccn");
                            }
                            if (thisSplitter.IndexOf("(OCoLC)") >= 0)
                            {
                                precedingItem.Add_Identifier(thisSplitter.Replace("(OCoLC)", "").Trim(), "oclc");
                            }
                        }
                        else
                        {
                            precedingItem.Add_Identifier(thisSplitter.Trim(), String.Empty);
                        }
                    }
                    if (thisRecord.has_Subfield('o'))
                    {
                        if (thisRecord['o'].IndexOf("(SobekCM)") >= 0)
                            precedingItem.SobekCM_ID = thisRecord['o'].Replace("(SobekCM)", "").Trim();
                    }
                }
                thisBibInfo.Add_Related_Item(precedingItem);
            }

            // Add the Suceeding Entry (785)
            foreach (MARC_Field thisRecord in record[785])
            {
                Related_Item_Info succeedingItem = new Related_Item_Info();
                succeedingItem.Relationship = Related_Item_Type_Enum.Succeeding;
                if (thisRecord.has_Subfield('t'))
                    succeedingItem.Main_Title.Title = thisRecord['t'];
                if (thisRecord.has_Subfield('x'))
                    succeedingItem.Add_Identifier(thisRecord['x'], "issn");
                if (thisRecord.has_Subfield('z'))
                    succeedingItem.Add_Identifier(thisRecord['z'], "isbn");
                if (thisRecord.has_Subfield('w'))
                {
                    string[] splitter = thisRecord['w'].Split("|".ToCharArray());
                    foreach (string thisSplitter in splitter)
                    {
                        if ((thisSplitter.IndexOf("(DLC)sn") >= 0) || (thisSplitter.IndexOf("(OCoLC)") >= 0))
                        {
                            if (thisSplitter.IndexOf("(DLC)sn") >= 0)
                            {
                                succeedingItem.Add_Identifier(thisSplitter.Replace("(DLC)sn", "").Trim(), "lccn");
                            }
                            if (thisSplitter.IndexOf("(OCoLC)") >= 0)
                            {
                                succeedingItem.Add_Identifier(thisSplitter.Replace("(OCoLC)", "").Trim(), "oclc");
                            }
                        }
                        else
                        {
                            succeedingItem.Add_Identifier(thisSplitter.Trim(), String.Empty);
                        }
                    }
                }
                if (thisRecord.has_Subfield('o'))
                {
                    if (thisRecord['o'].IndexOf("(SobekCM)") >= 0)
                        succeedingItem.SobekCM_ID = thisRecord['o'].Replace("(SobekCM)", "").Trim();
                }
                thisBibInfo.Add_Related_Item(succeedingItem);
            }

            // Add the Other Relationship Entry (787)
            foreach (MARC_Field thisRecord in record[787])
            {
                Related_Item_Info otherRelationItem = new Related_Item_Info();
                otherRelationItem.Relationship = Related_Item_Type_Enum.UNKNOWN;
                if (thisRecord.has_Subfield('t'))
                    otherRelationItem.Main_Title.Title = thisRecord['t'];
                if (thisRecord.has_Subfield('x'))
                    otherRelationItem.Add_Identifier(thisRecord['x'], "issn");
                if (thisRecord.has_Subfield('z'))
                    otherRelationItem.Add_Identifier(thisRecord['z'], "isbn");
                if (thisRecord.has_Subfield('w'))
                {
                    string[] splitter = thisRecord['w'].Split("|".ToCharArray());
                    foreach (string thisSplitter in splitter)
                    {
                        if ((thisSplitter.IndexOf("(DLC)sn") >= 0) || (thisSplitter.IndexOf("(OCoLC)") >= 0))
                        {
                            if (thisSplitter.IndexOf("(DLC)sn") >= 0)
                            {
                                otherRelationItem.Add_Identifier(thisSplitter.Replace("(DLC)sn", "").Trim(), "lccn");
                            }
                            if (thisSplitter.IndexOf("(OCoLC)") >= 0)
                            {
                                otherRelationItem.Add_Identifier(thisSplitter.Replace("(OCoLC)", "").Trim(), "oclc");
                            }
                        }
                        else
                        {
                            otherRelationItem.Add_Identifier(thisSplitter.Trim(), String.Empty);
                        }
                    }
                }
                if (thisRecord.has_Subfield('o'))
                {
                    if (thisRecord['o'].IndexOf("(SobekCM)") >= 0)
                        otherRelationItem.SobekCM_ID = thisRecord['o'].Replace("(SobekCM)", "").Trim();
                }
                thisBibInfo.Add_Related_Item(otherRelationItem);
            }

            // Get the type of resource ( Leader/006, Leader/007, Serial 008/021 )
            string marc_type = String.Empty;
            switch (record.Leader[6])
            {
                case 'a':
                case 't':
                    thisBibInfo.SobekCM_Type = TypeOfResource_SobekCM_Enum.Book;
                    marc_type = "BKS";
                    break;

                case 'e':
                case 'f':
                    thisBibInfo.SobekCM_Type = TypeOfResource_SobekCM_Enum.Map;
                    marc_type = "MAP";
                    break;

                case 'c':
                case 'd':
                    thisBibInfo.SobekCM_Type = TypeOfResource_SobekCM_Enum.Book;
                    marc_type = "BKS";
                    break;

                case 'i':
                case 'j':
                    thisBibInfo.SobekCM_Type = TypeOfResource_SobekCM_Enum.Audio;
                    marc_type = "REC";
                    break;

                case 'k':
                    thisBibInfo.SobekCM_Type = TypeOfResource_SobekCM_Enum.Photograph;
                    marc_type = "VIS";
                    break;

                case 'g':
                    thisBibInfo.SobekCM_Type = TypeOfResource_SobekCM_Enum.Video;
                    marc_type = "VIS";
                    break;

                case 'r':
                    thisBibInfo.SobekCM_Type = TypeOfResource_SobekCM_Enum.Artifact;
                    marc_type = "VIS";
                    break;

                case 'm':
                    thisBibInfo.SobekCM_Type = TypeOfResource_SobekCM_Enum.Archival;
                    marc_type = "COM";
                    break;

                case 'p':
                    thisBibInfo.SobekCM_Type = TypeOfResource_SobekCM_Enum.Archival;
                    marc_type = "MIX";
                    break;

                case 'o':
                    marc_type = "VIS";
                    thisBibInfo.SobekCM_Type = TypeOfResource_SobekCM_Enum.Archival;
                    break;
            }
            if (record.Leader[7] == 'c')
                thisBibInfo.Type.Collection = true;
            if (record.Leader[7] == 's')
            {
                thisBibInfo.SobekCM_Type = TypeOfResource_SobekCM_Enum.Serial;

                if (field_008.Length > 22)
                {
                    if (field_008[21] == 'n')
                        thisBibInfo.SobekCM_Type = TypeOfResource_SobekCM_Enum.Newspaper;
                }
                marc_type = "CNR";
            }
            thisBibInfo.EncodingLevel = record.Leader[17].ToString().Replace("^", "#").Replace(" ", "#");

            if (field_008.Length > 35)
            {
                if ((marc_type == "BKS") || (marc_type == "CNR") || (marc_type == "MAP") || (marc_type == "COM") || (marc_type == "VIS"))
                {
                    switch (field_008[28])
                    {
                        case 'c':
                            thisBibInfo.Add_Genre("multilocal government publication", "marcgt");
                            break;

                        case 'f':
                            thisBibInfo.Add_Genre("federal government publication", "marcgt");
                            break;

                        case 'i':
                            thisBibInfo.Add_Genre("international intergovernmental publication", "marcgt");
                            break;

                        case 'l':
                            thisBibInfo.Add_Genre("local government publication", "marcgt");
                            break;

                        case 'm':
                            thisBibInfo.Add_Genre("multistate government publication", "marcgt");
                            break;

                        case 'o':
                            thisBibInfo.Add_Genre("government publication", "marcgt");
                            break;

                        case 's':
                            thisBibInfo.Add_Genre("government publication (state, provincial, terriorial, dependent)", "marcgt");
                            break;

                        case 'a':
                            thisBibInfo.Add_Genre("government publication (autonomous or semiautonomous component)", "marcgt");
                            break;
                    }
                }

                if ((marc_type == "BKS") || (marc_type == "CNR"))
                {
                    string nature_of_contents = field_008.Substring(24, 4);
                    if (nature_of_contents.IndexOf("a") >= 0)
                        thisBibInfo.Add_Genre("abstract or summary", "marcgt");
                    if (nature_of_contents.IndexOf("b") >= 0)
                        thisBibInfo.Add_Genre("bibliography", "marcgt");
                    if (nature_of_contents.IndexOf("c") >= 0)
                        thisBibInfo.Add_Genre("catalog", "marcgt");
                    if (nature_of_contents.IndexOf("d") >= 0)
                        thisBibInfo.Add_Genre("dictionary", "marcgt");
                    if (nature_of_contents.IndexOf("r") >= 0)
                        thisBibInfo.Add_Genre("directory", "marcgt");
                    if (nature_of_contents.IndexOf("k") >= 0)
                        thisBibInfo.Add_Genre("discography", "marcgt");
                    if (nature_of_contents.IndexOf("e") >= 0)
                        thisBibInfo.Add_Genre("encyclopedia", "marcgt");
                    if (nature_of_contents.IndexOf("q") >= 0)
                        thisBibInfo.Add_Genre("filmography", "marcgt");
                    if (nature_of_contents.IndexOf("f") >= 0)
                        thisBibInfo.Add_Genre("handbook", "marcgt");
                    if (nature_of_contents.IndexOf("i") >= 0)
                        thisBibInfo.Add_Genre("index", "marcgt");
                    if (nature_of_contents.IndexOf("w") >= 0)
                        thisBibInfo.Add_Genre("law report or digest", "marcgt");
                    if (nature_of_contents.IndexOf("g") >= 0)
                        thisBibInfo.Add_Genre("legal article", "marcgt");
                    if (nature_of_contents.IndexOf("v") >= 0)
                        thisBibInfo.Add_Genre("legal case and case notes", "marcgt");
                    if (nature_of_contents.IndexOf("l") >= 0)
                        thisBibInfo.Add_Genre("legislation", "marcgt");
                    if (nature_of_contents.IndexOf("j") >= 0)
                        thisBibInfo.Add_Genre("patent", "marcgt");
                    if (nature_of_contents.IndexOf("p") >= 0)
                        thisBibInfo.Add_Genre("programmed text", "marcgt");
                    if (nature_of_contents.IndexOf("o") >= 0)
                        thisBibInfo.Add_Genre("review", "marcgt");
                    if (nature_of_contents.IndexOf("s") >= 0)
                        thisBibInfo.Add_Genre("statistics", "marcgt");
                    if (nature_of_contents.IndexOf("n") >= 0)
                        thisBibInfo.Add_Genre("survey of literature", "marcgt");
                    if (nature_of_contents.IndexOf("t") >= 0)
                        thisBibInfo.Add_Genre("technical report", "marcgt");
                    if (nature_of_contents.IndexOf("m") >= 0)
                        thisBibInfo.Add_Genre("theses", "marcgt");
                    if (nature_of_contents.IndexOf("z") >= 0)
                        thisBibInfo.Add_Genre("treaty", "marcgt");
                    if (nature_of_contents.IndexOf("2") >= 0)
                        thisBibInfo.Add_Genre("offprint", "marcgt");
                    if (nature_of_contents.IndexOf("y") >= 0)
                        thisBibInfo.Add_Genre("yearbook", "marcgt");
                    if (nature_of_contents.IndexOf("5") >= 0)
                        thisBibInfo.Add_Genre("calendar", "marcgt");
                    if (nature_of_contents.IndexOf("6") >= 0)
                        thisBibInfo.Add_Genre("comic/graphic novel", "marcgt");

                    if (field_008[29] == '1')
                        thisBibInfo.Add_Genre("conference publication", "marcgt");
                }

                if (marc_type == "CNR")
                {
                    if (field_008[21] == 'd')
                        thisBibInfo.Add_Genre("database", "marcgt");
                    if (field_008[21] == 'l')
                        thisBibInfo.Add_Genre("loose-leaf", "marcgt");
                    if (field_008[21] == 'n')
                        thisBibInfo.Add_Genre("newspaper", "marcgt");
                    if (field_008[21] == 'p')
                        thisBibInfo.Add_Genre("periodical", "marcgt");
                    if (field_008[21] == 's')
                        thisBibInfo.Add_Genre("series", "marcgt");
                    if (field_008[21] == 'w')
                        thisBibInfo.Add_Genre("web site", "marcgt");

                    // Get the frequency
                    switch (field_008[18])
                    {
                        case 'a':
                            thisBibInfo.Origin_Info.Add_Frequency("annual", "marcfrequency");
                            break;

                        case 'b':
                            thisBibInfo.Origin_Info.Add_Frequency("bimonthly", "marcfrequency");
                            break;

                        case 'c':
                            thisBibInfo.Origin_Info.Add_Frequency("semiweekly", "marcfrequency");
                            break;

                        case 'd':
                            thisBibInfo.Origin_Info.Add_Frequency("daily", "marcfrequency");
                            break;

                        case 'e':
                            thisBibInfo.Origin_Info.Add_Frequency("biweekly", "marcfrequency");
                            break;

                        case 'f':
                            thisBibInfo.Origin_Info.Add_Frequency("semiannual", "marcfrequency");
                            break;

                        case 'g':
                            thisBibInfo.Origin_Info.Add_Frequency("biennial", "marcfrequency");
                            break;

                        case 'h':
                            thisBibInfo.Origin_Info.Add_Frequency("triennial", "marcfrequency");
                            break;

                        case 'i':
                            thisBibInfo.Origin_Info.Add_Frequency("three times a week", "marcfrequency");
                            break;

                        case 'j':
                            thisBibInfo.Origin_Info.Add_Frequency("three times a month", "marcfrequency");
                            break;

                        case 'k':
                            thisBibInfo.Origin_Info.Add_Frequency("continuously updated", "marcfrequency");
                            break;

                        case 'm':
                            thisBibInfo.Origin_Info.Add_Frequency("monthly", "marcfrequency");
                            break;

                        case 'q':
                            thisBibInfo.Origin_Info.Add_Frequency("quarterly", "marcfrequency");
                            break;

                        case 's':
                            thisBibInfo.Origin_Info.Add_Frequency("semimonthly", "marcfrequency");
                            break;

                        case 't':
                            thisBibInfo.Origin_Info.Add_Frequency("three times a year", "marcfrequency");
                            break;

                        case 'w':
                            thisBibInfo.Origin_Info.Add_Frequency("weekly", "marcfrequency");
                            break;

                        case 'z':
                            thisBibInfo.Origin_Info.Add_Frequency("other", "marcfrequency");
                            break;
                    }

                    // Get the regularity
                    switch (field_008[19])
                    {
                        case 'n':
                            thisBibInfo.Origin_Info.Add_Frequency("normalized irregular", "marcfrequency");
                            break;

                        case 'r':
                            thisBibInfo.Origin_Info.Add_Frequency("regular", "marcfrequency");
                            break;

                        case 'x':
                            thisBibInfo.Origin_Info.Add_Frequency("completely irregular", "marcfrequency");
                            break;
                    }
                }

                if (marc_type == "MAP")
                {
                    // Get the form of item
                    if (field_008[25] == 'e')
                        thisBibInfo.Add_Genre("atlas", "marcgt");
                    if (field_008[25] == 'd')
                        thisBibInfo.Add_Genre("globe", "marcgt");
                    if (field_008[25] == 'a')
                        thisBibInfo.Add_Genre("single map", "marcgt");
                    if (field_008[25] == 'b')
                        thisBibInfo.Add_Genre("map series", "marcgt");
                    if (field_008[25] == 'c')
                        thisBibInfo.Add_Genre("map serial", "marcgt");

                    // Get the projection, if there is one
                    if ((field_008.Substring(22, 2) != "  ") && (field_008.Substring(22, 2) != "||") && (field_008.Substring(22, 2) != "^^") && (field_008.Substring(22, 2) != "||"))
                    {
                        Subject_Info_Cartographics cartographicsSubject = new Subject_Info_Cartographics();
                        cartographicsSubject.ID = "SUBJ008";
                        cartographicsSubject.Projection = field_008.Substring(22, 2);
                        thisBibInfo.Add_Subject(cartographicsSubject);
                    }

                    // Get whether this is indexed
                    if (field_008[31] == '1')
                    {
                        thisBibInfo.Add_Genre("indexed", "marcgt");
                    }
                }

                if (marc_type == "REC")
                {
                    string nature_of_recording = field_008.Substring(30, 2);
                    if (nature_of_recording.IndexOf("a") >= 0)
                        thisBibInfo.Add_Genre("autobiography", "marcgt");
                    if (nature_of_recording.IndexOf("b") >= 0)
                        thisBibInfo.Add_Genre("biography", "marcgt");
                    if (nature_of_recording.IndexOf("c") >= 0)
                        thisBibInfo.Add_Genre("conference publication", "marcgt");
                    if (nature_of_recording.IndexOf("d") >= 0)
                        thisBibInfo.Add_Genre("drama", "marcgt");
                    if (nature_of_recording.IndexOf("e") >= 0)
                        thisBibInfo.Add_Genre("essay", "marcgt");
                    if (nature_of_recording.IndexOf("f") >= 0)
                        thisBibInfo.Add_Genre("fiction", "marcgt");
                    if (nature_of_recording.IndexOf("o") >= 0)
                        thisBibInfo.Add_Genre("folktale", "marcgt");
                    if (nature_of_recording.IndexOf("k") >= 0)
                        thisBibInfo.Add_Genre("humor, satire", "marcgt");
                    if (nature_of_recording.IndexOf("i") >= 0)
                        thisBibInfo.Add_Genre("instruction", "marcgt");
                    if (nature_of_recording.IndexOf("t") >= 0)
                        thisBibInfo.Add_Genre("interview", "marcgt");
                    if (nature_of_recording.IndexOf("j") >= 0)
                        thisBibInfo.Add_Genre("language instruction", "marcgt");
                    if (nature_of_recording.IndexOf("m") >= 0)
                        thisBibInfo.Add_Genre("memoir", "marcgt");
                    if (nature_of_recording.IndexOf("p") >= 0)
                        thisBibInfo.Add_Genre("poetry", "marcgt");
                    if (nature_of_recording.IndexOf("r") >= 0)
                        thisBibInfo.Add_Genre("rehearsal", "marcgt");
                    if (nature_of_recording.IndexOf("g") >= 0)
                        thisBibInfo.Add_Genre("reporting", "marcgt");
                    if (nature_of_recording.IndexOf("s") >= 0)
                        thisBibInfo.Add_Genre("sound", "marcgt");
                    if (nature_of_recording.IndexOf("l") >= 0)
                        thisBibInfo.Add_Genre("speech", "marcgt");
                }

                if (marc_type == "COM")
                {
                    switch (field_008[26])
                    {
                        case 'e':
                            thisBibInfo.Add_Genre("database", "marcgt");
                            break;

                        case 'f':
                            thisBibInfo.Add_Genre("font", "marcgt");
                            break;

                        case 'g':
                            thisBibInfo.Add_Genre("game", "marcgt");
                            break;

                        case 'a':
                            thisBibInfo.Add_Genre("numeric data", "marcgt");
                            break;

                        case 'h':
                            thisBibInfo.Add_Genre("sound", "marcgt");
                            break;
                    }
                }

                if (marc_type == "VIS")
                {
                    switch (field_008[33])
                    {
                        case 'a':
                            thisBibInfo.Add_Genre("art original", "marcgt");
                            break;

                        case 'c':
                            thisBibInfo.Add_Genre("art reproduction", "marcgt");
                            break;

                        case 'n':
                            thisBibInfo.Add_Genre("chart", "marcgt");
                            break;

                        case 'd':
                            thisBibInfo.Add_Genre("diorama", "marcgt");
                            break;

                        case 'f':
                            thisBibInfo.Add_Genre("filmstrip", "marcgt");
                            break;

                        case 'o':
                            thisBibInfo.Add_Genre("flash card", "marcgt");
                            break;

                        case 'k':
                            thisBibInfo.Add_Genre("graphic", "marcgt");
                            break;

                        case 'b':
                            thisBibInfo.Add_Genre("kit", "marcgt");
                            break;

                        case 'p':
                            thisBibInfo.Add_Genre("microscope slide", "marcgt");
                            break;

                        case 'q':
                            thisBibInfo.Add_Genre("model", "marcgt");
                            break;

                        case 'm':
                            thisBibInfo.Add_Genre("motion picture", "marcgt");
                            break;

                        case 'i':
                            thisBibInfo.Add_Genre("picture", "marcgt");
                            break;

                        case 'r':
                            thisBibInfo.Add_Genre("realia", "marcgt");
                            break;

                        case 's':
                            thisBibInfo.Add_Genre("slide", "marcgt");
                            break;

                        case 'l':
                            thisBibInfo.Add_Genre("technical drawing", "marcgt");
                            break;

                        case 'w':
                            thisBibInfo.Add_Genre("toy", "marcgt");
                            break;

                        case 't':
                            thisBibInfo.Add_Genre("transparency", "marcgt");
                            break;

                        case 'v':
                            thisBibInfo.Add_Genre("video recording", "marcgt");
                            break;
                    }
                }

                if (marc_type == "BKS")
                {
                    switch (field_008[34])
                    {
                        case 'a':
                            thisBibInfo.Add_Genre("autobiography", "marcgt");
                            break;

                        case 'b':
                            thisBibInfo.Add_Genre("individual biography", "marcgt");
                            break;

                        case 'c':
                            thisBibInfo.Add_Genre("collective biography", "marcgt");
                            break;
                    }

                    switch (field_008[33])
                    {
                        case 'a':
                            thisBibInfo.Add_Genre("comic strip", "marcgt");
                            break;

                        case 'd':
                            thisBibInfo.Add_Genre("drama", "marcgt");
                            break;

                        case 'e':
                            thisBibInfo.Add_Genre("essay", "marcgt");
                            break;

                        case 'h':
                            thisBibInfo.Add_Genre("humor, satire", "marcgt");
                            break;

                        case 'i':
                            thisBibInfo.Add_Genre("letter", "marcgt");
                            break;

                        case 'p':
                            thisBibInfo.Add_Genre("poetry", "marcgt");
                            break;

                        case 'f':
                            thisBibInfo.Add_Genre("novel", "marcgt");
                            break;

                        case 'j':
                            thisBibInfo.Add_Genre("short story", "marcgt");
                            break;

                        case 's':
                            thisBibInfo.Add_Genre("speech", "marcgt");
                            break;

                        case '0':
                            thisBibInfo.Add_Genre("non-fiction", "marcgt");
                            break;

                        case '1':
                            thisBibInfo.Add_Genre("fiction", "marcgt");
                            break;
                    }

                    if ((field_008[30] == 'h') || (field_008[31] == 'h'))
                    {
                        thisBibInfo.Add_Genre("history", "marcgt");
                    }

                    if (field_008[30] == '1')
                    {
                        thisBibInfo.Add_Genre("festschrift", "marcgt");
                    }
                }
            }

            // Look for target audience (521)
            foreach (MARC_Field thisRecord in record[521])
            {
                if (thisRecord.has_Subfield('a'))
                {
                    if (thisRecord.has_Subfield('b'))
                    {
                        thisBibInfo.Add_Target_Audience(thisRecord['a'].Replace("[", "(").Replace("]", ")") + " [ " + thisRecord['b'].Replace("[", "(").Replace("]", ")") + " ]");
                    }
                    else
                    {
                        thisBibInfo.Add_Target_Audience(thisRecord['a'].Replace("[", "(").Replace("]", ")"));
                    }
                }
            }

            // Look for target audince (008/22)
            if ((marc_type == "BKS") || (marc_type == "COM") || (marc_type == "REC") || (marc_type == "SCO") || (marc_type == "VIS"))
            {
                if (field_008.Length > 22)
                {
                    switch (field_008[22])
                    {
                        case 'd':
                            thisBibInfo.Add_Target_Audience("adolescent", "marctarget");
                            break;

                        case 'e':
                            thisBibInfo.Add_Target_Audience("adult", "marctarget");
                            break;

                        case 'g':
                            thisBibInfo.Add_Target_Audience("general", "marctarget");
                            break;

                        case 'b':
                            thisBibInfo.Add_Target_Audience("primary", "marctarget");
                            break;

                        case 'c':
                            thisBibInfo.Add_Target_Audience("pre-adolescent", "marctarget");
                            break;

                        case 'j':
                            thisBibInfo.Add_Target_Audience("juvenile", "marctarget");
                            break;

                        case 'a':
                            thisBibInfo.Add_Target_Audience("preschool", "marctarget");
                            break;

                        case 'f':
                            thisBibInfo.Add_Target_Audience("specialized", "marctarget");
                            break;
                    }
                }
            }

            // Get any project codes ( 852 )
            if ((package != null) && (package.Behaviors.Aggregation_Count == 0))
            {
                foreach (MARC_Field thisRecord in record[852])
                {
                    if ((thisRecord.Indicators.Trim().Length == 0) && (thisRecord.has_Subfield('b')))
                    {
                        string allCodes = thisRecord['b'];
                        string[] splitAllCodes = allCodes.Split("|;".ToCharArray());
                        foreach (string splitCode in splitAllCodes)
                        {
                            package.Behaviors.Add_Aggregation(splitCode.Trim());
                        }
                    }
                }
            }
        }
        /// <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;
        }
        /// <summary> Flag indicates if this active reader/writer needs to append schema reference information
        /// to the METS XML header by analyzing the contents of the digital resource item </summary>
        /// <param name="METS_Item"> Package with all the metadata to save</param>
        /// <returns> TRUE if the schema should be attached, otherwise fALSE </returns>
        public bool Schema_Reference_Required_Package(SobekCM_Item METS_Item)
        {
            Thesis_Dissertation_Info thesisInfo = METS_Item.Get_Metadata_Module(GlobalVar.THESIS_METADATA_MODULE_KEY) as Thesis_Dissertation_Info;
            if (thesisInfo == null)
                return false;

            return thesisInfo.hasData;
        }
        /// <summary> Reads metadata from an open stream and saves to the provided item/package </summary>
        /// <param name="Input_Stream"> Open stream to read metadata from </param>
        /// <param name="Return_Package"> Package into which to read the metadata </param>
        /// <param name="Options"> Dictionary of any options which this metadata reader/writer may utilize </param>
        /// <param name="Error_Message">[OUTPUT] Explanation of the error, if an error occurs during reading </param>
        /// <returns>TRUE if successful, otherwise FALSE </returns>
        /// <remarks>This reader accepts two option values.  'EAD_File_ReaderWriter:XSL_Location' gives the location of a XSL
        /// file, which can be used to transform the description XML read from this EAD into HTML (or another format of XML).  
        /// 'EAD_File_ReaderWriter:Analyze_Description' indicates whether to analyze the description section of the EAD and
        /// read it into the item. (Default is TRUE).</remarks>
        public bool Read_Metadata(Stream Input_Stream, SobekCM_Item Return_Package, Dictionary<string, object> Options, out string Error_Message)
        {
            // Ensure this metadata module extension exists
            EAD_Info eadInfo = Return_Package.Get_Metadata_Module(GlobalVar.EAD_METADATA_MODULE_KEY) as EAD_Info;
            if (eadInfo == null)
            {
                eadInfo = new EAD_Info();
                Return_Package.Add_Metadata_Module(GlobalVar.EAD_METADATA_MODULE_KEY, eadInfo);
            }

            // Set a couple defaults first
            Return_Package.Bib_Info.SobekCM_Type = TypeOfResource_SobekCM_Enum.Archival;
            Return_Package.Bib_Info.Type.Collection = true;
            Error_Message = String.Empty;

            // Check for some options
            string XSL_Location = String.Empty;
            bool Analyze_Description = true;
            if (Options != null)
            {
                if (Options.ContainsKey("EAD_File_ReaderWriter:XSL_Location"))
                {
                    XSL_Location = Options["EAD_File_ReaderWriter:XSL_Location"].ToString();
                }
                if (Options.ContainsKey("EAD_File_ReaderWriter:Analyze_Description"))
                {
                    bool.TryParse(Options["EAD_File_ReaderWriter:Analyze_Description"].ToString(), out Analyze_Description);
                }
            }

            // Use a string builder to seperate the description and container sections
            StringBuilder description_builder = new StringBuilder(20000);
            StringBuilder container_builder = new StringBuilder(20000);

            // Read through with a simple stream reader first
            StreamReader reader = new StreamReader(Input_Stream);
            string line = reader.ReadLine();
            bool in_container_list = false;

            // Step through each line
            while (line != null)
            {
                if (!in_container_list)
                {
                    // Do not import the XML stylesheet portion
                    if ((line.IndexOf("xml-stylesheet") < 0) && (line.IndexOf("<!DOCTYPE ") < 0))
                    {
                        // Does the start a DSC section?
                        if ((line.IndexOf("<dsc ") >= 0) || (line.IndexOf("<dsc>") > 0))
                        {
                            in_container_list = true;
                            container_builder.AppendLine(line);
                        }
                        else
                        {
                            description_builder.AppendLine(line);
                        }
                    }
                }
                else
                {
                    // Add this to the container builder
                    container_builder.AppendLine(line);

                    // Does this end the container list section?
                    if (line.IndexOf("</dsc>") >= 0)
                        in_container_list = false;
                }

                // Get the next line
                line = reader.ReadLine();
            }

            // Close the reader
            reader.Close();

            // Just assign all the description section first
            eadInfo.Full_Description = description_builder.ToString();

            // Should the decrpition additionally be analyzed?
            if (Analyze_Description)
            {
                // Try to read the XML
                try
                {
                    XmlTextReader reader2 = new XmlTextReader(description_builder.ToString());

                    // Initial doctype declaration sometimes throws an error for a missing EAD.dtd.
                    bool ead_start_found = false;
                    int error = 0;
                    while ((!ead_start_found) && (error < 5))
                    {
                        try
                        {
                            reader2.Read();
                            if ((reader2.NodeType == XmlNodeType.Element) && (reader2.Name.ToLower() == GlobalVar.EAD_METADATA_MODULE_KEY))
                            {
                                ead_start_found = true;
                            }
                        }
                        catch
                        {
                            error++;
                        }
                    }

                    // Now read the body of the EAD
                    while (reader2.Read())
                    {
                        if (reader2.NodeType == XmlNodeType.Element)
                        {
                            string nodeName = reader2.Name.ToLower();
                            switch (nodeName)
                            {
                                case "descrules":
                                    string descrules_text = reader2.ReadInnerXml().ToUpper();
                                    if (descrules_text.IndexOf("FINDING AID PREPARED USING ") == 0)
                                    {
                                        Return_Package.Bib_Info.Record.Description_Standard = descrules_text.Replace("FINDING AID PREPARED USING ", "");
                                    }
                                    else
                                    {
                                        string[] likely_description_standards = {"DACS", "APPM", "AACR2", "RDA", "ISADG", "ISAD", "MAD", "RAD"};
                                        foreach (string likely_standard in likely_description_standards)
                                        {
                                            if (descrules_text.IndexOf(likely_standard) >= 0)
                                            {
                                                Return_Package.Bib_Info.Record.Description_Standard = likely_standard;
                                                break;
                                            }
                                        }
                                    }
                                    break;

                                case "unittitle":
                                    while (reader2.Read())
                                        if (reader2.NodeType == XmlNodeType.Text)
                                        {
                                            Return_Package.Bib_Info.Main_Title.Title = reader2.Value;
                                            break;
                                        }
                                        else if (reader2.NodeType == XmlNodeType.EndElement && reader2.Name.Equals("unittitle"))
                                            break;
                                    while (!(reader2.NodeType == XmlNodeType.EndElement && reader2.Name.Equals("unittitle")))
                                        reader2.Read();
                                    break;

                                case "unitid":
                                    while (reader2.Read())
                                    {
                                        if (reader2.NodeType == XmlNodeType.Text)
                                        {
                                            Return_Package.Bib_Info.Add_Identifier(reader2.Value, "Main Identifier");
                                        }
                                        if (reader2.NodeType == XmlNodeType.EndElement && reader2.Name.ToLower().Equals(nodeName))
                                            break;
                                    }
                                    break;

                                case "origination":
                                    while (reader2.Read())
                                    {
                                        if (reader2.NodeType == XmlNodeType.Element && reader2.Name.Equals("persname"))
                                        {
                                            while (reader2.Read())
                                            {
                                                if (reader2.NodeType == XmlNodeType.Text)
                                                {
                                                    Return_Package.Bib_Info.Main_Entity_Name.Full_Name = Trim_Final_Punctuation(reader2.Value);
                                                    Return_Package.Bib_Info.Main_Entity_Name.Name_Type = Name_Info_Type_Enum.personal;
                                                }
                                                else if (reader2.NodeType == XmlNodeType.EndElement && reader2.Name.ToLower().Equals(nodeName))
                                                    break;
                                            }
                                        }
                                        if (reader2.NodeType == XmlNodeType.EndElement && reader2.Name.ToLower().Equals(nodeName))
                                            break;
                                    }
                                    break;

                                case "physdesc":
                                    while (reader2.Read())
                                    {
                                        if (reader2.NodeType == XmlNodeType.Element && reader2.Name.Equals("extent"))
                                        {
                                            while (reader2.Read())
                                            {
                                                if (reader2.NodeType == XmlNodeType.Text)
                                                    Return_Package.Bib_Info.Original_Description.Extent = reader2.Value;
                                                else if (reader2.NodeType == XmlNodeType.EndElement && reader2.Name.Equals("extent"))
                                                    break;
                                            }
                                        }
                                        if (reader2.NodeType == XmlNodeType.EndElement && reader2.Name.Equals("physdesc"))
                                            break;
                                    }
                                    break;

                                case "abstract":
                                    while (reader2.Read())
                                    {
                                        if (reader2.NodeType == XmlNodeType.Text)
                                            Return_Package.Bib_Info.Add_Abstract(reader2.Value);
                                        else if (reader2.NodeType == XmlNodeType.EndElement && reader2.Name.ToLower().Equals(nodeName))
                                            break;
                                    }
                                    break;

                                case "repository":
                                    while (reader2.Read())
                                    {
                                        if (reader2.NodeType == XmlNodeType.Element && reader2.Name.Equals("corpname"))
                                        {
                                            while (reader2.Read())
                                            {
                                                if (reader2.NodeType == XmlNodeType.Text)
                                                    Return_Package.Bib_Info.Location.Holding_Name = reader2.Value;
                                                else if (reader2.NodeType == XmlNodeType.EndElement && reader2.Name.ToLower().Equals(nodeName))
                                                    break;
                                            }
                                        }
                                        if (reader2.NodeType == XmlNodeType.EndElement && reader2.Name.ToLower().Equals(nodeName))
                                            break;
                                    }
                                    break;

                                case "accessrestrict":
                                    Return_Package.Bib_Info.Add_Note(Clean_Text_Block(reader2.ReadInnerXml()), Note_Type_Enum.restriction);
                                    break;

                                case "userestrict":
                                    Return_Package.Bib_Info.Access_Condition.Text = Clean_Text_Block(reader2.ReadInnerXml());
                                    break;

                                case "acqinfo":
                                    Return_Package.Bib_Info.Add_Note(Clean_Text_Block(reader2.ReadInnerXml()), Note_Type_Enum.acquisition);
                                    break;

                                case "bioghist":
                                    Return_Package.Bib_Info.Add_Note(Clean_Text_Block(reader2.ReadInnerXml()), Note_Type_Enum.biographical);
                                    break;

                                case "scopecontent":
                                    Return_Package.Bib_Info.Add_Abstract(Clean_Text_Block(reader2.ReadInnerXml()), "", "summary", "Summary");
                                    break;

                                case "controlaccess":
                                    while (reader2.Read())
                                    {
                                        if (reader2.NodeType == XmlNodeType.Element && (reader2.Name.Equals("corpname") || reader2.Name.Equals("persname")))
                                        {
                                            string tagnamei = reader2.Name;
                                            string source = "";
                                            if (reader2.MoveToAttribute("source"))
                                                source = reader2.Value;
                                            while (reader2.Read())
                                            {
                                                if (reader2.NodeType == XmlNodeType.Text)
                                                {
                                                    Subject_Info_Name newName = new Subject_Info_Name();
                                                    //ToSee: where to add name? and ehat types
                                                    //ToDo: Type
                                                    newName.Full_Name = Trim_Final_Punctuation(reader2.Value);
                                                    newName.Authority = source;
                                                    Return_Package.Bib_Info.Add_Subject(newName);
                                                    if (tagnamei.StartsWith("corp"))
                                                        newName.Name_Type = Name_Info_Type_Enum.corporate;
                                                    else if (tagnamei.StartsWith("pers"))
                                                        newName.Name_Type = Name_Info_Type_Enum.personal;
                                                    else
                                                        newName.Name_Type = Name_Info_Type_Enum.UNKNOWN;
                                                }
                                                else if (reader2.NodeType == XmlNodeType.EndElement && reader2.Name.Equals(tagnamei))
                                                    break;
                                            }
                                        }
                                        else if (reader2.NodeType == XmlNodeType.Element && (reader2.Name.Equals("subject")))
                                        {
                                            string tagnamei = reader2.Name;
                                            string source = "";
                                            if (reader2.MoveToAttribute("source"))
                                                source = reader2.Value;
                                            while (reader2.Read())
                                            {
                                                if (reader2.NodeType == XmlNodeType.Text)
                                                {
                                                    string subjectTerm = Trim_Final_Punctuation(reader2.Value.Trim());
                                                    if (subjectTerm.Length > 1)
                                                    {
                                                        Subject_Info_Standard subject = Return_Package.Bib_Info.Add_Subject();
                                                        subject.Authority = source;
                                                        if (subjectTerm.IndexOf("--") == 0)
                                                            subject.Add_Topic(subjectTerm);
                                                        else
                                                        {
                                                            while (subjectTerm.IndexOf("--") > 0)
                                                            {
                                                                string fragment = subjectTerm.Substring(0, subjectTerm.IndexOf("--")).Trim();
                                                                if (fragment.ToLower() == "florida")
                                                                    subject.Add_Geographic(fragment);
                                                                else
                                                                    subject.Add_Topic(fragment);

                                                                if (subjectTerm.Length > subjectTerm.IndexOf("--") + 3)
                                                                    subjectTerm = subjectTerm.Substring(subjectTerm.IndexOf("--") + 2);
                                                                else
                                                                    subjectTerm = String.Empty;
                                                            }
                                                            if (subjectTerm.Trim().Length > 0)
                                                            {
                                                                string fragment = subjectTerm.Trim();
                                                                if (fragment.ToLower() == "florida")
                                                                    subject.Add_Geographic(fragment);
                                                                else
                                                                    subject.Add_Topic(fragment);
                                                            }
                                                        }
                                                    }
                                                }
                                                else if (reader2.NodeType == XmlNodeType.EndElement && reader2.Name.Equals(tagnamei))
                                                    break;
                                            }
                                        }
                                        if (reader2.NodeType == XmlNodeType.EndElement && reader2.Name.ToLower().Equals(nodeName))
                                            break;
                                    }
                                    break;

                                case "dsc":
                                    eadInfo.Container_Hierarchy.Read(reader2);
                                    break;
                            }
                        }

                        if (reader2.NodeType == XmlNodeType.EndElement && reader2.Name.Equals(GlobalVar.EAD_METADATA_MODULE_KEY))
                            break;
                    }

                    reader2.Close();
                }
                catch (Exception ee)
                {
                    Error_Message = "Error caught in EAD_reader2_Writer: " + ee.Message;
                    return false;
                }
            }

            // If there is a XSL, apply it to the description stored in the EAD sub-section of the item id
            if (XSL_Location.Length > 0)
            {
                try
                {
                    // Create the transform and load the XSL indicated
                    XslCompiledTransform transform = new XslCompiledTransform();
                    transform.Load(XSL_Location);

                    // Apply the transform to convert the XML into HTML
                    StringWriter results = new StringWriter();
                    XmlReaderSettings settings = new XmlReaderSettings();
                    settings.ProhibitDtd = false;
                    using (XmlReader transformreader = XmlReader.Create(new StringReader(eadInfo.Full_Description), settings))
                    {
                        transform.Transform(transformreader, null, results);
                    }
                    eadInfo.Full_Description = results.ToString();

                    // Get rid of the <?xml header
                    if (eadInfo.Full_Description.IndexOf("<?xml") >= 0)
                    {
                        int xml_end_index = eadInfo.Full_Description.IndexOf("?>");
                        eadInfo.Full_Description = eadInfo.Full_Description.Substring(xml_end_index + 2);
                    }

                    // Since this was successful, try to build the TOC list of included sections
                    SortedList<int, string> toc_sorter = new SortedList<int, string>();
                    string description = eadInfo.Full_Description;
                    int did = description.IndexOf("<a name=\"did\"");
                    int bioghist = description.IndexOf("<a name=\"bioghist\"");
                    int scopecontent = description.IndexOf("<a name=\"scopecontent\"");
                    int organization = description.IndexOf("<a name=\"organization\"");
                    int arrangement = description.IndexOf("<a name=\"arrangement\"");
                    int relatedmaterial = description.IndexOf("<a name=\"relatedmaterial\"");
                    int otherfindaid = description.IndexOf("<a name=\"otherfindaid\"");
                    int index = description.IndexOf("<a name=\"index\">");
                    int bibliography = description.IndexOf("<a name=\"bibliography\"");
                    int odd = description.IndexOf("<a name=\"odd\"");
                    int controlaccess = description.IndexOf("<a name=\"controlaccess\"");
                    int accruals = description.IndexOf("<a name=\"accruals\"");
                    int appraisal = description.IndexOf("<a name=\"appraisal\"");
                    int processinfo = description.IndexOf("<a name=\"processinfo\"");
                    int acqinfo = description.IndexOf("<a name=\"acqinfo\"");
                    int prefercite = description.IndexOf("<a name=\"prefercite\"");
                    int altformavail = description.IndexOf("<a name=\"altformavail\"");
                    int custodhist = description.IndexOf("<a name=\"custodhist\"");
                    int accessrestrict = description.IndexOf("<a name=\"accessrestrict\"");
                    int admininfo = description.IndexOf("<a name=\"admininfo\"");

                    if (did >= 0) toc_sorter[did] = "did";
                    if (bioghist >= 0) toc_sorter[bioghist] = "bioghist";
                    if (scopecontent >= 0) toc_sorter[scopecontent] = "scopecontent";
                    if (organization >= 0) toc_sorter[organization] = "organization";
                    if (arrangement >= 0) toc_sorter[arrangement] = "arrangement";
                    if (relatedmaterial >= 0) toc_sorter[relatedmaterial] = "relatedmaterial";
                    if (otherfindaid >= 0) toc_sorter[otherfindaid] = "otherfindaid";
                    if (index >= 0) toc_sorter[index] = "index";
                    if (bibliography >= 0) toc_sorter[bibliography] = "bibliography";
                    if (odd >= 0) toc_sorter[odd] = "odd";
                    if (controlaccess >= 0) toc_sorter[controlaccess] = "controlaccess";
                    if (accruals >= 0) toc_sorter[accruals] = "accruals";
                    if (appraisal >= 0) toc_sorter[appraisal] = "appraisal";
                    if (processinfo >= 0) toc_sorter[processinfo] = "processinfo";
                    if (acqinfo >= 0) toc_sorter[acqinfo] = "acqinfo";
                    if (prefercite >= 0) toc_sorter[prefercite] = "prefercite";
                    if (altformavail >= 0) toc_sorter[altformavail] = "altformavail";
                    if (custodhist >= 0) toc_sorter[custodhist] = "custodhist";
                    if (accessrestrict >= 0) toc_sorter[accessrestrict] = "accessrestrict";
                    if (admininfo >= 0) toc_sorter[admininfo] = "admininfo";

                    // Now, add each section back to the TOC list
                    foreach (string thisEadSection in toc_sorter.Values)
                    {
                        // Index needs to have its head looked up, everything else adds simply
                        if (thisEadSection != "index")
                        {
                            switch (thisEadSection)
                            {
                                case "did":
                                    eadInfo.Add_TOC_Included_Section("did", "Descriptive Summary");
                                    break;

                                case "bioghist":
                                    eadInfo.Add_TOC_Included_Section("bioghist", "Biographical / Historical Note");
                                    break;

                                case "scopecontent":
                                    eadInfo.Add_TOC_Included_Section("scopecontent", "Scope and Content");
                                    break;

                                case "accessrestrict":
                                    eadInfo.Add_TOC_Included_Section("accessrestrict", "Access or Use Restrictions");
                                    break;

                                case "relatedmaterial":
                                    eadInfo.Add_TOC_Included_Section("relatedmaterial", "Related or Separated Material");
                                    break;

                                case "admininfo":
                                    eadInfo.Add_TOC_Included_Section("admininfo", "Administrative Information");
                                    break;

                                case "altformavail":
                                    eadInfo.Add_TOC_Included_Section("altformavail", " &nbsp; &nbsp; Alternate Format Available");
                                    break;

                                case "prefercite":
                                    eadInfo.Add_TOC_Included_Section("prefercite", " &nbsp; &nbsp; Preferred Citation");
                                    break;

                                case "acqinfo":
                                    eadInfo.Add_TOC_Included_Section("acqinfo", " &nbsp; &nbsp; Acquisition Information");
                                    break;

                                case "processinfo":
                                    eadInfo.Add_TOC_Included_Section("processinfo", " &nbsp; &nbsp; Processing Information");
                                    break;

                                case "custodhist":
                                    eadInfo.Add_TOC_Included_Section("custodhist", " &nbsp; &nbsp; Custodial Work_History");
                                    break;

                                case "controlaccess":
                                    eadInfo.Add_TOC_Included_Section("controlaccess", "Selected Subjects");
                                    break;

                                case "otherfindaid":
                                    eadInfo.Add_TOC_Included_Section("otherfindaid", "Alternate Form of Finding Aid");
                                    break;
                            }
                        }
                        else
                        {
                            int end_link = eadInfo.Full_Description.IndexOf("</a>", index);
                            string index_title = eadInfo.Full_Description.Substring(index + 16, end_link - index - 16);
                            if (index_title.Length > 38)
                                index_title = index_title.Substring(0, 32) + "...";
                            eadInfo.Add_TOC_Included_Section("index", index_title);
                        }
                    }
                }
                catch (Exception ee)
                {
                    bool error = false;
                }
            }

            // Now, parse the container section as XML
            if (container_builder.Length > 0)
            {
                StringReader containerReader = new StringReader(container_builder.ToString());
                XmlTextReader xml_reader = new XmlTextReader(containerReader);
                xml_reader.Read();
                eadInfo.Container_Hierarchy.Read(xml_reader);
            }

            return true;
        }
        private static void read_vra_core_extensions(XmlReader r, Bibliographic_Info thisBibInfo, string alias, SobekCM_Item Package)
        {
            if (Package == null)
            {
                while (r.Read())
                {
                    if ((r.NodeType == XmlNodeType.EndElement) && ((r.Name == "mods:extension") || (r.Name == "extension")))
                    {
                        return;
                    }
                }
                return;
            }

            VRACore_Info vraCoreInfo = Package.Get_Metadata_Module( GlobalVar.VRACORE_METADATA_MODULE_KEY ) as VRACore_Info;
            if (vraCoreInfo == null)
            {
                vraCoreInfo = new VRACore_Info();
                Package.Add_Metadata_Module(GlobalVar.VRACORE_METADATA_MODULE_KEY, vraCoreInfo);
            }

            while (r.Read())
            {
                if ((r.NodeType == XmlNodeType.EndElement) && ((r.Name == "mods:extension") || (r.Name == "extension")))
                {
                    return;
                }

                if (r.NodeType == XmlNodeType.Element)
                {
                    string nodename = r.Name;
                    if (alias.Length > 0)
                    {
                        nodename = nodename.Replace(alias + ":", "");
                    }
                    switch (nodename)
                    {
                        case "culturalContext":
                            r.Read();
                            if (r.NodeType == XmlNodeType.Text)
                            {
                                if (r.Value.Length > 0)
                                    vraCoreInfo.Add_Cultural_Context(r.Value);
                            }
                            break;

                        case "inscription":
                            r.Read();
                            if (r.NodeType == XmlNodeType.Text)
                            {
                                if (r.Value.Length > 0)
                                    vraCoreInfo.Add_Inscription(r.Value);
                            }
                            break;

                        case "material":
                            string type = String.Empty;
                            if (r.HasAttributes)
                            {
                                if (r.MoveToAttribute("type"))
                                    type = r.Value;
                            }
                            r.Read();
                            if (r.NodeType == XmlNodeType.Text)
                            {
                                if (r.Value.Length > 0)
                                    vraCoreInfo.Add_Material(r.Value, type);
                            }
                            break;

                        case "measurements":
                            string units = String.Empty;
                            if (r.HasAttributes)
                            {
                                if (r.MoveToAttribute("unit"))
                                    units = r.Value;
                            }
                            r.Read();
                            if (r.NodeType == XmlNodeType.Text)
                            {
                                if (r.Value.Length > 0)
                                    vraCoreInfo.Add_Measurement(r.Value, units);
                            }
                            break;

                        case "stateEdition":
                            r.Read();
                            if (r.NodeType == XmlNodeType.Text)
                            {
                                if (r.Value.Length > 0)
                                    vraCoreInfo.Add_State_Edition(r.Value);
                            }
                            break;

                        case "stylePeriod":
                            r.Read();
                            if (r.NodeType == XmlNodeType.Text)
                            {
                                if (r.Value.Length > 0)
                                    vraCoreInfo.Add_Style_Period(r.Value);
                            }
                            break;

                        case "technique":
                            r.Read();
                            if (r.NodeType == XmlNodeType.Text)
                            {
                                if (r.Value.Length > 0)
                                    vraCoreInfo.Add_Technique(r.Value);
                            }
                            break;
                    }
                }
            }
        }
        /// <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)
        {
            // Get the related metadata modules here
            Performing_Arts_Info partInfo = Return_Package.Get_Metadata_Module("PerformingArts") as Performing_Arts_Info;
            Oral_Interview_Info oralInfo = Return_Package.Get_Metadata_Module("OralInterview") as Oral_Interview_Info;

            // Was a list for the deprecated download portion of the SobekCM section input?
            List<Download_Info_DEPRECATED> deprecatedDownloads = null;
            if (Options != null)
            {
                if (Options.ContainsKey("SobekCM_METS_dmdSec_ReaderWriter:Deprecated_Downloads"))
                {
                    deprecatedDownloads = (List<Download_Info_DEPRECATED>) Options["SobekCM_METS_dmdSec_ReaderWriter:Deprecated_Downloads"];
                }
            }

            while (Input_XmlReader.Read())
            {
                if ((Input_XmlReader.NodeType == XmlNodeType.EndElement) && ((Input_XmlReader.Name == "METS:mdWrap") || (Input_XmlReader.Name == "mdWrap")))
                    return true;

                if (Input_XmlReader.NodeType == XmlNodeType.Element)
                {
                    switch (Input_XmlReader.Name.Replace(sobekcm_namespace + ":", ""))
                    {
                        case "embeddedVideo":
                            Input_XmlReader.Read();
                            if (Input_XmlReader.NodeType == XmlNodeType.Text)
                            {
                                string code = Input_XmlReader.Value;
                                Return_Package.Behaviors.Embedded_Video = Input_XmlReader.Value;
                            }
                            break;

                        case "Collection.Primary":
                            Input_XmlReader.Read();
                            if (Input_XmlReader.NodeType == XmlNodeType.Text)
                            {
                                string code = Input_XmlReader.Value;
                                Return_Package.Behaviors.Add_Aggregation(code);
                            }
                            break;

                        case "Collection.Alternate":
                            Input_XmlReader.Read();
                            if (Input_XmlReader.NodeType == XmlNodeType.Text)
                            {
                                string code = Input_XmlReader.Value;
                                Return_Package.Behaviors.Add_Aggregation(code);
                            }
                            break;

                        case "SubCollection":
                            Input_XmlReader.Read();
                            if (Input_XmlReader.NodeType == XmlNodeType.Text)
                                Return_Package.Behaviors.Add_Aggregation(Input_XmlReader.Value);
                            break;

                        case "Aggregation":
                            Input_XmlReader.Read();
                            if (Input_XmlReader.NodeType == XmlNodeType.Text)
                                Return_Package.Behaviors.Add_Aggregation(Input_XmlReader.Value);
                            break;

                        case "MainPage":
                            if (Input_XmlReader.MoveToAttribute("pagename"))
                                Return_Package.Behaviors.Main_Page.PageName = Input_XmlReader.Value;
                            if (Input_XmlReader.MoveToAttribute("previous"))
                            {
                                try
                                {
                                    Return_Package.Behaviors.Main_Page.Previous_Page_Exists = Convert.ToBoolean(Input_XmlReader.Value);
                                }
                                catch
                                {
                                }
                            }
                            if (Input_XmlReader.MoveToAttribute("next"))
                            {
                                try
                                {
                                    Return_Package.Behaviors.Main_Page.Next_Page_Exists = Convert.ToBoolean(Input_XmlReader.Value);
                                }
                                catch
                                {
                                }
                            }
                            Input_XmlReader.Read();
                            if (Input_XmlReader.NodeType == XmlNodeType.Text)
                                Return_Package.Behaviors.Main_Page.FileName = Input_XmlReader.Value;
                            break;

                        case "MainThumbnail":
                            Input_XmlReader.Read();
                            if (Input_XmlReader.NodeType == XmlNodeType.Text)
                                Return_Package.Behaviors.Main_Thumbnail = Input_XmlReader.Value;
                            break;

                        case "EncodingLevel":
                            Input_XmlReader.Read();
                            if (Input_XmlReader.NodeType == XmlNodeType.Text)
                                Return_Package.Bib_Info.EncodingLevel = Input_XmlReader.Value;
                            break;

                        case "Icon":
                        case "Wordmark":
                            Input_XmlReader.Read();
                            if (Input_XmlReader.NodeType == XmlNodeType.Text)
                                Return_Package.Behaviors.Add_Wordmark(Input_XmlReader.Value);
                            break;

                        case "Download":
                            Download_Info_DEPRECATED newDownload = new Download_Info_DEPRECATED();
                            if (Input_XmlReader.MoveToAttribute("label"))
                                newDownload.Label = Input_XmlReader.Value;
                            while (Input_XmlReader.Read())
                            {
                                if (Input_XmlReader.NodeType == XmlNodeType.Element)
                                    break;

                                if ((Input_XmlReader.NodeType == XmlNodeType.EndElement) && (Input_XmlReader.Name == sobekcm_namespace + ":Download"))
                                    break;
                            }
                            switch (Input_XmlReader.Name.Replace(sobekcm_namespace + ":", ""))
                            {
                                case "name":
                                    Input_XmlReader.Read();
                                    if (Input_XmlReader.NodeType == XmlNodeType.Text)
                                    {
                                        newDownload.FileName = Input_XmlReader.Value;
                                        if (deprecatedDownloads != null)
                                            deprecatedDownloads.Add(newDownload);
                                    }
                                    break;

                                case "url":
                                    if (Input_XmlReader.MoveToAttribute("type"))
                                        newDownload.FormatCode = Input_XmlReader.Value;
                                    if (Input_XmlReader.MoveToAttribute("size"))
                                    {
                                        try
                                        {
                                            newDownload.Size_MB = (float) Convert.ToDouble(Input_XmlReader.Value);
                                        }
                                        catch
                                        {
                                        }
                                    }
                                    Input_XmlReader.Read();
                                    if (Input_XmlReader.NodeType == XmlNodeType.Text)
                                    {
                                        newDownload.URL = Input_XmlReader.Value;
                                        if (deprecatedDownloads != null)
                                            deprecatedDownloads.Add(newDownload);
                                    }
                                    break;

                                case "fptr":
                                    if (Input_XmlReader.MoveToAttribute("FILEID"))
                                    {
                                        newDownload.File_ID = Input_XmlReader.Value;
                                        if (deprecatedDownloads != null)
                                            deprecatedDownloads.Add(newDownload);
                                    }
                                    break;
                            }
                            break;

                        case "URL":
                            Input_XmlReader.Read();
                            if (Input_XmlReader.NodeType == XmlNodeType.Text)
                                Return_Package.Bib_Info.Location.PURL = Input_XmlReader.Value;
                            break;

                        case "GUID":
                            Input_XmlReader.Read();
                            if (Input_XmlReader.NodeType == XmlNodeType.Text)
                                Return_Package.Web.GUID = Input_XmlReader.Value;
                            break;

                        case "NotifyEmail":
                            Input_XmlReader.Read();
                            if (Input_XmlReader.NodeType == XmlNodeType.Text)
                            {
                                Return_Package.Behaviors.NotifyEmail = Input_XmlReader.Value;
                            }
                            break;

                        case "Tickler":
                            Input_XmlReader.Read();
                            if (Input_XmlReader.NodeType == XmlNodeType.Text)
                            {
                                Return_Package.Behaviors.Add_Tickler(Input_XmlReader.Value);
                            }
                            break;

                        case "BibID":
                            Input_XmlReader.Read();
                            if (Input_XmlReader.NodeType == XmlNodeType.Text)
                                Return_Package.Bib_Info.BibID = Input_XmlReader.Value;
                            break;

                        case "VID":
                            Input_XmlReader.Read();
                            if (Input_XmlReader.NodeType == XmlNodeType.Text)
                                Return_Package.Bib_Info.VID = Input_XmlReader.Value;
                            break;

                        case "Affiliation":
                            Affiliation_Info newAffiliation = new Affiliation_Info();
                            if (Input_XmlReader.MoveToAttribute("nameid"))
                                newAffiliation.Name_Reference = Input_XmlReader.Value;
                            while (Input_XmlReader.Read())
                            {
                                if ((Input_XmlReader.NodeType == XmlNodeType.EndElement) && (Input_XmlReader.Name == sobekcm_namespace + ":Affiliation"))
                                {
                                    if (newAffiliation.hasData)
                                    {
                                        Return_Package.Bib_Info.Add_Affiliation(newAffiliation);
                                        break;
                                    }
                                }

                                if (Input_XmlReader.NodeType == XmlNodeType.Element)
                                {
                                    switch (Input_XmlReader.Name.Replace(sobekcm_namespace + ":", ""))
                                    {
                                        case "AffiliationTerm":
                                            Input_XmlReader.Read();
                                            if (Input_XmlReader.NodeType == XmlNodeType.Text)
                                                newAffiliation.Term = Input_XmlReader.Value;
                                            break;

                                        case "University":
                                            Input_XmlReader.Read();
                                            if (Input_XmlReader.NodeType == XmlNodeType.Text)
                                                newAffiliation.University = Input_XmlReader.Value;
                                            break;

                                        case "Campus":
                                            Input_XmlReader.Read();
                                            if (Input_XmlReader.NodeType == XmlNodeType.Text)
                                                newAffiliation.Campus = Input_XmlReader.Value;
                                            break;

                                        case "College":
                                            Input_XmlReader.Read();
                                            if (Input_XmlReader.NodeType == XmlNodeType.Text)
                                                newAffiliation.College = Input_XmlReader.Value;
                                            break;

                                        case "Unit":
                                            Input_XmlReader.Read();
                                            if (Input_XmlReader.NodeType == XmlNodeType.Text)
                                                newAffiliation.Unit = Input_XmlReader.Value;
                                            break;

                                        case "Department":
                                            Input_XmlReader.Read();
                                            if (Input_XmlReader.NodeType == XmlNodeType.Text)
                                                newAffiliation.Department = Input_XmlReader.Value;
                                            break;

                                        case "Institute":
                                            Input_XmlReader.Read();
                                            if (Input_XmlReader.NodeType == XmlNodeType.Text)
                                                newAffiliation.Institute = Input_XmlReader.Value;
                                            break;

                                        case "Center":
                                            Input_XmlReader.Read();
                                            if (Input_XmlReader.NodeType == XmlNodeType.Text)
                                                newAffiliation.Center = Input_XmlReader.Value;
                                            break;

                                        case "Section":
                                            Input_XmlReader.Read();
                                            if (Input_XmlReader.NodeType == XmlNodeType.Text)
                                                newAffiliation.Section = Input_XmlReader.Value;
                                            break;

                                        case "SubSection":
                                            Input_XmlReader.Read();
                                            if (Input_XmlReader.NodeType == XmlNodeType.Text)
                                                newAffiliation.SubSection = Input_XmlReader.Value;
                                            break;
                                    }
                                }
                            }
                            break;

                        case "Coordinates":
                            read_coordinates_info(Input_XmlReader, Return_Package);
                            break;

                        case "Holding":
                            while (Input_XmlReader.Read())
                            {
                                if ((Input_XmlReader.NodeType == XmlNodeType.EndElement) && (Input_XmlReader.Name == sobekcm_namespace + ":Holding"))
                                    break;

                                if ((Input_XmlReader.NodeType == XmlNodeType.Element) && (Input_XmlReader.Name == sobekcm_namespace + ":statement"))
                                {
                                    if (Input_XmlReader.MoveToAttribute("code"))
                                        Return_Package.Bib_Info.Location.Holding_Code = Input_XmlReader.Value;
                                    Input_XmlReader.Read();
                                    if (Input_XmlReader.NodeType == XmlNodeType.Text)
                                    {
                                        Return_Package.Bib_Info.Location.Holding_Name = Input_XmlReader.Value;
                                        break;
                                    }
                                }
                            }
                            break;

                        case "Source":
                            while (Input_XmlReader.Read())
                            {
                                if ((Input_XmlReader.NodeType == XmlNodeType.EndElement) && (Input_XmlReader.Name == sobekcm_namespace + ":Source"))
                                    break;

                                if ((Input_XmlReader.NodeType == XmlNodeType.Element) && (Input_XmlReader.Name == sobekcm_namespace + ":statement"))
                                {
                                    if (Input_XmlReader.MoveToAttribute("code"))
                                        Return_Package.Bib_Info.Source.Code = Input_XmlReader.Value;
                                    Input_XmlReader.Read();
                                    if (Input_XmlReader.NodeType == XmlNodeType.Text)
                                    {
                                        Return_Package.Bib_Info.Source.Statement = Input_XmlReader.Value;
                                        break;
                                    }
                                }
                            }
                            break;

                        case "Temporal":
                            while (Input_XmlReader.Read())
                            {
                                if ((Input_XmlReader.NodeType == XmlNodeType.EndElement) && (Input_XmlReader.Name == sobekcm_namespace + ":Temporal"))
                                {
                                    break;
                                }

                                if ((Input_XmlReader.NodeType == XmlNodeType.Element) && (Input_XmlReader.Name == sobekcm_namespace + ":period"))
                                {
                                    Temporal_Info newTemporal = new Temporal_Info();
                                    if (Input_XmlReader.MoveToAttribute("start"))
                                    {
                                        try
                                        {
                                            newTemporal.Start_Year = Convert.ToInt32(Input_XmlReader.Value);
                                        }
                                        catch
                                        {
                                        }
                                    }

                                    if (Input_XmlReader.MoveToAttribute("end"))
                                    {
                                        try
                                        {
                                            newTemporal.End_Year = Convert.ToInt32(Input_XmlReader.Value);
                                        }
                                        catch
                                        {
                                        }
                                    }

                                    Input_XmlReader.Read();
                                    if (Input_XmlReader.NodeType == XmlNodeType.Text)
                                    {
                                        newTemporal.TimePeriod = Input_XmlReader.Value;
                                        Return_Package.Bib_Info.Add_Temporal_Subject(newTemporal);
                                    }
                                }
                            }
                            break;

                        case "Type":
                            Input_XmlReader.Read();
                            if (Input_XmlReader.NodeType == XmlNodeType.Text)
                            {
                                Return_Package.Bib_Info.SobekCM_Type_String = Input_XmlReader.Value.Trim();
                            }
                            break;

                        case "SortDate":
                            Input_XmlReader.Read();
                            if (Input_XmlReader.NodeType == XmlNodeType.Text)
                            {
                                try
                                {
                                    Return_Package.Bib_Info.SortDate = Convert.ToInt32(Input_XmlReader.Value);
                                }
                                catch
                                {
                                }
                            }
                            break;

                        case "SortTitle":
                            Input_XmlReader.Read();
                            if (Input_XmlReader.NodeType == XmlNodeType.Text)
                            {
                                Return_Package.Bib_Info.SortTitle = Input_XmlReader.Value;
                            }
                            break;

                        case "Manufacturer":
                            Publisher_Info thisManufacturer = null;
                            string manufacturer_id = String.Empty;
                            if (Input_XmlReader.MoveToAttribute("ID"))
                                manufacturer_id = Input_XmlReader.Value;
                            while (Input_XmlReader.Read())
                            {
                                if ((Input_XmlReader.NodeType == XmlNodeType.EndElement) && (Input_XmlReader.Name == sobekcm_namespace + ":Manufacturer"))
                                {
                                    if (thisManufacturer != null)
                                    {
                                        thisManufacturer.ID = manufacturer_id;
                                    }
                                    break;
                                }

                                if (Input_XmlReader.NodeType == XmlNodeType.Element)
                                {
                                    switch (Input_XmlReader.Name.Replace(sobekcm_namespace + ":", ""))
                                    {
                                        case "Name":
                                            Input_XmlReader.Read();
                                            if (Input_XmlReader.NodeType == XmlNodeType.Text)
                                            {
                                                thisManufacturer = Return_Package.Bib_Info.Add_Manufacturer(Input_XmlReader.Value);
                                            }
                                            break;

                                        case "PlaceTerm":
                                            if (thisManufacturer != null)
                                            {
                                                if ((Input_XmlReader.MoveToAttribute("type")) && (Input_XmlReader.Value == "code"))
                                                {
                                                    if (Input_XmlReader.MoveToAttribute("authority"))
                                                    {
                                                        switch (Input_XmlReader.Value)
                                                        {
                                                            case "marccountry":
                                                                Input_XmlReader.Read();
                                                                if (Input_XmlReader.NodeType == XmlNodeType.Text)
                                                                {
                                                                    thisManufacturer.Add_Place(String.Empty, Input_XmlReader.Value, String.Empty);
                                                                }
                                                                break;

                                                            case "iso3166":
                                                                Input_XmlReader.Read();
                                                                if (Input_XmlReader.NodeType == XmlNodeType.Text)
                                                                {
                                                                    thisManufacturer.Add_Place(String.Empty, String.Empty, Input_XmlReader.Value);
                                                                }
                                                                break;
                                                        }
                                                    }
                                                }
                                                else
                                                {
                                                    Input_XmlReader.Read();
                                                    if (Input_XmlReader.NodeType == XmlNodeType.Text)
                                                    {
                                                        thisManufacturer.Add_Place(Input_XmlReader.Value);
                                                    }
                                                }
                                            }
                                            break;
                                    }
                                }
                            }
                            break;

                        case "Publisher":
                            Publisher_Info thisPublisher = null;
                            string publisher_id = String.Empty;
                            if (Input_XmlReader.MoveToAttribute("ID"))
                                publisher_id = Input_XmlReader.Value;
                            while (Input_XmlReader.Read())
                            {
                                if ((Input_XmlReader.NodeType == XmlNodeType.EndElement) && (Input_XmlReader.Name == sobekcm_namespace + ":Publisher"))
                                {
                                    if (thisPublisher != null)
                                    {
                                        thisPublisher.ID = publisher_id;
                                    }
                                    break;
                                }

                                if (Input_XmlReader.NodeType == XmlNodeType.Element)
                                {
                                    switch (Input_XmlReader.Name.Replace(sobekcm_namespace + ":", ""))
                                    {
                                        case "Name":
                                            Input_XmlReader.Read();
                                            if (Input_XmlReader.NodeType == XmlNodeType.Text)
                                            {
                                                thisPublisher = Return_Package.Bib_Info.Add_Publisher(Input_XmlReader.Value);
                                            }
                                            break;

                                        case "PlaceTerm":
                                            if (thisPublisher != null)
                                            {
                                                if ((Input_XmlReader.MoveToAttribute("type")) && (Input_XmlReader.Value == "code"))
                                                {
                                                    if (Input_XmlReader.MoveToAttribute("authority"))
                                                    {
                                                        switch (Input_XmlReader.Value)
                                                        {
                                                            case "marccountry":
                                                                Input_XmlReader.Read();
                                                                if (Input_XmlReader.NodeType == XmlNodeType.Text)
                                                                {
                                                                    thisPublisher.Add_Place(String.Empty, Input_XmlReader.Value, String.Empty);
                                                                }
                                                                break;

                                                            case "iso3166":
                                                                Input_XmlReader.Read();
                                                                if (Input_XmlReader.NodeType == XmlNodeType.Text)
                                                                {
                                                                    thisPublisher.Add_Place(String.Empty, String.Empty, Input_XmlReader.Value);
                                                                }
                                                                break;
                                                        }
                                                    }
                                                }
                                                else
                                                {
                                                    Input_XmlReader.Read();
                                                    if (Input_XmlReader.NodeType == XmlNodeType.Text)
                                                    {
                                                        thisPublisher.Add_Place(Input_XmlReader.Value);
                                                    }
                                                }
                                            }
                                            break;
                                    }
                                }
                            }
                            break;

                        case "part:performingArts":
                            if (partInfo == null)
                            {
                                partInfo = new Performing_Arts_Info();
                                Return_Package.Add_Metadata_Module("PerformingArts", partInfo);
                            }
                            while (Input_XmlReader.Read())
                            {
                                if ((Input_XmlReader.NodeType == XmlNodeType.EndElement) && (Input_XmlReader.Name == "part:performingArts"))
                                    break;

                                if (Input_XmlReader.NodeType == XmlNodeType.Element)
                                {
                                    switch (Input_XmlReader.Name)
                                    {
                                        case "part:Performer":
                                            string occupation = String.Empty;
                                            string lifespan = String.Empty;
                                            string title = String.Empty;
                                            string sex = String.Empty;
                                            if (Input_XmlReader.MoveToAttribute("occupation"))
                                                occupation = Input_XmlReader.Value;
                                            if (Input_XmlReader.MoveToAttribute("lifespan"))
                                                lifespan = Input_XmlReader.Value;
                                            if (Input_XmlReader.MoveToAttribute("title"))
                                                title = Input_XmlReader.Value;
                                            if (Input_XmlReader.MoveToAttribute("sex"))
                                                sex = Input_XmlReader.Value;
                                            Input_XmlReader.Read();
                                            if (Input_XmlReader.NodeType == XmlNodeType.Text)
                                            {
                                                Performer newPerformer = partInfo.Add_Performer(Input_XmlReader.Value);
                                                newPerformer.Occupation = occupation;
                                                newPerformer.Title = title;
                                                newPerformer.Sex = sex;
                                                newPerformer.LifeSpan = lifespan;
                                            }
                                            break;

                                        case "part:Performance":
                                            if (Input_XmlReader.MoveToAttribute("date"))
                                                partInfo.Performance_Date = Input_XmlReader.Value;
                                            Input_XmlReader.MoveToElement();
                                            if (!Input_XmlReader.IsEmptyElement)
                                            {
                                                Input_XmlReader.Read();
                                                if (Input_XmlReader.NodeType == XmlNodeType.Text)
                                                {
                                                    partInfo.Performance = Input_XmlReader.Value;
                                                }
                                            }
                                            break;
                                    }
                                }
                            }
                            break;

                        case "SerialHierarchy":
                            int serial_level = -1;
                            int serial_order = -1;
                            string serial_display = String.Empty;
                            if (Input_XmlReader.MoveToAttribute("level"))
                            {
                                try
                                {
                                    serial_level = Convert.ToInt32(Input_XmlReader.Value);
                                }
                                catch
                                {
                                }
                            }
                            if (Input_XmlReader.MoveToAttribute("order"))
                            {
                                try
                                {
                                    serial_order = Convert.ToInt32(Input_XmlReader.Value);
                                }
                                catch
                                {
                                }
                            }
                            Input_XmlReader.MoveToElement();
                            if (!Input_XmlReader.IsEmptyElement)
                            {
                                Input_XmlReader.Read();
                                if (Input_XmlReader.NodeType == XmlNodeType.Text)
                                    serial_display = Input_XmlReader.Value;
                            }
                            if ((serial_display.Length == 0) && (serial_order > 0))
                                serial_display = serial_order.ToString();
                            if ((serial_display.Length > 0) && (serial_order > 0))
                                Return_Package.Behaviors.Serial_Info.Add_Hierarchy(serial_level, serial_order, serial_display);
                            break;

                        case "Container":
                            int container_level = -1;
                            string container_type = String.Empty;
                            string container_name = String.Empty;
                            if (Input_XmlReader.MoveToAttribute("level"))
                            {
                                try
                                {
                                    container_level = Convert.ToInt32(Input_XmlReader.Value);
                                }
                                catch
                                {
                                }
                            }
                            if (Input_XmlReader.MoveToAttribute("type"))
                            {
                                container_type = Input_XmlReader.Value;
                            }
                            Input_XmlReader.MoveToElement();
                            if (!Input_XmlReader.IsEmptyElement)
                            {
                                Input_XmlReader.Read();
                                if (Input_XmlReader.NodeType == XmlNodeType.Text)
                                {
                                    container_name = Input_XmlReader.Value;

                                    Return_Package.Bib_Info.Add_Container(container_type, container_name, container_level);
                                }
                            }
                            break;

                        case "oral:Interviewee":
                            if (oralInfo == null)
                            {
                                oralInfo = new Oral_Interview_Info();
                                Return_Package.Add_Metadata_Module("OralInterview", oralInfo);
                            }
                            Input_XmlReader.Read();
                            if (Input_XmlReader.NodeType == XmlNodeType.Text)
                            {
                                oralInfo.Interviewee = Input_XmlReader.Value;
                            }
                            break;

                        case "oral:Interviewer":
                            if (oralInfo == null)
                            {
                                oralInfo = new Oral_Interview_Info();
                                Return_Package.Add_Metadata_Module("OralInterview", oralInfo);
                            }
                            Input_XmlReader.Read();
                            if (Input_XmlReader.NodeType == XmlNodeType.Text)
                            {
                                oralInfo.Interviewer = Input_XmlReader.Value;
                            }
                            break;
                    }
                }
            }

            // Return false since this read all the way to the end of the steam
            return false;
        }
        /// <summary> Flag indicates if this active reader/writer needs to append schema reference information
        /// to the METS XML header by analyzing the contents of the digital resource item </summary>
        /// <param name="METS_Item"> Package with all the metadata to save</param>
        /// <returns> TRUE if the schema should be attached, otherwise fALSE </returns>
        public bool Schema_Reference_Required_Package(SobekCM_Item METS_Item)
        {
            Map_Info mapInfo = METS_Item.Get_Metadata_Module(GlobalVar.SOBEKCM_MAPS_METADATA_MODULE_KEY) as Map_Info;
            if (mapInfo == null)
                return false;

            return mapInfo.hasData;
        }
        /// <summary> Returns the schema namespace (xmlns) information to be written in the XML/METS Header</summary>
        /// <param name="METS_Item"> Package with all the metadata to save</param>
        /// <returns> Formatted schema namespace info for the METS header</returns>
        public string[] Schema_Namespace(SobekCM_Item METS_Item)
        {
            string sobekcm_ref = "sobekcm=\"http://digital.uflib.ufl.edu/metadata/sobekcm/\"";
            string oral_ref = "oral=\"http://digital.uflib.ufl.edu/metadata/oral/\"";
            string part_ref = "part=\"http://digital.uflib.ufl.edu/metadata/part/\"";

            Performing_Arts_Info partInfo = METS_Item.Get_Metadata_Module("PerformingArts") as Performing_Arts_Info;
            Oral_Interview_Info oralInfo = METS_Item.Get_Metadata_Module("OralInterview") as Oral_Interview_Info;

            if (((oralInfo == null) || (!oralInfo.hasData)) && ((partInfo == null) || (!partInfo.hasData)))
                return new string[] {sobekcm_ref};

            if (((oralInfo != null) && (oralInfo.hasData)) && ((partInfo != null) && (partInfo.hasData)))
                return new string[] {sobekcm_ref, oral_ref, part_ref};

            if ((oralInfo != null) && (oralInfo.hasData))
            {
                return new string[] {sobekcm_ref, oral_ref};
            }

            if ((partInfo != null) && (partInfo.hasData))
            {
                return new string[] {sobekcm_ref, part_ref};
            }

            return new string[] {};
        }
        /// <summary> Writes the dmdSec for the entire package to the text writer </summary>
        /// <param name="Output_Stream">Stream to which the formatted text is written </param>
        /// <param name="METS_Item">Package with all the metadata to save</param>
        /// <param name="Options"> Dictionary of any options which this METS section writer may utilize</param>
        /// <returns>TRUE if successful, otherwise FALSE </returns>
        public bool Write_dmdSec(TextWriter Output_Stream, SobekCM_Item METS_Item, Dictionary<string, object> Options)
        {
            // Add the processing parameters first
            METS_Item.Behaviors.Add_METS_Processing_Metadata(sobekcm_namespace, Output_Stream);

            // Add the bibliographic description portion
            METS_Item.Bib_Info.Add_SobekCM_BibDesc(Output_Stream);

            // If there is an embedded video write it here
            if (!String.IsNullOrEmpty(METS_Item.Behaviors.Embedded_Video))
            {
                Output_Stream.WriteLine("<sobekcm:embeddedVideo>" + Convert_String_To_XML_Safe(METS_Item.Behaviors.Embedded_Video) + "</sobekcm:embeddedVideo>");
            }

            // Add the serial information, if there is some
            if ((METS_Item.Behaviors.hasSerialInformation) && (METS_Item.Behaviors.Serial_Info.Count > 0) && (METS_Item.METS_Header.RecordStatus_Enum != METS_Record_Status.BIB_LEVEL))
            {
                METS_Item.Behaviors.Serial_Info.Add_METS(sobekcm_namespace, Output_Stream);
            }

            // Add the oral history section, if there is any data+
            Oral_Interview_Info oralInfo = METS_Item.Get_Metadata_Module("OralInterview") as Oral_Interview_Info;
            if ((oralInfo != null) && (oralInfo.hasData))
            {
                // Start the Administrative section
                Output_Stream.WriteLine("<oral:interview>");

                // Add all the custom SobekCM specific data
                if (oralInfo.Interviewee.Length > 0)
                    Output_Stream.WriteLine("<oral:Interviewee>" + base.Convert_String_To_XML_Safe(oralInfo.Interviewee) + "</oral:Interviewee>");
                if (oralInfo.Interviewer.Length > 0)
                    Output_Stream.WriteLine("<oral:Interviewer>" + base.Convert_String_To_XML_Safe(oralInfo.Interviewer) + "</oral:Interviewer>");
                if (oralInfo.Interview_Date.Length > 0)
                    Output_Stream.WriteLine("<oral:InterviewDate>" + base.Convert_String_To_XML_Safe(oralInfo.Interview_Date) + "</oral:InterviewDate>");

                // End the Administrative section
                Output_Stream.WriteLine("</oral:interview>");
            }

            // Add the performing arts section, if there is any data
            Performing_Arts_Info partInfo = METS_Item.Get_Metadata_Module("PerformingArts") as Performing_Arts_Info;
            if ((partInfo != null) && (partInfo.hasData))
            {
                // Start this section
                Output_Stream.WriteLine("<part:performingArts>");

                // Add all the performer data
                if (partInfo.Performers_Count > 0)
                {
                    foreach (Performer thisPerformer in partInfo.Performers)
                    {
                        Output_Stream.Write("<part:Performer");
                        if (thisPerformer.LifeSpan.Length > 0)
                            Output_Stream.Write(" lifespan=\"" + base.Convert_String_To_XML_Safe(thisPerformer.LifeSpan) + "\"");
                        if (thisPerformer.Title.Length > 0)
                            Output_Stream.Write(" title=\"" + base.Convert_String_To_XML_Safe(thisPerformer.Title) + "\"");
                        if (thisPerformer.Occupation.Length > 0)
                            Output_Stream.Write(" occupation=\"" + base.Convert_String_To_XML_Safe(thisPerformer.Occupation) + "\"");
                        if (thisPerformer.Sex.Length > 0)
                            Output_Stream.Write(" sex=\"" + thisPerformer.Sex + "\"");
                        Output_Stream.WriteLine(">" + base.Convert_String_To_XML_Safe(thisPerformer.Name) + "</part:Performer>");
                    }
                }

                // Add the performance information
                if ((!String.IsNullOrEmpty(partInfo.Performance)) || (!String.IsNullOrEmpty(partInfo.Performance_Date)))
                {
                    string performanceName = base.Convert_String_To_XML_Safe(partInfo.Performance);
                    if (performanceName.Length == 0)
                        performanceName = "Unknown";
                    Output_Stream.Write("<part:Performance");
                    if (!String.IsNullOrEmpty(partInfo.Performance_Date))
                        Output_Stream.Write(" date=\"" + base.Convert_String_To_XML_Safe(partInfo.Performance_Date) + "\"");
                    Output_Stream.WriteLine(">" + performanceName + "</part:Performance>");
                }

                //// End this section
                Output_Stream.WriteLine("</part:performingArts>");
            }

            return true;
        }
        /// <summary> Writes the dmdSec for the entire package to the text writer </summary>
        /// <param name="Output_Stream">Stream to which the formatted text is written </param>
        /// <param name="METS_Item">Package with all the metadata to save</param>
        /// <param name="Options"> Dictionary of any options which this METS section writer may utilize</param>
        /// <returns>TRUE if successful, otherwise FALSE </returns>
        public bool Write_dmdSec(TextWriter Output_Stream, SobekCM_Item METS_Item, Dictionary<string, object> Options)
        {
            // Ensure this metadata module extension exists and has data
            Map_Info mapInfo = METS_Item.Get_Metadata_Module(GlobalVar.SOBEKCM_MAPS_METADATA_MODULE_KEY) as Map_Info;
            if ((mapInfo == null) || (!mapInfo.hasData))
                return true;

            // Now, collect the data to include here
            string map_data = mapInfo.ToXML("map:", false);
            Output_Stream.Write(map_data);
            return true;
        }
        /// <summary> Writes the amdSec for the entire package to the text writer </summary>
        /// <param name="Output_Stream">Stream to which the formatted text is written </param>
        /// <param name="METS_Item">Package with all the metadata to save</param>
        /// <param name="Options"> Dictionary of any options which this METS section writer may utilize</param>
        /// <returns>TRUE if successful, otherwise FALSE </returns>
        public bool Write_amdSec(TextWriter Output_Stream, SobekCM_Item METS_Item, Dictionary<string, object> Options)
        {
            // Ensure this metadata module extension exists and has data
            DAITSS_Info daitssInfo = METS_Item.Get_Metadata_Module(GlobalVar.DAITSS_METADATA_MODULE_KEY) as DAITSS_Info;
            if ((daitssInfo == null) || (!daitssInfo.hasData))
                return true;

            Output_Stream.WriteLine("<daitss:daitss>");

            if (!String.IsNullOrEmpty(daitssInfo.SubAccount))
            {
                Output_Stream.WriteLine("<daitss:AGREEMENT_INFO ACCOUNT=\"" + daitssInfo.Account + "\" SUB_ACCOUNT=\"" + daitssInfo.SubAccount + "\" PROJECT=\"" + daitssInfo.Project + "\"/>");
            }
            else
            {
                Output_Stream.WriteLine("<daitss:AGREEMENT_INFO ACCOUNT=\"" + daitssInfo.Account + "\" PROJECT=\"" + daitssInfo.Project + "\"/>");
            }

            Output_Stream.WriteLine("</daitss:daitss>");

            return true;
        }