/// <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> 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;
        }
예제 #3
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];
     }
 }
예제 #4
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 (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.Phylum = base.thisBox.Text.Trim();
     }
 }
예제 #5
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.Account = thisBox.Text.Trim();
     }
 }
예제 #6
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 (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;
                }
            }
        }
        /// <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> 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> 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);
        }
예제 #14
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> 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);
                    }
                }
            }
        }
예제 #16
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> 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;
        }
예제 #18
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 ((thisLatitudeBox.Text.Trim().Length > 0) ||
                (thisLongitudeBox.Text.Trim().Length > 0))
            {
                GeoSpatial_Information coordInfo = Bib.Get_Metadata_Module(GlobalVar.GEOSPATIAL_METADATA_MODULE_KEY) as GeoSpatial_Information;
                if (coordInfo == null)
                {
                    coordInfo = new GeoSpatial_Information();
                    Bib.Add_Metadata_Module(GlobalVar.GEOSPATIAL_METADATA_MODULE_KEY, coordInfo);
                }

                try
                {
                    coordInfo.Add_Point(Convert.ToDouble(thisLatitudeBox.Text.Trim()), Convert.ToDouble(thisLongitudeBox.Text.Trim()), String.Empty);
                }
                catch
                {
                }
            }
        }
        /// <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.thisKeywordBox.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);
                }

                if (base.thisSchemeBox.Text.Trim().Length > 0)
                {
                    vraInfo.Add_Material(base.thisKeywordBox.Text.Trim(), base.thisSchemeBox.Text.ToLower());
                }
                else
                {
                    vraInfo.Add_Material(base.thisKeywordBox.Text.Trim(), "medium");
                }
            }
        }
        /// <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();
                    if (value.Length > 0)
                    {
                        if (etdInfo == null)
                        {
                            etdInfo = new Thesis_Dissertation_Info();
                            Bib.Add_Metadata_Module(GlobalVar.THESIS_METADATA_MODULE_KEY, etdInfo);
                        }
                        etdInfo.Add_Degree_Discipline(value);
                    }
                }
            }
        }
        /// <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> 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
            VRACore_Info vraInfo = Return_Package.Get_Metadata_Module(GlobalVar.VRACORE_METADATA_MODULE_KEY) as VRACore_Info;

            if (vraInfo == null)
            {
                vraInfo = new VRACore_Info();
                Return_Package.Add_Metadata_Module(GlobalVar.VRACORE_METADATA_MODULE_KEY, vraInfo);
            }

            // 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("vra:") == 0)
                    {
                        name = name.Substring(4);
                    }

                    switch (name)
                    {
                    case "culturalcontext":
                        Input_XmlReader.Read();
                        if (Input_XmlReader.NodeType == XmlNodeType.Text)
                        {
                            if (Input_XmlReader.Value.Length > 0)
                            {
                                vraInfo.Add_Cultural_Context(Input_XmlReader.Value);
                            }
                        }
                        break;

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

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

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

                    case "stateedition":
                        Input_XmlReader.Read();
                        if (Input_XmlReader.NodeType == XmlNodeType.Text)
                        {
                            if (Input_XmlReader.Value.Length > 0)
                            {
                                vraInfo.Add_State_Edition(Input_XmlReader.Value);
                            }
                        }
                        break;

                    case "styleperiod":
                        Input_XmlReader.Read();
                        if (Input_XmlReader.NodeType == XmlNodeType.Text)
                        {
                            if (Input_XmlReader.Value.Length > 0)
                            {
                                vraInfo.Add_Style_Period(Input_XmlReader.Value);
                            }
                        }
                        break;

                    case "technique":
                        Input_XmlReader.Read();
                        if (Input_XmlReader.NodeType == XmlNodeType.Text)
                        {
                            if (Input_XmlReader.Value.Length > 0)
                            {
                                vraInfo.Add_Technique(Input_XmlReader.Value);
                            }
                        }
                        break;
                    }
                }
            } while (Input_XmlReader.Read());

            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)
 {
     Bib.Add_Metadata_Module(GlobalVar.GEOSPATIAL_METADATA_MODULE_KEY, coordObject);
 }
        /// <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());
                        }
                    }
                }
            }
        }
예제 #25
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)
		{
			// 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;
		}
예제 #26
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)
        {
            // Ensure this metadata module extension exists
            Zoological_Taxonomy_Info taxonInfo = Return_Package.Get_Metadata_Module(GlobalVar.ZOOLOGICAL_TAXONOMY_METADATA_MODULE_KEY) as Zoological_Taxonomy_Info;

            if (taxonInfo == null)
            {
                taxonInfo = new Zoological_Taxonomy_Info();
                Return_Package.Add_Metadata_Module(GlobalVar.ZOOLOGICAL_TAXONOMY_METADATA_MODULE_KEY, 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();
                    if (name.IndexOf("dwc:") == 0)
                    {
                        name = name.Substring(4);
                    }

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

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

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

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

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

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

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

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

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

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

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

            return(true);
        }
        /// <summary> Perform the requested work </summary>
        public void Do_Work()
        {
            // Get the current user name
            string username         = WindowsIdentity.GetCurrent().Name;
            int    recordsProcessed = 0;

            // Look for a mappings file for this repository
            Dictionary <string, string> oai_objectid_mapping = new Dictionary <string, string>();
            string mappings_file = mapping_directory + "\\" + repository.Repository_Identifier + ".xml";

            try
            {
                if (String.IsNullOrEmpty(repository.Repository_Identifier))
                {
                    mappings_file = mapping_directory + "\\" + repository.Name + ".xml";
                }
                if ((mapping_directory.Length > 0) && (Directory.Exists(mapping_directory)) && (File.Exists(mappings_file)))
                {
                    DataSet mappingSet = new DataSet();
                    mappingSet.ReadXml(mappings_file);
                    foreach (DataRow thisRow in mappingSet.Tables[0].Rows)
                    {
                        oai_objectid_mapping[thisRow[0].ToString()] = thisRow[1].ToString();
                    }
                }
            }
            catch (Exception ee)
            {
                Debug.WriteLine(ee.Message);
                OnComplete(0, OAI_PMH_Importer_Error_Enum.Unable_to_read_existing_mappings_file);
            }

            // Get the first set of records
            OAI_Repository_Records_List records = OAI_Repository_Stream_Reader.List_Records(repository.Harvested_URL, set_to_import, "oai_dc");

            if ((records == null) || (records.Count == 0))
            {
                OnComplete(0, OAI_PMH_Importer_Error_Enum.Unable_to_pull_feed_data);
                return;
            }

            // Flag used to keep the user request if a previous mapping is found that matches a record
            Nullable <bool> use_previous_mappings = null;

            try
            {
                // Continue through each pull using the resumption token
                while ((records != null) && (records.Count > 0))
                {
                    // Step through these records
                    int total_count = records.Count;
                    for (int i = 0; i < total_count; i++)
                    {
                        // Get this record out
                        OAI_Repository_DublinCore_Record record = records[i];

                        // Create the bib package
                        SobekCM_Item bibPackage = new SobekCM_Item(record);

                        // Add some more information about the repository here
                        bibPackage.Bib_Info.Add_Identifier(record.OAI_Identifier, "oai");
                        bibPackage.Bib_Info.Record.Main_Record_Identifier.Type       = "oai";
                        bibPackage.Bib_Info.Record.Main_Record_Identifier.Identifier = record.OAI_Identifier;
                        bibPackage.Bib_Info.Location.Other_URL_Note          = repository.Name;
                        bibPackage.Bib_Info.Location.Other_URL_Display_Label = "External Link";
                        bibPackage.Bib_Info.Source.Statement = repository.Name;

                        // Add constant data from each mapped column into the bib package
                        constantCollection.Add_To_Package(bibPackage);

                        // Make sure there is a title
                        if (bibPackage.Bib_Info.Main_Title.ToString().Trim().Length == 0)
                        {
                            bibPackage.Bib_Info.Main_Title.Title = "Missing Title";
                        }

                        // Set some defaults
                        bibPackage.Source_Directory = destination_folder;
                        if (MetaTemplate_UserSettings.Individual_Creator.Length > 0)
                        {
                            bibPackage.METS_Header.Creator_Individual = MetaTemplate_UserSettings.Individual_Creator;
                        }
                        else
                        {
                            bibPackage.METS_Header.Creator_Individual = username;
                        }
                        bibPackage.METS_Header.Add_Creator_Individual_Notes("Imported via OAI from " + repository.Name);
                        bibPackage.VID = "00001";
                        bibPackage.METS_Header.Creator_Software = "SobekCM METS Editor";

                        // See if this already exists in the mapping
                        if ((!use_previous_mappings.HasValue) && (oai_objectid_mapping.ContainsKey(record.OAI_Identifier)))
                        {
                            DialogResult result = MessageBox.Show("Record from OAI set appears in previous mapping file.   \n\nShould the previous mappings be used?   \n\nIf you select 'YES' the ObjectID will be the same as the previous harvest.\n\nIf you select 'NO' a new ObjectID will be assigned from your range.     ", "Previous Mapping Found", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
                            if (result == DialogResult.Yes)
                            {
                                use_previous_mappings = true;
                            }
                            if (result == DialogResult.No)
                            {
                                use_previous_mappings = false;
                            }
                        }

                        // Assign a BibId
                        if ((use_previous_mappings.HasValue) && (use_previous_mappings.Value) && (oai_objectid_mapping.ContainsKey(record.OAI_Identifier)))
                        {
                            // Use the existing BibId from the previous mapping
                            bibPackage.BibID = oai_objectid_mapping[record.OAI_Identifier];
                        }
                        else
                        {
                            // Determine the next BibID to be assigned
                            string next_bibid = next_bibid_counter.ToString();
                            next_bibid_counter++;
                            bibPackage.BibID = (bibid_start + next_bibid.PadLeft(10 - bibid_start.Length, '0')).ToUpper();

                            // Save this mapping to the dictionary
                            oai_objectid_mapping[record.OAI_Identifier] = bibPackage.BibID;
                        }

                        // Set some values
                        bibPackage.METS_Header.Creator_Organization = bibPackage.Bib_Info.Source.Code + "," + bibPackage.Bib_Info.Source.Statement;
                        if (MetaTemplate_UserSettings.AddOns_Enabled.Contains("FCLA"))
                        {
                            PALMM_Info palmmInfo =
                                bibPackage.Get_Metadata_Module(GlobalVar.PALMM_METADATA_MODULE_KEY) as PALMM_Info;
                            if (palmmInfo == null)
                            {
                                palmmInfo = new PALMM_Info();
                                bibPackage.Add_Metadata_Module(GlobalVar.PALMM_METADATA_MODULE_KEY, palmmInfo);
                            }

                            if ((palmmInfo.toPALMM) && (palmmInfo.PALMM_Project.Length > 0))
                            {
                                string creator_org_to_remove = String.Empty;
                                foreach (string thisString in bibPackage.METS_Header.Creator_Org_Notes)
                                {
                                    if (thisString.IndexOf("projects=") >= 0)
                                    {
                                        creator_org_to_remove = thisString;
                                        break;
                                    }
                                }
                                if (creator_org_to_remove.Length > 0)
                                {
                                    bibPackage.METS_Header.Replace_Creator_Org_Notes(creator_org_to_remove,
                                                                                     "projects=" + palmmInfo.PALMM_Project);
                                }
                                else
                                {
                                    bibPackage.METS_Header.Add_Creator_Org_Notes("projects=" + palmmInfo.PALMM_Project);
                                }
                            }
                        }

                        // Determine the filename
                        string mets_file = destination_folder + "\\" + bibPackage.BibID + "_" + bibPackage.VID + MetaTemplate_UserSettings.METS_File_Extension;

                        // Save the actual file
                        METS_File_ReaderWriter metsWriter = new METS_File_ReaderWriter();
                        string writing_error = String.Empty;
                        metsWriter.Write_Metadata(mets_file, bibPackage, null, out writing_error);

                        // Increment progress
                        recordsProcessed++;
                        OnNewProgress(recordsProcessed, total_count);
                    }

                    // If there was a resumption token, pull the next set of records from the repository
                    if (String.IsNullOrEmpty(records.Resumption_Token))
                    {
                        records = null;
                    }
                    else
                    {
                        records = OAI_Repository_Stream_Reader.List_Records(repository.Harvested_URL, records.Resumption_Token);
                    }
                }
            }
            catch (Exception ee)
            {
                Debug.WriteLine(ee.Message);
                OnComplete(recordsProcessed, OAI_PMH_Importer_Error_Enum.Unknown_error_while_processing_feed);
            }

            // Now, save this mapping
            if (mapping_directory.Length > 0)
            {
                try
                {
                    // Ensure the directory exists
                    if (!Directory.Exists(mapping_directory))
                    {
                        Directory.CreateDirectory(mapping_directory);
                    }

                    // Create the dataset/table with the new mappings (includes old if one was found)
                    DataSet   mappingSet2  = new DataSet("SobekCM_METS_Editor_OAI_Mapping");
                    DataTable mappingTable = new DataTable("OAI_ObjectID_Map");
                    mappingSet2.Tables.Add(mappingTable);
                    mappingTable.Columns.Add("OAI_Identifier");
                    mappingTable.Columns.Add("SobekCM_ObjectID");

                    // Copy over the data into the new datatable
                    foreach (string thisKey in oai_objectid_mapping.Keys)
                    {
                        DataRow newRow = mappingTable.NewRow();
                        newRow[0] = thisKey;
                        newRow[1] = oai_objectid_mapping[thisKey];
                        mappingTable.Rows.Add(newRow);
                    }

                    // Write the mappings as the dataset in XML format
                    mappingSet2.WriteXml(mappings_file, XmlWriteMode.WriteSchema);
                }
                catch (Exception ee)
                {
                    Debug.WriteLine(ee.Message);
                    OnComplete(recordsProcessed, OAI_PMH_Importer_Error_Enum.Unable_to_save_mappings_file);
                }
            }

            // Process complete!
            OnComplete(recordsProcessed, OAI_PMH_Importer_Error_Enum.NO_ERROR);
        }
예제 #28
0
        /// <summary> Create a test digital resource item  </summary>
        /// <param name="directory">Directory for the package source directory</param>
        /// <returns>Fully built test bib package</returns>
        public static SobekCM_Item Create(string directory)
        {
            SobekCM_Item testPackage = new SobekCM_Item();

            // Add all the METS header information
            testPackage.METS_Header.Create_Date        = new DateTime(2007, 1, 1);
            testPackage.METS_Header.Modify_Date        = DateTime.Now;
            testPackage.METS_Header.Creator_Individual = "Mark Sullivan";
            testPackage.METS_Header.Add_Creator_Individual_Notes("Programmer of new SobekCM.Resource_Object");
            testPackage.METS_Header.Add_Creator_Individual_Notes("Adding coordinates");
            testPackage.METS_Header.Creator_Organization = "University of Florida";
            testPackage.METS_Header.Creator_Software     = "SobekCM Bib Package Test";
            testPackage.METS_Header.RecordStatus_Enum    = METS_Record_Status.COMPLETE;
            testPackage.METS_Header.Add_Creator_Org_Notes("This test package was done to test DLCs new METS package");

            // Add all the MODS elements
            Abstract_Info testAbstract = testPackage.Bib_Info.Add_Abstract("This is a sample abstract", "en");

            testPackage.Bib_Info.Add_Abstract("Tämä on esimerkki abstrakteja", "fin");
            testAbstract.Display_Label = "Summary Abstract";
            testAbstract.Type          = "summary";

            testPackage.Bib_Info.Access_Condition.Text          = "All rights are reserved by source institution.";
            testPackage.Bib_Info.Access_Condition.Language      = "en";
            testPackage.Bib_Info.Access_Condition.Type          = "restrictions on use";
            testPackage.Bib_Info.Access_Condition.Display_Label = "Rights";

            testPackage.Bib_Info.Add_Identifier("000123234", "OCLC", "Electronic OCLC");
            testPackage.Bib_Info.Add_Identifier("182-asdsd-28k", "DOI");

            testPackage.Bib_Info.Add_Language("English", String.Empty, "en");
            testPackage.Bib_Info.Add_Language("Finnish");
            testPackage.Bib_Info.Add_Language(String.Empty, "ita", String.Empty);

            testPackage.Bib_Info.Location.Holding_Code            = "MVS";
            testPackage.Bib_Info.Location.Holding_Name            = "From the Private Library of Mark Sullivan";
            testPackage.Bib_Info.Location.PURL                    = "http://www.uflib.ufl.edu/ufdc/?b=CA00000000";
            testPackage.Bib_Info.Location.Other_URL               = "http://www.fnhm.edu";
            testPackage.Bib_Info.Location.Other_URL_Display_Label = "Specimen Information";
            testPackage.Bib_Info.Location.Other_URL_Note          = "Specimen FLAS 125342 Database";
            testPackage.Bib_Info.Location.EAD_URL                 = "http://digital.uflib.ufl.edu/";
            testPackage.Bib_Info.Location.EAD_Name                = "Digital Library Center Finding Guide";

            testPackage.Bib_Info.Main_Entity_Name.Name_Type        = Name_Info_Type_Enum.personal;
            testPackage.Bib_Info.Main_Entity_Name.Full_Name        = "Brown, B.F.";
            testPackage.Bib_Info.Main_Entity_Name.Terms_Of_Address = "Dr.";
            testPackage.Bib_Info.Main_Entity_Name.Display_Form     = "B.F. Brown";
            testPackage.Bib_Info.Main_Entity_Name.Affiliation      = "Chemistry Dept., American University";
            testPackage.Bib_Info.Main_Entity_Name.Description      = "Chemistry Professor Emeritus";
            testPackage.Bib_Info.Main_Entity_Name.Add_Role("Author");

            Zoological_Taxonomy_Info taxonInfo = new Zoological_Taxonomy_Info();

            testPackage.Add_Metadata_Module(GlobalVar.ZOOLOGICAL_TAXONOMY_METADATA_MODULE_KEY, taxonInfo);
            taxonInfo.Scientific_Name       = "Ctenomys sociabilis";
            taxonInfo.Higher_Classification = "Animalia; Chordata; Vertebrata; Mammalia; Theria; Eutheria; Rodentia; Hystricognatha; Hystricognathi; Ctenomyidae; Ctenomyini; Ctenomys";
            taxonInfo.Kingdom          = "Animalia";
            taxonInfo.Phylum           = "Chordata";
            taxonInfo.Class            = "Mammalia";
            taxonInfo.Order            = "Rodentia";
            taxonInfo.Family           = "Ctenomyidae";
            taxonInfo.Genus            = "Ctenomys";
            taxonInfo.Specific_Epithet = "sociabilis";
            taxonInfo.Taxonomic_Rank   = "species";
            taxonInfo.Common_Name      = "Social Tuco-Tuco";

            Name_Info name1 = new Name_Info();

            name1.Name_Type        = Name_Info_Type_Enum.personal;
            name1.Given_Name       = "John Paul";
            name1.Terms_Of_Address = "Pope; II";
            name1.Dates            = "1920-2002";
            name1.User_Submitted   = true;
            testPackage.Bib_Info.Add_Named_Entity(name1);

            Name_Info name2 = new Name_Info();

            name2.Name_Type = Name_Info_Type_Enum.conference;
            name2.Full_Name = "Paris Peace Conference (1919-1920)";
            name2.Dates     = "1919-1920";
            testPackage.Bib_Info.Add_Named_Entity(name2);

            Name_Info name3 = new Name_Info();

            name3.Name_Type = Name_Info_Type_Enum.corporate;
            name3.Full_Name = "United States -- Court of Appeals (2nd Court)";
            testPackage.Bib_Info.Add_Named_Entity(name3);

            Name_Info name4 = new Name_Info();

            name4.Name_Type        = Name_Info_Type_Enum.personal;
            name4.Full_Name        = "Wilson, Mary";
            name4.Display_Form     = "Mary 'Weels' Wilson";
            name4.Given_Name       = "Mary";
            name4.Family_Name      = "Wilson";
            name4.ID               = "NAM4";
            name4.Terms_Of_Address = "2nd";
            name4.Add_Role("illustrator");
            name4.Add_Role("cartographer");
            testPackage.Bib_Info.Add_Named_Entity(name4);

            Name_Info donor = new Name_Info();

            donor.Name_Type        = Name_Info_Type_Enum.personal;
            donor.Full_Name        = "Livingston, Arthur";
            donor.Description      = "Gift in honor of Arthur Livingston";
            donor.Terms_Of_Address = "3rd";
            donor.Add_Role("honoree", String.Empty);
            testPackage.Bib_Info.Donor = donor;

            testPackage.Bib_Info.Main_Title.NonSort  = "The ";
            testPackage.Bib_Info.Main_Title.Title    = "Man Who Would Be King";
            testPackage.Bib_Info.Main_Title.Subtitle = "The story of succession in England";

            Title_Info title1 = new Title_Info("homme qui voulut être roi", Title_Type_Enum.translated);

            title1.NonSort  = "L'";
            title1.Language = "fr";
            testPackage.Bib_Info.Add_Other_Title(title1);

            Title_Info title2 = new Title_Info();

            title2.Title         = "Man Who Be King";
            title2.Display_Label = "also known as";
            title2.NonSort       = "The";
            title2.Title_Type    = Title_Type_Enum.alternative;
            testPackage.Bib_Info.Add_Other_Title(title2);

            Title_Info title3 = new Title_Info();

            title3.Title     = "Great works of England";
            title3.Authority = "naf";
            title3.Add_Part_Name("Second Portion");
            title3.Add_Part_Number("2nd");
            title3.Title_Type     = Title_Type_Enum.uniform;
            title3.User_Submitted = true;
            testPackage.Bib_Info.Add_Other_Title(title3);

            testPackage.Bib_Info.Add_Note("Funded by the NEH", Note_Type_Enum.funding);
            testPackage.Bib_Info.Add_Note("Based on a play which originally appeared in France as \"Un peu plus tard, un peu plus tôt\"").User_Submitted = true;
            testPackage.Bib_Info.Add_Note("Anne Baxter (Louise), Maria Perschy (Angela), Gustavo Rojo (Bill), Reginald Gilliam (Mr. Johnson), [Catherine Elliot?] (Aunt Sallie), Ben Tatar (waiter)", Note_Type_Enum.performers, "Performed By");

            testPackage.Bib_Info.Origin_Info.Add_Place("New York", "nyu", "usa");
            testPackage.Bib_Info.Origin_Info.Date_Issued           = "1992";
            testPackage.Bib_Info.Origin_Info.MARC_DateIssued_Start = "1992";
            testPackage.Bib_Info.Origin_Info.MARC_DateIssued_End   = "1993";
            testPackage.Bib_Info.Origin_Info.Date_Copyrighted      = "1999";
            testPackage.Bib_Info.Origin_Info.Edition = "2nd";

            Publisher_Info newPub = testPackage.Bib_Info.Add_Publisher("Published for the American Vacuum Society by the American Institute of Physics");

            newPub.Add_Place("New York, New York");
            newPub.User_Submitted = true;
            testPackage.Bib_Info.Add_Publisher("University of Florida Press House").Add_Place("Gainesville, FL");
            testPackage.Bib_Info.Add_Manufacturer("Addison Randly Publishing House");

            testPackage.Bib_Info.Original_Description.Extent = "1 sound disc (56 min.) : digital ; 3/4 in.";
            testPackage.Bib_Info.Original_Description.Add_Note("The sleeve of this sound disc was damaged in a fire");
            testPackage.Bib_Info.Original_Description.Add_Note("The disc has a moderate amount of scratches, but still plays");

            testPackage.Bib_Info.Series_Part_Info.Day         = "18";
            testPackage.Bib_Info.Series_Part_Info.Day_Index   = 18;
            testPackage.Bib_Info.Series_Part_Info.Month       = "Syyskuu";
            testPackage.Bib_Info.Series_Part_Info.Month_Index = 9;
            testPackage.Bib_Info.Series_Part_Info.Year        = "1992";
            testPackage.Bib_Info.Series_Part_Info.Year_Index  = 1992;

            testPackage.Bib_Info.Series_Part_Info.Enum1       = "Volume 12";
            testPackage.Bib_Info.Series_Part_Info.Enum1_Index = 12;
            testPackage.Bib_Info.Series_Part_Info.Enum2       = "Issue 3";
            testPackage.Bib_Info.Series_Part_Info.Enum2_Index = 3;
            testPackage.Bib_Info.Series_Part_Info.Enum3       = "Part 1";
            testPackage.Bib_Info.Series_Part_Info.Enum3_Index = 1;

            testPackage.Behaviors.Serial_Info.Add_Hierarchy(1, 1992, "1992");
            testPackage.Behaviors.Serial_Info.Add_Hierarchy(2, 9, "Syyskuu");
            testPackage.Behaviors.Serial_Info.Add_Hierarchy(3, 18, "18");

            testPackage.Bib_Info.SeriesTitle.Title = "Shakespeare's most famous musicals";

            testPackage.Bib_Info.Add_Target_Audience("young adults");
            testPackage.Bib_Info.Add_Target_Audience("adolescent", "marctarget");

            testPackage.Bib_Info.SobekCM_Type = TypeOfResource_SobekCM_Enum.Newspaper;

            // Add cartographic subject
            Subject_Info_Cartographics newCartographics = testPackage.Bib_Info.Add_Cartographics_Subject();

            newCartographics.Scale       = "1:2000";
            newCartographics.Projection  = "Conical Projection";
            newCartographics.Coordinates = "E 72°--E 148°/N 13°--N 18°";

            // Add hierarchical geographic subject
            Subject_Info_HierarchicalGeographic hierarchical = testPackage.Bib_Info.Add_Hierarchical_Geographic_Subject();

            hierarchical.Continent = "North America";
            hierarchical.Country   = "United States of America";
            hierarchical.State     = "Kansas";
            hierarchical.County    = "Butler";
            hierarchical.City      = "Augusta";

            // Add hierarchical geographic subject
            Subject_Info_HierarchicalGeographic hierarchical2 = testPackage.Bib_Info.Add_Hierarchical_Geographic_Subject();

            hierarchical2.Region = "Arctic Ocean";

            // Add hierarchical geographic subject
            Subject_Info_HierarchicalGeographic hierarchical3 = testPackage.Bib_Info.Add_Hierarchical_Geographic_Subject();

            hierarchical3.Island    = "Puerto Rico";
            hierarchical3.Language  = "English";
            hierarchical3.Province  = "Provincial";
            hierarchical3.Territory = "Puerto Rico";
            hierarchical3.Area      = "Intercontinental areas (Western Hemisphere)";

            // Add a name subject
            Subject_Info_Name subjname1 = testPackage.Bib_Info.Add_Name_Subject();

            subjname1.Authority = "lcsh";
            subjname1.Full_Name = "Garcia Lorca, Federico";
            subjname1.Dates     = "1898-1936";
            subjname1.Add_Geographic("Russia");
            subjname1.Add_Geographic("Moscow");
            subjname1.Add_Genre("maps");
            subjname1.User_Submitted = true;

            // Add a title information subject
            Subject_Info_TitleInfo subjtitle1 = testPackage.Bib_Info.Add_Title_Subject();

            subjtitle1.Title_Type = Title_Type_Enum.uniform;
            subjtitle1.Authority  = "naf";
            subjtitle1.Title      = "Missale Carnotense";

            // Add a standard subject
            Subject_Info_Standard subject1 = testPackage.Bib_Info.Add_Subject();

            subject1.Authority = "lcsh";
            subject1.Add_Topic("Real property");
            subject1.Add_Geographic("Mississippi");
            subject1.Add_Geographic("Tippah County");
            subject1.Add_Genre("Maps");


            // Add a standard subject
            Subject_Info_Standard subject2 = testPackage.Bib_Info.Add_Subject();

            subject2.Add_Occupation("Migrant laborers");
            subject2.Add_Genre("School district case files");

            // Add a standard subject
            Subject_Info_Standard subject3 = testPackage.Bib_Info.Add_Subject();

            subject3.Authority = "lctgm";
            subject3.Add_Topic("Educational buildings");
            subject3.Add_Geographic("Washington (D.C.)");
            subject3.Add_Temporal("1890-1910");

            // Add a standard subject
            Subject_Info_Standard subject4 = testPackage.Bib_Info.Add_Subject();

            subject4.Authority = "rvm";
            subject4.Language  = "french";
            subject4.Add_Topic("Église catholique");
            subject4.Add_Topic("Histoire");
            subject4.Add_Temporal("20e siècle");

            // Add record information
            testPackage.Bib_Info.Record.Add_Catalog_Language(new Language_Info("English", "eng", "en"));
            testPackage.Bib_Info.Record.Add_Catalog_Language(new Language_Info("French", "fre", "fr"));
            testPackage.Bib_Info.Record.MARC_Creation_Date = "080303";
            testPackage.Bib_Info.Record.Add_MARC_Record_Content_Sources("FUG");
            testPackage.Bib_Info.Record.Record_Origin = "Imported from (OCLC)001213124";


            // Test the items which are in the non-MODS portion of the Bib_Info object
            testPackage.BibID              = "MVS0000001";
            testPackage.VID                = "00001";
            testPackage.Bib_Info.SortDate  = 1234;
            testPackage.Bib_Info.SortTitle = "MAN WHO WOULD BE KING";
            testPackage.Bib_Info.Add_Temporal_Subject(1990, 2002, "Recent history");
            testPackage.Bib_Info.Add_Temporal_Subject(1990, 2002, "Lähihistoria");
            testPackage.Bib_Info.Source.Code      = "UF";
            testPackage.Bib_Info.Source.Statement = "University of Florida";

            // Add an affiliation
            Affiliation_Info affiliation1 = new Affiliation_Info();

            affiliation1.University     = "University of Florida";
            affiliation1.Campus         = "Gainesville Campus";
            affiliation1.College        = "College of Engineering";
            affiliation1.Department     = "Computer Engineering Department";
            affiliation1.Unit           = "Robotics";
            affiliation1.Name_Reference = "NAM4";
            testPackage.Bib_Info.Add_Affiliation(affiliation1);

            // Add a related item
            Related_Item_Info relatedItem1 = new Related_Item_Info();

            relatedItem1.SobekCM_ID   = "UF00001234";
            relatedItem1.Relationship = Related_Item_Type_Enum.preceding;
            relatedItem1.Publisher    = "Gainesville Sun Publishing House";
            relatedItem1.Add_Note(new Note_Info("Digitized with funding from NEH", Note_Type_Enum.funding));
            relatedItem1.Add_Note(new Note_Info("Gainesville Bee was the precursor to this item"));
            relatedItem1.Main_Title.NonSort = "The";
            relatedItem1.Main_Title.Title   = "Gainesville Bee";
            relatedItem1.Add_Identifier("01234353", "oclc");
            relatedItem1.Add_Identifier("002232311", "aleph");
            Name_Info ri_name = new Name_Info();

            ri_name.Full_Name        = "Hills, Bryan";
            ri_name.Terms_Of_Address = "Mr.";
            ri_name.Name_Type        = Name_Info_Type_Enum.personal;
            ri_name.Add_Role("author");
            relatedItem1.Add_Name(ri_name);
            relatedItem1.URL = @"http://www.uflib.ufl.edu/ufdc/?b=UF00001234";
            relatedItem1.URL_Display_Label = "Full Text";
            testPackage.Bib_Info.Add_Related_Item(relatedItem1);

            // Add another related item
            Related_Item_Info relatedItem2 = new Related_Item_Info();

            relatedItem2.Relationship       = Related_Item_Type_Enum.succeeding;
            relatedItem2.SobekCM_ID         = "UF00009999";
            relatedItem2.Main_Title.NonSort = "The";
            relatedItem2.Main_Title.Title   = "Daily Sun";
            relatedItem2.Add_Identifier("0125437", "oclc");
            relatedItem2.Add_Note("Name change occured in Fall 1933");
            relatedItem2.Start_Date = "Fall 1933";
            relatedItem2.End_Date   = "December 31, 1945";
            testPackage.Bib_Info.Add_Related_Item(relatedItem2);

            // Add some processing parameters
            testPackage.Behaviors.Add_Aggregation("JUV");
            testPackage.Behaviors.Add_Aggregation("DLOC");
            testPackage.Behaviors.Add_Aggregation("DLOSA1");
            testPackage.Behaviors.Add_Aggregation("ALICE");
            testPackage.Behaviors.Add_Aggregation("ARTE");

            testPackage.Web.GUID = "GUID!";
            testPackage.Behaviors.Add_Wordmark("DLOC");
            testPackage.Behaviors.Add_Wordmark("UFSPEC");
            testPackage.Behaviors.Main_Thumbnail = "00001thm.jpg";

            // Add some downloads
            testPackage.Divisions.Download_Tree.Add_File("MVS_Complete.PDF");
            testPackage.Divisions.Download_Tree.Add_File("MVS_Complete.MP2");
            testPackage.Divisions.Download_Tree.Add_File("MVS_Part1.MP2");
            testPackage.Divisions.Download_Tree.Add_File("MVS_Part1.PDF");

            // Add some coordinate information
            GeoSpatial_Information geoSpatial = new GeoSpatial_Information();

            testPackage.Add_Metadata_Module(GlobalVar.GEOSPATIAL_METADATA_MODULE_KEY, geoSpatial);
            geoSpatial.Add_Point(29.530151, -82.301459, "Lake Wauberg");
            geoSpatial.Add_Point(29.634352, -82.350640, "Veterinary School");
            Coordinate_Polygon polygon = new Coordinate_Polygon();

            polygon.Label = "University of Florida Campus";
            polygon.Add_Edge_Point(new Coordinate_Point(29.651435, -82.339869, String.Empty));
            polygon.Add_Edge_Point(new Coordinate_Point(29.641216, -82.340298, String.Empty));
            polygon.Add_Edge_Point(new Coordinate_Point(29.629503, -82.371969, String.Empty));
            polygon.Add_Edge_Point(new Coordinate_Point(29.649645, -82.371712, String.Empty));
            polygon.Add_Inner_Point(29.649794, -82.351971, "Stadium");
            polygon.Add_Inner_Point(29.650988, -82.341156, "Library");
            geoSpatial.Add_Polygon(polygon);
            Coordinate_Line line = new Coordinate_Line();

            line.Label = "Waldo Road";
            line.Add_Point(29.652852, -82.310944, "Gainesville");
            line.Add_Point(29.716681, -82.268372, String.Empty);
            line.Add_Point(29.791494, -82.167778, "Waldo");
            geoSpatial.Add_Line(line);


            // Add some performing arts information
            Performing_Arts_Info partInfo = new Performing_Arts_Info();

            testPackage.Add_Metadata_Module("PerformingArts", partInfo);
            partInfo.Performance      = "Hamlet";
            partInfo.Performance_Date = "August 12, 1923";
            Performer performer1 = partInfo.Add_Performer("Sullivan, Mark");

            performer1.Sex        = "M";
            performer1.LifeSpan   = "1873-";
            performer1.Occupation = "actor";
            performer1.Title      = "Mr.";

            Performer performer2 = partInfo.Add_Performer("Waldbart, Julia");

            performer2.Sex        = "F";
            performer2.LifeSpan   = "1876-";
            performer2.Occupation = "actress";
            performer2.Title      = "Mrs.";

            // Add some oral history information
            Oral_Interview_Info oralInfo = new Oral_Interview_Info();

            testPackage.Add_Metadata_Module("OralInterview", oralInfo);
            oralInfo.Interviewee = "Edwards, Herm";
            oralInfo.Interviewer = "Proctor, Samual";

            // Add some learning object resource information
            LearningObjectMetadata lomInfo = new LearningObjectMetadata();

            testPackage.Add_Metadata_Module(GlobalVar.IEEE_LOM_METADATA_MODULE_KEY, lomInfo);
            lomInfo.AggregationLevel = AggregationLevelEnum.level3;
            lomInfo.Status           = StatusEnum.draft;
            LOM_System_Requirements lomReq1 = new LOM_System_Requirements();

            lomReq1.RequirementType = RequirementTypeEnum.operating_system;
            lomReq1.Name.Value      = "Windows";
            lomReq1.MinimumVersion  = "Windows XP";
            lomReq1.MaximumVersion  = "Windows 7";
            lomInfo.Add_SystemRequirements(lomReq1);
            LOM_System_Requirements lomReq2 = new LOM_System_Requirements();

            lomReq2.RequirementType = RequirementTypeEnum.software;
            lomReq2.Name.Value      = "Java SDK";
            lomReq2.MinimumVersion  = "1.7.1";
            lomReq2.MaximumVersion  = "2.09";
            lomInfo.Add_SystemRequirements(lomReq2);
            lomInfo.InteractivityType = InteractivityTypeEnum.mixed;
            lomInfo.Add_LearningResourceType("exercise");
            lomInfo.Add_LearningResourceType("Tutorials", "encdlwebpedagogicaltype");
            lomInfo.InteractivityLevel = InteractivityLevelEnum.high;
            lomInfo.Add_IntendedEndUserRole(IntendedEndUserRoleEnum.learner);
            lomInfo.Add_Context("Undergraduate lower division", "enclearningcontext");
            lomInfo.Add_Context("15", "grade");
            lomInfo.Add_Context("16", "grade");
            lomInfo.Add_Context("5", "group");
            lomInfo.Add_TypicalAgeRange("suitable for children over 7", "en");
            lomInfo.Add_TypicalAgeRange("2-8");
            lomInfo.DifficultyLevel     = DifficultyLevelEnum.medium;
            lomInfo.TypicalLearningTime = "PT45M";

            LOM_Classification lomClassification1 = new LOM_Classification();

            lomInfo.Add_Classification(lomClassification1);
            lomClassification1.Purpose.Value = "Discipline";
            LOM_TaxonPath lomTaxonPath1 = new LOM_TaxonPath();

            lomClassification1.Add_TaxonPath(lomTaxonPath1);
            lomTaxonPath1.Add_SourceName("ARIADNE");
            LOM_Taxon lomTaxon1 = new LOM_Taxon();

            lomTaxonPath1.Add_Taxon(lomTaxon1);
            lomTaxon1.ID = "BF120";
            lomTaxon1.Add_Entry("Work_History", "en");
            lomTaxon1.Add_Entry("Historie", "nl");
            LOM_Taxon lomTaxon2 = new LOM_Taxon();

            lomTaxonPath1.Add_Taxon(lomTaxon2);
            lomTaxon2.ID = "BF120.1";
            lomTaxon2.Add_Entry("American Work_History", "en");
            LOM_Taxon lomTaxon3 = new LOM_Taxon();

            lomTaxonPath1.Add_Taxon(lomTaxon3);
            lomTaxon3.ID = "BF120.1.4";
            lomTaxon3.Add_Entry("American Civil War", "en");

            LOM_Classification lomClassification2 = new LOM_Classification();

            lomInfo.Add_Classification(lomClassification2);
            lomClassification2.Purpose.Value = "Educational Objective";

            LOM_TaxonPath lomTaxonPath2 = new LOM_TaxonPath();

            lomClassification2.Add_TaxonPath(lomTaxonPath2);
            lomTaxonPath2.Add_SourceName("Common Core Standards", "en");
            LOM_Taxon lomTaxon4 = new LOM_Taxon();

            lomTaxonPath2.Add_Taxon(lomTaxon4);
            lomTaxon4.ID = "CCS.Math.Content";
            LOM_Taxon lomTaxon5 = new LOM_Taxon();

            lomTaxonPath2.Add_Taxon(lomTaxon5);
            lomTaxon5.ID = "3";
            lomTaxon5.Add_Entry("Grade 3", "en");
            LOM_Taxon lomTaxon6 = new LOM_Taxon();

            lomTaxonPath2.Add_Taxon(lomTaxon6);
            lomTaxon6.ID = "OA";
            lomTaxon6.Add_Entry("Operations and Algebraic Thinking", "en");
            LOM_Taxon lomTaxon7 = new LOM_Taxon();

            lomTaxonPath2.Add_Taxon(lomTaxon7);
            lomTaxon7.ID = "A";
            lomTaxon7.Add_Entry("Represent and solve problems involving multiplication and division.", "en");
            LOM_Taxon lomTaxon8 = new LOM_Taxon();

            lomTaxonPath2.Add_Taxon(lomTaxon8);
            lomTaxon8.ID = "3";
            lomTaxon8.Add_Entry("Use multiplication and division within 100 to solve word problems in situations involving equal groups, arrays, and measurement quantities, e.g., by using drawings and equations with a symbol for the unknown number to represent the problem.", "en");

            LOM_TaxonPath lomTaxonPath3 = new LOM_TaxonPath();

            lomClassification2.Add_TaxonPath(lomTaxonPath3);
            lomTaxonPath3.Add_SourceName("Common Core Standards", "en");
            LOM_Taxon lomTaxon14 = new LOM_Taxon();

            lomTaxonPath3.Add_Taxon(lomTaxon14);
            lomTaxon14.ID = "CCS.Math.Content";
            LOM_Taxon lomTaxon15 = new LOM_Taxon();

            lomTaxonPath3.Add_Taxon(lomTaxon15);
            lomTaxon15.ID = "3";
            lomTaxon15.Add_Entry("Grade 3", "en");
            LOM_Taxon lomTaxon16 = new LOM_Taxon();

            lomTaxonPath3.Add_Taxon(lomTaxon16);
            lomTaxon16.ID = "OA";
            lomTaxon16.Add_Entry("Operations and Algebraic Thinking", "en");
            LOM_Taxon lomTaxon17 = new LOM_Taxon();

            lomTaxonPath3.Add_Taxon(lomTaxon17);
            lomTaxon17.ID = "A";
            lomTaxon17.Add_Entry("Represent and solve problems involving multiplication and division.", "en");
            LOM_Taxon lomTaxon18 = new LOM_Taxon();

            lomTaxonPath3.Add_Taxon(lomTaxon18);
            lomTaxon18.ID = "4";
            lomTaxon18.Add_Entry("Determine the unknown whole number in a multiplication or division equation relating three whole numbers. For example, determine the unknown number that makes the equation true in each of the equations 8 × ? = 48, 5 = _ ÷ 3, 6 × 6 = ?", "en");


            // Add some views and interfaces
            testPackage.Behaviors.Clear_Web_Skins();
            testPackage.Behaviors.Add_Web_Skin("dLOC");
            testPackage.Behaviors.Add_Web_Skin("UFDC");
            testPackage.Behaviors.Add_View(View_Enum.JPEG2000);
            testPackage.Behaviors.Add_View(View_Enum.JPEG);
            testPackage.Behaviors.Add_View(View_Enum.RELATED_IMAGES);
            testPackage.Behaviors.Add_View(View_Enum.HTML, "Full Document", "MVS001214.html");

            // Create the chapters and pages and link them
            Division_TreeNode chapter1 = new Division_TreeNode("Chapter", "First Chapter");
            Page_TreeNode     page1    = new Page_TreeNode("First Page");
            Page_TreeNode     page2    = new Page_TreeNode("Page 2");

            chapter1.Nodes.Add(page1);
            chapter1.Nodes.Add(page2);
            Division_TreeNode chapter2 = new Division_TreeNode("Chapter", "Last Chapter");
            Page_TreeNode     page3    = new Page_TreeNode("Page 3");
            Page_TreeNode     page4    = new Page_TreeNode("Last Page");

            chapter2.Nodes.Add(page3);
            chapter2.Nodes.Add(page4);
            testPackage.Divisions.Physical_Tree.Roots.Add(chapter1);
            testPackage.Divisions.Physical_Tree.Roots.Add(chapter2);

            // Create the files
            SobekCM_File_Info file1_1 = new SobekCM_File_Info("2000626_0001.jp2", 2120, 1100);
            SobekCM_File_Info file1_2 = new SobekCM_File_Info("2000626_0001.jpg", 630, 330);
            SobekCM_File_Info file1_3 = new SobekCM_File_Info("2000626_0001.tif");
            SobekCM_File_Info file2_1 = new SobekCM_File_Info("2000626_0002.jp2", 1754, 2453);
            SobekCM_File_Info file2_2 = new SobekCM_File_Info("2000626_0002.jpg", 630, 832);
            SobekCM_File_Info file2_3 = new SobekCM_File_Info("2000626_0002.tif");
            SobekCM_File_Info file3_1 = new SobekCM_File_Info("2000626_0003.jp2", 2321, 1232);
            SobekCM_File_Info file3_2 = new SobekCM_File_Info("2000626_0003.jpg", 630, 342);
            SobekCM_File_Info file3_3 = new SobekCM_File_Info("2000626_0003.tif");
            SobekCM_File_Info file4_1 = new SobekCM_File_Info("2000626_0004.jp2", 2145, 1024);
            SobekCM_File_Info file4_2 = new SobekCM_File_Info("2000626_0004.jpg", 630, 326);
            SobekCM_File_Info file4_3 = new SobekCM_File_Info("2000626_0004.tif");

            // Link the files to the pages
            page1.Files.Add(file1_1);
            page1.Files.Add(file1_2);
            page1.Files.Add(file1_3);
            page2.Files.Add(file2_1);
            page2.Files.Add(file2_2);
            page2.Files.Add(file2_3);
            page3.Files.Add(file3_1);
            page3.Files.Add(file3_2);
            page3.Files.Add(file3_3);
            page4.Files.Add(file4_1);
            page4.Files.Add(file4_2);
            page4.Files.Add(file4_3);

            // Add the DAITSS information
            DAITSS_Info daitssInfo = new DAITSS_Info();

            daitssInfo.Account    = "FTU";
            daitssInfo.SubAccount = "CLAS";
            daitssInfo.Project    = "UFDC";
            daitssInfo.toArchive  = true;
            testPackage.Add_Metadata_Module(GlobalVar.DAITSS_METADATA_MODULE_KEY, daitssInfo);

            PALMM_Info palmmInfo = new PALMM_Info();

            testPackage.Add_Metadata_Module("PALMM", palmmInfo);
            palmmInfo.toPALMM = false;

            // Save this package
            testPackage.Source_Directory = directory;
            return(testPackage);
        }
예제 #29
0
        /// <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
            RightsMD_Info rightsInfo = Return_Package.Get_Metadata_Module(GlobalVar.PALMM_RIGHTSMD_METADATA_MODULE_KEY) as RightsMD_Info;

            if (rightsInfo == null)
            {
                rightsInfo = new RightsMD_Info();
                Return_Package.Add_Metadata_Module(GlobalVar.PALMM_RIGHTSMD_METADATA_MODULE_KEY, rightsInfo);
            }

            // 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("rightsmd:") == 0)
                    {
                        name = name.Substring(9);
                    }

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

                    case "copyrightstatement":
                        Input_XmlReader.Read();
                        if ((Input_XmlReader.NodeType == XmlNodeType.Text) && (Input_XmlReader.Value.Trim().Length > 0))
                        {
                            rightsInfo.Copyright_Statement = Input_XmlReader.Value.Trim();
                        }
                        break;

                    case "accesscode":
                        Input_XmlReader.Read();
                        if ((Input_XmlReader.NodeType == XmlNodeType.Text) && (Input_XmlReader.Value.Trim().Length > 0))
                        {
                            rightsInfo.Access_Code = RightsMD_Info.AccessCode_Enum.NOT_SPECIFIED;
                            switch (Input_XmlReader.Value.Trim().ToLower())
                            {
                            case "public":
                                rightsInfo.Access_Code = RightsMD_Info.AccessCode_Enum.Public;
                                break;

                            case "private":
                                rightsInfo.Access_Code = RightsMD_Info.AccessCode_Enum.Private;
                                break;

                            case "campus":
                                rightsInfo.Access_Code = RightsMD_Info.AccessCode_Enum.Campus;
                                break;
                            }
                        }
                        break;

                    case "embargoend":
                        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))
                            {
                                rightsInfo.Embargo_End = convertedDate;
                            }
                        }
                        break;
                    }
                }
            } while (Input_XmlReader.Read());

            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 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> Create a test digital resource item  </summary>       
        /// <param name="directory">Directory for the package source directory</param>
        /// <returns>Fully built test bib package</returns>
        public static SobekCM_Item Create(string directory)
        {
            SobekCM_Item testPackage = new SobekCM_Item();

            // Add all the METS header information
            testPackage.METS_Header.Create_Date = new DateTime(2007, 1, 1);
            testPackage.METS_Header.Modify_Date = DateTime.Now;
            testPackage.METS_Header.Creator_Individual = "Mark Sullivan";
            testPackage.METS_Header.Add_Creator_Individual_Notes("Programmer of new SobekCM.Resource_Object");
            testPackage.METS_Header.Add_Creator_Individual_Notes("Adding coordinates");
            testPackage.METS_Header.Creator_Organization = "University of Florida";
            testPackage.METS_Header.Creator_Software = "SobekCM Bib Package Test";
            testPackage.METS_Header.RecordStatus_Enum = METS_Record_Status.COMPLETE;
            testPackage.METS_Header.Add_Creator_Org_Notes("This test package was done to test DLCs new METS package");

            // Add all the MODS elements
            Abstract_Info testAbstract = testPackage.Bib_Info.Add_Abstract("This is a sample abstract", "en");
            testPackage.Bib_Info.Add_Abstract("Tämä on esimerkki abstrakteja", "fin");
            testAbstract.Display_Label = "Summary Abstract";
            testAbstract.Type = "summary";

            testPackage.Bib_Info.Access_Condition.Text = "All rights are reserved by source institution.";
            testPackage.Bib_Info.Access_Condition.Language = "en";
            testPackage.Bib_Info.Access_Condition.Type = "restrictions on use";
            testPackage.Bib_Info.Access_Condition.Display_Label = "Rights";

            testPackage.Bib_Info.Add_Identifier("000123234", "OCLC", "Electronic OCLC");
            testPackage.Bib_Info.Add_Identifier("182-asdsd-28k", "DOI");

            testPackage.Bib_Info.Add_Language("English", String.Empty, "en");
            testPackage.Bib_Info.Add_Language("Finnish");
            testPackage.Bib_Info.Add_Language(String.Empty, "ita", String.Empty);

            testPackage.Bib_Info.Location.Holding_Code = "MVS";
            testPackage.Bib_Info.Location.Holding_Name = "From the Private Library of Mark Sullivan";
            testPackage.Bib_Info.Location.PURL = "http://www.uflib.ufl.edu/ufdc/?b=CA00000000";
            testPackage.Bib_Info.Location.Other_URL = "http://www.fnhm.edu";
            testPackage.Bib_Info.Location.Other_URL_Display_Label = "Specimen Information";
            testPackage.Bib_Info.Location.Other_URL_Note = "Specimen FLAS 125342 Database";
            testPackage.Bib_Info.Location.EAD_URL = "http://digital.uflib.ufl.edu/";
            testPackage.Bib_Info.Location.EAD_Name = "Digital Library Center Finding Guide";

            testPackage.Bib_Info.Main_Entity_Name.Name_Type = Name_Info_Type_Enum.Personal;
            testPackage.Bib_Info.Main_Entity_Name.Full_Name = "Brown, B.F.";
            testPackage.Bib_Info.Main_Entity_Name.Terms_Of_Address = "Dr.";
            testPackage.Bib_Info.Main_Entity_Name.Display_Form = "B.F. Brown";
            testPackage.Bib_Info.Main_Entity_Name.Affiliation = "Chemistry Dept., American University";
            testPackage.Bib_Info.Main_Entity_Name.Description = "Chemistry Professor Emeritus";
            testPackage.Bib_Info.Main_Entity_Name.Add_Role("Author");

            Zoological_Taxonomy_Info taxonInfo = new Zoological_Taxonomy_Info();
            testPackage.Add_Metadata_Module(GlobalVar.ZOOLOGICAL_TAXONOMY_METADATA_MODULE_KEY, taxonInfo);
            taxonInfo.Scientific_Name = "Ctenomys sociabilis";
            taxonInfo.Higher_Classification = "Animalia; Chordata; Vertebrata; Mammalia; Theria; Eutheria; Rodentia; Hystricognatha; Hystricognathi; Ctenomyidae; Ctenomyini; Ctenomys";
            taxonInfo.Kingdom = "Animalia";
            taxonInfo.Phylum = "Chordata";
            taxonInfo.Class = "Mammalia";
            taxonInfo.Order = "Rodentia";
            taxonInfo.Family = "Ctenomyidae";
            taxonInfo.Genus = "Ctenomys";
            taxonInfo.Specific_Epithet = "sociabilis";
            taxonInfo.Taxonomic_Rank = "species";
            taxonInfo.Common_Name = "Social Tuco-Tuco";

            Name_Info name1 = new Name_Info();
            name1.Name_Type = Name_Info_Type_Enum.Personal;
            name1.Given_Name = "John Paul";
            name1.Terms_Of_Address = "Pope; II";
            name1.Dates = "1920-2002";
            name1.User_Submitted = true;
            testPackage.Bib_Info.Add_Named_Entity(name1);

            Name_Info name2 = new Name_Info();
            name2.Name_Type = Name_Info_Type_Enum.Conference;
            name2.Full_Name = "Paris Peace Conference (1919-1920)";
            name2.Dates = "1919-1920";
            testPackage.Bib_Info.Add_Named_Entity(name2);

            Name_Info name3 = new Name_Info();
            name3.Name_Type = Name_Info_Type_Enum.Corporate;
            name3.Full_Name = "United States -- Court of Appeals (2nd Court)";
            testPackage.Bib_Info.Add_Named_Entity(name3);

            Name_Info name4 = new Name_Info();
            name4.Name_Type = Name_Info_Type_Enum.Personal;
            name4.Full_Name = "Wilson, Mary";
            name4.Display_Form = "Mary 'Weels' Wilson";
            name4.Given_Name = "Mary";
            name4.Family_Name = "Wilson";
            name4.ID = "NAM4";
            name4.Terms_Of_Address = "2nd";
            name4.Add_Role("illustrator");
            name4.Add_Role("cartographer");
            testPackage.Bib_Info.Add_Named_Entity(name4);

            Name_Info donor = new Name_Info();
            donor.Name_Type = Name_Info_Type_Enum.Personal;
            donor.Full_Name = "Livingston, Arthur";
            donor.Description = "Gift in honor of Arthur Livingston";
            donor.Terms_Of_Address = "3rd";
            donor.Add_Role("honoree", String.Empty);
            testPackage.Bib_Info.Donor = donor;

            testPackage.Bib_Info.Main_Title.NonSort = "The ";
            testPackage.Bib_Info.Main_Title.Title = "Man Who Would Be King";
            testPackage.Bib_Info.Main_Title.Subtitle = "The story of succession in England";

            Title_Info title1 = new Title_Info("homme qui voulut être roi", Title_Type_Enum.Translated);
            title1.NonSort = "L'";
            title1.Language = "fr";
            testPackage.Bib_Info.Add_Other_Title(title1);

            Title_Info title2 = new Title_Info();
            title2.Title = "Man Who Be King";
            title2.Display_Label = "also known as";
            title2.NonSort = "The";
            title2.Title_Type = Title_Type_Enum.Alternative;
            testPackage.Bib_Info.Add_Other_Title(title2);

            Title_Info title3 = new Title_Info();
            title3.Title = "Great works of England";
            title3.Authority = "naf";
            title3.Add_Part_Name("Second Portion");
            title3.Add_Part_Number("2nd");
            title3.Title_Type = Title_Type_Enum.Uniform;
            title3.User_Submitted = true;
            testPackage.Bib_Info.Add_Other_Title(title3);

            testPackage.Bib_Info.Add_Note("Funded by the NEH", Note_Type_Enum.Funding);
            testPackage.Bib_Info.Add_Note("Based on a play which originally appeared in France as \"Un peu plus tard, un peu plus tôt\"").User_Submitted = true;
            testPackage.Bib_Info.Add_Note("Anne Baxter (Louise), Maria Perschy (Angela), Gustavo Rojo (Bill), Reginald Gilliam (Mr. Johnson), [Catherine Elliot?] (Aunt Sallie), Ben Tatar (waiter)", Note_Type_Enum.Performers, "Performed By");

            testPackage.Bib_Info.Origin_Info.Add_Place("New York", "nyu", "usa");
            testPackage.Bib_Info.Origin_Info.Date_Issued = "1992";
            testPackage.Bib_Info.Origin_Info.MARC_DateIssued_Start = "1992";
            testPackage.Bib_Info.Origin_Info.MARC_DateIssued_End = "1993";
            testPackage.Bib_Info.Origin_Info.Date_Copyrighted = "1999";
            testPackage.Bib_Info.Origin_Info.Edition = "2nd";

            Publisher_Info newPub = testPackage.Bib_Info.Add_Publisher("Published for the American Vacuum Society by the American Institute of Physics");
            newPub.Add_Place("New York, New York");
            newPub.User_Submitted = true;
            testPackage.Bib_Info.Add_Publisher("University of Florida Press House").Add_Place("Gainesville, FL");
            testPackage.Bib_Info.Add_Manufacturer("Addison Randly Publishing House");

            testPackage.Bib_Info.Original_Description.Extent = "1 sound disc (56 min.) : digital ; 3/4 in.";
            testPackage.Bib_Info.Original_Description.Add_Note("The sleeve of this sound disc was damaged in a fire");
            testPackage.Bib_Info.Original_Description.Add_Note("The disc has a moderate amount of scratches, but still plays");

            testPackage.Bib_Info.Series_Part_Info.Day = "18";
            testPackage.Bib_Info.Series_Part_Info.Day_Index = 18;
            testPackage.Bib_Info.Series_Part_Info.Month = "Syyskuu";
            testPackage.Bib_Info.Series_Part_Info.Month_Index = 9;
            testPackage.Bib_Info.Series_Part_Info.Year = "1992";
            testPackage.Bib_Info.Series_Part_Info.Year_Index = 1992;

            testPackage.Bib_Info.Series_Part_Info.Enum1 = "Volume 12";
            testPackage.Bib_Info.Series_Part_Info.Enum1_Index = 12;
            testPackage.Bib_Info.Series_Part_Info.Enum2 = "Issue 3";
            testPackage.Bib_Info.Series_Part_Info.Enum2_Index = 3;
            testPackage.Bib_Info.Series_Part_Info.Enum3 = "Part 1";
            testPackage.Bib_Info.Series_Part_Info.Enum3_Index = 1;

            testPackage.Behaviors.Serial_Info.Add_Hierarchy(1, 1992, "1992");
            testPackage.Behaviors.Serial_Info.Add_Hierarchy(2, 9, "Syyskuu");
            testPackage.Behaviors.Serial_Info.Add_Hierarchy(3, 18, "18");

            testPackage.Bib_Info.SeriesTitle.Title = "Shakespeare's most famous musicals";

            testPackage.Bib_Info.Add_Target_Audience("young adults");
            testPackage.Bib_Info.Add_Target_Audience("adolescent", "marctarget");

            testPackage.Bib_Info.SobekCM_Type = TypeOfResource_SobekCM_Enum.Newspaper;

            // Add cartographic subject
            Subject_Info_Cartographics newCartographics = testPackage.Bib_Info.Add_Cartographics_Subject();
            newCartographics.Scale = "1:2000";
            newCartographics.Projection = "Conical Projection";
            newCartographics.Coordinates = "E 72°--E 148°/N 13°--N 18°";

            // Add hierarchical geographic subject
            Subject_Info_HierarchicalGeographic hierarchical = testPackage.Bib_Info.Add_Hierarchical_Geographic_Subject();
            hierarchical.Continent = "North America";
            hierarchical.Country = "United States of America";
            hierarchical.State = "Kansas";
            hierarchical.County = "Butler";
            hierarchical.City = "Augusta";

            // Add hierarchical geographic subject
            Subject_Info_HierarchicalGeographic hierarchical2 = testPackage.Bib_Info.Add_Hierarchical_Geographic_Subject();
            hierarchical2.Region = "Arctic Ocean";

            // Add hierarchical geographic subject
            Subject_Info_HierarchicalGeographic hierarchical3 = testPackage.Bib_Info.Add_Hierarchical_Geographic_Subject();
            hierarchical3.Island = "Puerto Rico";
            hierarchical3.Language = "English";
            hierarchical3.Province = "Provincial";
            hierarchical3.Territory = "Puerto Rico";
            hierarchical3.Area = "Intercontinental areas (Western Hemisphere)";

            // Add a name subject
            Subject_Info_Name subjname1 = testPackage.Bib_Info.Add_Name_Subject();
            subjname1.Authority = "lcsh";
            subjname1.Full_Name = "Garcia Lorca, Federico";
            subjname1.Dates = "1898-1936";
            subjname1.Add_Geographic("Russia");
            subjname1.Add_Geographic("Moscow");
            subjname1.Add_Genre("maps");
            subjname1.User_Submitted = true;

            // Add a title information subject
            Subject_Info_TitleInfo subjtitle1 = testPackage.Bib_Info.Add_Title_Subject();
            subjtitle1.Title_Type = Title_Type_Enum.Uniform;
            subjtitle1.Authority = "naf";
            subjtitle1.Title = "Missale Carnotense";

            // Add a standard subject
            Subject_Info_Standard subject1 = testPackage.Bib_Info.Add_Subject();
            subject1.Authority = "lcsh";
            subject1.Add_Topic("Real property");
            subject1.Add_Geographic("Mississippi");
            subject1.Add_Geographic("Tippah County");
            subject1.Add_Genre("Maps");

            // Add a standard subject
            Subject_Info_Standard subject2 = testPackage.Bib_Info.Add_Subject();
            subject2.Add_Occupation("Migrant laborers");
            subject2.Add_Genre("School district case files");

            // Add a standard subject
            Subject_Info_Standard subject3 = testPackage.Bib_Info.Add_Subject();
            subject3.Authority = "lctgm";
            subject3.Add_Topic("Educational buildings");
            subject3.Add_Geographic("Washington (D.C.)");
            subject3.Add_Temporal("1890-1910");

            // Add a standard subject
            Subject_Info_Standard subject4 = testPackage.Bib_Info.Add_Subject();
            subject4.Authority = "rvm";
            subject4.Language = "french";
            subject4.Add_Topic("Église catholique");
            subject4.Add_Topic("Histoire");
            subject4.Add_Temporal("20e siècle");

            // Add record information
            testPackage.Bib_Info.Record.Add_Catalog_Language(new Language_Info("English", "eng", "en"));
            testPackage.Bib_Info.Record.Add_Catalog_Language(new Language_Info("French", "fre", "fr"));
            testPackage.Bib_Info.Record.MARC_Creation_Date = "080303";
            testPackage.Bib_Info.Record.Add_MARC_Record_Content_Sources("FUG");
            testPackage.Bib_Info.Record.Record_Origin = "Imported from (OCLC)001213124";

            // Test the items which are in the non-MODS portion of the Bib_Info object
            testPackage.BibID = "MVS0000001";
            testPackage.VID = "00001";
            testPackage.Bib_Info.SortDate = 1234;
            testPackage.Bib_Info.SortTitle = "MAN WHO WOULD BE KING";
            testPackage.Bib_Info.Add_Temporal_Subject(1990, 2002, "Recent history");
            testPackage.Bib_Info.Add_Temporal_Subject(1990, 2002, "Lähihistoria");
            testPackage.Bib_Info.Source.Code = "UF";
            testPackage.Bib_Info.Source.Statement = "University of Florida";

            // Add an affiliation
            Affiliation_Info affiliation1 = new Affiliation_Info();
            affiliation1.University = "University of Florida";
            affiliation1.Campus = "Gainesville Campus";
            affiliation1.College = "College of Engineering";
            affiliation1.Department = "Computer Engineering Department";
            affiliation1.Unit = "Robotics";
            affiliation1.Name_Reference = "NAM4";
            testPackage.Bib_Info.Add_Affiliation(affiliation1);

            // Add a related item
            Related_Item_Info relatedItem1 = new Related_Item_Info();
            relatedItem1.SobekCM_ID = "UF00001234";
            relatedItem1.Relationship = Related_Item_Type_Enum.Preceding;
            relatedItem1.Publisher = "Gainesville Sun Publishing House";
            relatedItem1.Add_Note(new Note_Info("Digitized with funding from NEH", Note_Type_Enum.Funding));
            relatedItem1.Add_Note(new Note_Info("Gainesville Bee was the precursor to this item"));
            relatedItem1.Main_Title.NonSort = "The";
            relatedItem1.Main_Title.Title = "Gainesville Bee";
            relatedItem1.Add_Identifier("01234353", "oclc");
            relatedItem1.Add_Identifier("002232311", "aleph");
            Name_Info ri_name = new Name_Info();
            ri_name.Full_Name = "Hills, Bryan";
            ri_name.Terms_Of_Address = "Mr.";
            ri_name.Name_Type = Name_Info_Type_Enum.Personal;
            ri_name.Add_Role("author");
            relatedItem1.Add_Name(ri_name);
            relatedItem1.URL = @"http://www.uflib.ufl.edu/ufdc/?b=UF00001234";
            relatedItem1.URL_Display_Label = "Full Text";
            testPackage.Bib_Info.Add_Related_Item(relatedItem1);

            // Add another related item
            Related_Item_Info relatedItem2 = new Related_Item_Info();
            relatedItem2.Relationship = Related_Item_Type_Enum.Succeeding;
            relatedItem2.SobekCM_ID = "UF00009999";
            relatedItem2.Main_Title.NonSort = "The";
            relatedItem2.Main_Title.Title = "Daily Sun";
            relatedItem2.Add_Identifier("0125437", "oclc");
            relatedItem2.Add_Note("Name change occured in Fall 1933");
            relatedItem2.Start_Date = "Fall 1933";
            relatedItem2.End_Date = "December 31, 1945";
            testPackage.Bib_Info.Add_Related_Item(relatedItem2);

            // Add some processing parameters
            testPackage.Behaviors.Add_Aggregation("JUV");
            testPackage.Behaviors.Add_Aggregation("DLOC");
            testPackage.Behaviors.Add_Aggregation("DLOSA1");
            testPackage.Behaviors.Add_Aggregation("ALICE");
            testPackage.Behaviors.Add_Aggregation("ARTE");

            testPackage.Web.GUID = "GUID!";
            testPackage.Behaviors.Add_Wordmark("DLOC");
            testPackage.Behaviors.Add_Wordmark("UFSPEC");
            testPackage.Behaviors.Main_Thumbnail = "00001thm.jpg";

            // Add some downloads
            testPackage.Divisions.Download_Tree.Add_File("MVS_Complete.PDF");
            testPackage.Divisions.Download_Tree.Add_File("MVS_Complete.MP2");
            testPackage.Divisions.Download_Tree.Add_File("MVS_Part1.MP2");
            testPackage.Divisions.Download_Tree.Add_File("MVS_Part1.PDF");

            // Add some coordinate information
            GeoSpatial_Information geoSpatial = new GeoSpatial_Information();
            testPackage.Add_Metadata_Module(GlobalVar.GEOSPATIAL_METADATA_MODULE_KEY, geoSpatial);
            geoSpatial.Add_Point(29.530151, -82.301459, "Lake Wauberg");
            geoSpatial.Add_Point(29.634352, -82.350640, "Veterinary School");
            Coordinate_Polygon polygon = new Coordinate_Polygon();
            polygon.Label = "University of Florida Campus";
            polygon.Add_Edge_Point(new Coordinate_Point(29.651435, -82.339869, String.Empty));
            polygon.Add_Edge_Point(new Coordinate_Point(29.641216, -82.340298, String.Empty));
            polygon.Add_Edge_Point(new Coordinate_Point(29.629503, -82.371969, String.Empty));
            polygon.Add_Edge_Point(new Coordinate_Point(29.649645, -82.371712, String.Empty));
            polygon.Add_Inner_Point(29.649794, -82.351971, "Stadium");
            polygon.Add_Inner_Point(29.650988, -82.341156, "Library");
            geoSpatial.Add_Polygon(polygon);
            Coordinate_Line line = new Coordinate_Line();
            line.Label = "Waldo Road";
            line.Add_Point(29.652852, -82.310944, "Gainesville");
            line.Add_Point(29.716681, -82.268372, String.Empty);
            line.Add_Point(29.791494, -82.167778, "Waldo");
            geoSpatial.Add_Line(line);

            // Add some performing arts information
            Performing_Arts_Info partInfo = new Performing_Arts_Info();
            testPackage.Add_Metadata_Module("PerformingArts", partInfo);
            partInfo.Performance = "Hamlet";
            partInfo.Performance_Date = "August 12, 1923";
            Performer performer1 = partInfo.Add_Performer("Sullivan, Mark");
            performer1.Sex = "M";
            performer1.LifeSpan = "1873-";
            performer1.Occupation = "actor";
            performer1.Title = "Mr.";

            Performer performer2 = partInfo.Add_Performer("Waldbart, Julia");
            performer2.Sex = "F";
            performer2.LifeSpan = "1876-";
            performer2.Occupation = "actress";
            performer2.Title = "Mrs.";

            // Add some oral history information
            Oral_Interview_Info oralInfo = new Oral_Interview_Info();
            testPackage.Add_Metadata_Module(  "OralInterview", oralInfo);
            oralInfo.Interviewee = "Edwards, Herm";
            oralInfo.Interviewer = "Proctor, Samual";

            // Add some learning object resource information
            LearningObjectMetadata lomInfo = new LearningObjectMetadata();
            testPackage.Add_Metadata_Module( GlobalVar.IEEE_LOM_METADATA_MODULE_KEY, lomInfo );
            lomInfo.AggregationLevel = AggregationLevelEnum.level3;
            lomInfo.Status = StatusEnum.draft;
            LOM_System_Requirements lomReq1 = new LOM_System_Requirements();
            lomReq1.RequirementType = RequirementTypeEnum.operating_system;
            lomReq1.Name.Value = "Windows";
            lomReq1.MinimumVersion = "Windows XP";
            lomReq1.MaximumVersion = "Windows 7";
            lomInfo.Add_SystemRequirements(lomReq1);
            LOM_System_Requirements lomReq2 = new LOM_System_Requirements();
            lomReq2.RequirementType = RequirementTypeEnum.software;
            lomReq2.Name.Value = "Java SDK";
            lomReq2.MinimumVersion = "1.7.1";
            lomReq2.MaximumVersion = "2.09";
            lomInfo.Add_SystemRequirements(lomReq2);
            lomInfo.InteractivityType = InteractivityTypeEnum.mixed;
            lomInfo.Add_LearningResourceType("exercise");
            lomInfo.Add_LearningResourceType("Tutorials", "encdlwebpedagogicaltype");
            lomInfo.InteractivityLevel = InteractivityLevelEnum.high;
            lomInfo.Add_IntendedEndUserRole(IntendedEndUserRoleEnum.learner);
            lomInfo.Add_Context("Undergraduate lower division", "enclearningcontext");
            lomInfo.Add_Context("15", "grade");
            lomInfo.Add_Context("16", "grade");
            lomInfo.Add_Context("5", "group");
            lomInfo.Add_TypicalAgeRange("suitable for children over 7", "en");
            lomInfo.Add_TypicalAgeRange("2-8");
            lomInfo.DifficultyLevel = DifficultyLevelEnum.medium;
            lomInfo.TypicalLearningTime = "PT45M";

            LOM_Classification lomClassification1 = new LOM_Classification();
            lomInfo.Add_Classification(lomClassification1);
            lomClassification1.Purpose.Value = "Discipline";
            LOM_TaxonPath lomTaxonPath1 = new LOM_TaxonPath();
            lomClassification1.Add_TaxonPath(lomTaxonPath1);
            lomTaxonPath1.Add_SourceName("ARIADNE");
            LOM_Taxon lomTaxon1 = new LOM_Taxon();
            lomTaxonPath1.Add_Taxon(lomTaxon1);
            lomTaxon1.ID = "BF120";
            lomTaxon1.Add_Entry("Work_History", "en");
            lomTaxon1.Add_Entry("Historie", "nl");
            LOM_Taxon lomTaxon2 = new LOM_Taxon();
            lomTaxonPath1.Add_Taxon(lomTaxon2);
            lomTaxon2.ID = "BF120.1";
            lomTaxon2.Add_Entry("American Work_History", "en");
            LOM_Taxon lomTaxon3 = new LOM_Taxon();
            lomTaxonPath1.Add_Taxon(lomTaxon3);
            lomTaxon3.ID = "BF120.1.4";
            lomTaxon3.Add_Entry("American Civil War", "en");

            LOM_Classification lomClassification2 = new LOM_Classification();
            lomInfo.Add_Classification(lomClassification2);
            lomClassification2.Purpose.Value = "Educational Objective";

            LOM_TaxonPath lomTaxonPath2 = new LOM_TaxonPath();
            lomClassification2.Add_TaxonPath(lomTaxonPath2);
            lomTaxonPath2.Add_SourceName("Common Core Standards", "en");
            LOM_Taxon lomTaxon4 = new LOM_Taxon();
            lomTaxonPath2.Add_Taxon(lomTaxon4);
            lomTaxon4.ID = "CCS.Math.Content";
            LOM_Taxon lomTaxon5 = new LOM_Taxon();
            lomTaxonPath2.Add_Taxon(lomTaxon5);
            lomTaxon5.ID = "3";
            lomTaxon5.Add_Entry("Grade 3", "en");
            LOM_Taxon lomTaxon6 = new LOM_Taxon();
            lomTaxonPath2.Add_Taxon(lomTaxon6);
            lomTaxon6.ID = "OA";
            lomTaxon6.Add_Entry("Operations and Algebraic Thinking", "en");
            LOM_Taxon lomTaxon7 = new LOM_Taxon();
            lomTaxonPath2.Add_Taxon(lomTaxon7);
            lomTaxon7.ID = "A";
            lomTaxon7.Add_Entry("Represent and solve problems involving multiplication and division.", "en");
            LOM_Taxon lomTaxon8 = new LOM_Taxon();
            lomTaxonPath2.Add_Taxon(lomTaxon8);
            lomTaxon8.ID = "3";
            lomTaxon8.Add_Entry("Use multiplication and division within 100 to solve word problems in situations involving equal groups, arrays, and measurement quantities, e.g., by using drawings and equations with a symbol for the unknown number to represent the problem.", "en");

            LOM_TaxonPath lomTaxonPath3 = new LOM_TaxonPath();
            lomClassification2.Add_TaxonPath(lomTaxonPath3);
            lomTaxonPath3.Add_SourceName("Common Core Standards", "en");
            LOM_Taxon lomTaxon14 = new LOM_Taxon();
            lomTaxonPath3.Add_Taxon(lomTaxon14);
            lomTaxon14.ID = "CCS.Math.Content";
            LOM_Taxon lomTaxon15 = new LOM_Taxon();
            lomTaxonPath3.Add_Taxon(lomTaxon15);
            lomTaxon15.ID = "3";
            lomTaxon15.Add_Entry("Grade 3", "en");
            LOM_Taxon lomTaxon16 = new LOM_Taxon();
            lomTaxonPath3.Add_Taxon(lomTaxon16);
            lomTaxon16.ID = "OA";
            lomTaxon16.Add_Entry("Operations and Algebraic Thinking", "en");
            LOM_Taxon lomTaxon17 = new LOM_Taxon();
            lomTaxonPath3.Add_Taxon(lomTaxon17);
            lomTaxon17.ID = "A";
            lomTaxon17.Add_Entry("Represent and solve problems involving multiplication and division.", "en");
            LOM_Taxon lomTaxon18 = new LOM_Taxon();
            lomTaxonPath3.Add_Taxon(lomTaxon18);
            lomTaxon18.ID = "4";
            lomTaxon18.Add_Entry("Determine the unknown whole number in a multiplication or division equation relating three whole numbers. For example, determine the unknown number that makes the equation true in each of the equations 8 × ? = 48, 5 = _ ÷ 3, 6 × 6 = ?", "en");

            // Add some views and interfaces
            testPackage.Behaviors.Clear_Web_Skins();
            testPackage.Behaviors.Add_Web_Skin("dLOC");
            testPackage.Behaviors.Add_Web_Skin("UFDC");
            testPackage.Behaviors.Add_View(View_Enum.JPEG2000);
            testPackage.Behaviors.Add_View(View_Enum.JPEG);
            testPackage.Behaviors.Add_View(View_Enum.RELATED_IMAGES);
            testPackage.Behaviors.Add_View(View_Enum.HTML, "Full Document", "MVS001214.html");

            // Create the chapters and pages and link them
            Division_TreeNode chapter1 = new Division_TreeNode("Chapter", "First Chapter");
            Page_TreeNode page1 = new Page_TreeNode("First Page");
            Page_TreeNode page2 = new Page_TreeNode("Page 2");
            chapter1.Nodes.Add(page1);
            chapter1.Nodes.Add(page2);
            Division_TreeNode chapter2 = new Division_TreeNode("Chapter", "Last Chapter");
            Page_TreeNode page3 = new Page_TreeNode("Page 3");
            Page_TreeNode page4 = new Page_TreeNode("Last Page");
            chapter2.Nodes.Add(page3);
            chapter2.Nodes.Add(page4);
            testPackage.Divisions.Physical_Tree.Roots.Add(chapter1);
            testPackage.Divisions.Physical_Tree.Roots.Add(chapter2);

            // Create the files
            SobekCM_File_Info file1_1 = new SobekCM_File_Info("2000626_0001.jp2", 2120, 1100);
            SobekCM_File_Info file1_2 = new SobekCM_File_Info("2000626_0001.jpg", 630, 330);
            SobekCM_File_Info file1_3 = new SobekCM_File_Info("2000626_0001.tif");
            SobekCM_File_Info file2_1 = new SobekCM_File_Info("2000626_0002.jp2", 1754, 2453);
            SobekCM_File_Info file2_2 = new SobekCM_File_Info("2000626_0002.jpg", 630, 832);
            SobekCM_File_Info file2_3 = new SobekCM_File_Info("2000626_0002.tif");
            SobekCM_File_Info file3_1 = new SobekCM_File_Info("2000626_0003.jp2", 2321, 1232);
            SobekCM_File_Info file3_2 = new SobekCM_File_Info("2000626_0003.jpg", 630, 342);
            SobekCM_File_Info file3_3 = new SobekCM_File_Info("2000626_0003.tif");
            SobekCM_File_Info file4_1 = new SobekCM_File_Info("2000626_0004.jp2", 2145, 1024);
            SobekCM_File_Info file4_2 = new SobekCM_File_Info("2000626_0004.jpg", 630, 326);
            SobekCM_File_Info file4_3 = new SobekCM_File_Info("2000626_0004.tif");

            // Link the files to the pages
            page1.Files.Add(file1_1);
            page1.Files.Add(file1_2);
            page1.Files.Add(file1_3);
            page2.Files.Add(file2_1);
            page2.Files.Add(file2_2);
            page2.Files.Add(file2_3);
            page3.Files.Add(file3_1);
            page3.Files.Add(file3_2);
            page3.Files.Add(file3_3);
            page4.Files.Add(file4_1);
            page4.Files.Add(file4_2);
            page4.Files.Add(file4_3);

            // Add the DAITSS information
            DAITSS_Info daitssInfo = new DAITSS_Info();
            daitssInfo.Account = "FTU";
            daitssInfo.SubAccount = "CLAS";
            daitssInfo.Project = "UFDC";
            daitssInfo.toArchive = true;
            testPackage.Add_Metadata_Module(GlobalVar.DAITSS_METADATA_MODULE_KEY, daitssInfo);

            // Save this package
            testPackage.Source_Directory = directory;
            return testPackage;
        }
        /// <summary> Reads the Dublin Core-compliant section of XML and stores the data in the provided digital resource </summary>
        /// <param name="R"> XmlTextReader from which to read the dublin core data </param>
        /// <param name="BibInfo"> Digital resource object to save the data to </param>
        /// <param name="Return_Package"> The return package, if this is reading a top-level section of dublin core </param>
        public static void Read_Simple_Dublin_Core_Info(XmlReader R, Bibliographic_Info BibInfo, SobekCM_Item Return_Package )
        {
            while (R.Read())
            {
                if ((R.NodeType == XmlNodeType.EndElement) && ((R.Name == "METS:mdWrap") || (R.Name == "mdWrap")))
                    return;

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                                thesisInfo.Degree_Grantor = R.Value.Trim();
                            }
                            break;
                    }
                }
            }
        }
        /// <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;
            }
        }
        /// <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
            RightsMD_Info rightsInfo = Return_Package.Get_Metadata_Module(GlobalVar.PALMM_RIGHTSMD_METADATA_MODULE_KEY) as RightsMD_Info;
            if (rightsInfo == null)
            {
                rightsInfo = new RightsMD_Info();
                Return_Package.Add_Metadata_Module("PalmmRightsMD", rightsInfo);
            }

            // 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("rightsmd:") == 0)
                        name = name.Substring(9);

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

                        case "copyrightstatement":
                            Input_XmlReader.Read();
                            if ((Input_XmlReader.NodeType == XmlNodeType.Text) && (Input_XmlReader.Value.Trim().Length > 0))
                            {
                                rightsInfo.Copyright_Statement = Input_XmlReader.Value.Trim();
                            }
                            break;

                        case "accesscode":
                            Input_XmlReader.Read();
                            if ((Input_XmlReader.NodeType == XmlNodeType.Text) && (Input_XmlReader.Value.Trim().Length > 0))
                            {
                                rightsInfo.Access_Code = RightsMD_Info.AccessCode_Enum.NOT_SPECIFIED;
                                switch (Input_XmlReader.Value.Trim().ToLower())
                                {
                                    case "public":
                                        rightsInfo.Access_Code = RightsMD_Info.AccessCode_Enum.Public;
                                        break;

                                    case "private":
                                        rightsInfo.Access_Code = RightsMD_Info.AccessCode_Enum.Private;
                                        break;

                                    case "campus":
                                        rightsInfo.Access_Code = RightsMD_Info.AccessCode_Enum.Campus;
                                        break;
                                }
                            }
                            break;

                        case "embargoend":
                            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))
                                {
                                    rightsInfo.Embargo_End = convertedDate;
                                }
                            }
                            break;
                    }
                }
            } while (Input_XmlReader.Read());

            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 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;
        }
        /// <summary> Reads the Dublin Core-compliant section of XML and stores the data in the provided digital resource </summary>
        /// <param name="R"> XmlTextReader from which to read the dublin core data </param>
        /// <param name="BibInfo"> Digital resource object to save the data to </param>
        /// <param name="Return_Package"> The return package, if this is reading a top-level section of dublin core </param>
        public static void Read_Simple_Dublin_Core_Info(XmlReader R, Bibliographic_Info BibInfo, SobekCM_Item Return_Package)
        {
            while (R.Read())
            {
                if ((R.NodeType == XmlNodeType.EndElement) && ((R.Name == "METS:mdWrap") || (R.Name == "mdWrap")))
                {
                    return;
                }

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                            thesisInfo.Degree_Grantor = R.Value.Trim();
                        }
                        break;
                    }
                }
            }
        }
        /// <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.ToUpper().Replace("#", "").Replace(" ", "").Replace(".", "").Replace(":", "").Replace("\\", "").Replace("/", "").Replace(")", "").Replace("(", "").Trim();

            if (correctName.Length == 0)
            {
                correctName = "None";
            }
            else
            {
                // Find the first number
                int charIndex = 0;
                while ((charIndex < correctName.Length) && (!Char.IsNumber(correctName[charIndex])))
                {
                    charIndex++;
                }

                // If the index stopped before the end (that is, it found a number),
                // trim the number of the column name
                if ((charIndex < correctName.Length) && (charIndex > 0))
                {
                    correctName = correctName.Substring(0, charIndex);
                }

                // If it was all numbers, just assign NONE
                if (charIndex == 0)
                {
                    correctName = "None";
                }
            }

            // Everything depends on the field which is mapped
            switch (correctName)
            {
            case "NONE":
                // Do nothing, since no mapping exists
                return(true);

            case "ABSTRACT":
            case "SUMMARY":
                Package.Bib_Info.Add_Abstract(Data, "en");
                return(true);

            case "ACCESSION":
            case "ACCESSIONNUMBER":
                Package.Bib_Info.Add_Identifier(Data, "Accession Number");
                return(true);

            case "ALTERNATETITLE":
            case "ALTTITLE":
            case "TITLEVARIANT":
                Package.Bib_Info.Add_Other_Title(Data, Title_Type_Enum.Alternative);
                return(true);

            case "ALTERNATETITLELANGUAGE":
            case "ALTTITLELANGUAGE":
                List <Title_Info> otherTitles = Package.Bib_Info.Other_Titles.Where(ThisTitle => ThisTitle.Title_Type == Title_Type_Enum.Alternative).ToList();
                if (otherTitles.Count > 0)
                {
                    otherTitles[otherTitles.Count - 1].Language = Data;
                }
                return(true);

            case "TITLETRANSLATION":
            case "TRANSLATEDTITLE":
                Package.Bib_Info.Add_Other_Title(Data, Title_Type_Enum.Translated);
                return(true);

            case "ATTRIBUTION":
                Package.Bib_Info.Add_Note(Data, Note_Type_Enum.Funding);
                return(true);

            case "COLLECTION":
            case "COLLECTIONCODE":
            case "AGGREGATION":
            case "AGGREGATIONCODE":
            case "SUBCOLLECTION":
            case "SUBCOLLECTIONS":
                Package.Behaviors.Add_Aggregation(Data.ToUpper());
                return(true);

            case "CLASSIFICATION":
                Package.Bib_Info.Add_Classification(Data);
                return(true);

            case "CLASSIFICATIONTYPE":
            case "CLASSIFICATIONAUTHORITY":
                if (Package.Bib_Info.Classifications_Count > 0)
                {
                    Package.Bib_Info.Classifications[Package.Bib_Info.Classifications_Count - 1].Authority = Data;
                }
                return(true);

            case "CONTRIBUTOR":
            case "CONTRIBUTORS":
                Package.Bib_Info.Add_Named_Entity(new Name_Info(Data, "contributor"));
                return(true);

            case "CREATOR":
            case "CREATORS":
            case "AUTHOR":
                // Ensure it doesn't already exist
                if (Package.Bib_Info.Names_Count > 0)
                {
                    foreach (Name_Info thisName in Package.Bib_Info.Names)
                    {
                        if (String.Compare(thisName.Full_Name, Data, StringComparison.OrdinalIgnoreCase) == 0)
                        {
                            return(true);
                        }
                    }
                }
                Package.Bib_Info.Add_Named_Entity(new Name_Info(Data, "creator"));
                return(true);

            case "CREATORPERSONALNAME":

                // Ensure it doesn't already exist
                if (Package.Bib_Info.Names_Count > 0)
                {
                    foreach (Name_Info thisName in Package.Bib_Info.Names)
                    {
                        if (String.Compare(thisName.Full_Name, Data, StringComparison.OrdinalIgnoreCase) == 0)
                        {
                            return(true);
                        }
                    }
                }

                Name_Info personalCreator = new Name_Info(Data, "creator");
                personalCreator.Name_Type = Name_Info_Type_Enum.Personal;
                Package.Bib_Info.Add_Named_Entity(personalCreator);
                return(true);

            case "CREATORCORPORATENAME":
                Name_Info corporateCreator = new Name_Info(Data, "creator");
                corporateCreator.Name_Type = Name_Info_Type_Enum.Corporate;
                Package.Bib_Info.Add_Named_Entity(corporateCreator);
                return(true);

            case "CREATORLANGUAGE":
                if (Package.Bib_Info.Names_Count > 0)
                {
                    Package.Bib_Info.Names[Package.Bib_Info.Names_Count - 1].Description = Data;
                }
                return(true);

            case "CREATORAFFILIATION":
            case "AUTHORAFFILIATION":
                if (Package.Bib_Info.Names_Count > 0)
                {
                    Package.Bib_Info.Names[Package.Bib_Info.Names_Count - 1].Affiliation = Data;
                }
                return(true);

            case "CREATORDATES":
            case "AUTHORDATES":
                if (Package.Bib_Info.Names_Count > 0)
                {
                    Package.Bib_Info.Names[Package.Bib_Info.Names_Count - 1].Dates = Data;
                }
                return(true);

            case "CREATORFAMILYNAME":
            case "AUTHORFAMILYNAME":
            case "FAMILYNAME":
                if (Package.Bib_Info.Names_Count > 0)
                {
                    Name_Info lastNamedEntity = Package.Bib_Info.Names[Package.Bib_Info.Names_Count - 1];
                    if (lastNamedEntity.Family_Name.Length == 0)
                    {
                        lastNamedEntity.Family_Name = Data;
                    }
                    else
                    {
                        Name_Info newNameEntity = new Name_Info {
                            Family_Name = Data
                        };
                        Package.Bib_Info.Add_Named_Entity(newNameEntity);
                    }
                }
                else
                {
                    Name_Info newNameEntity = new Name_Info {
                        Family_Name = Data
                    };
                    Package.Bib_Info.Add_Named_Entity(newNameEntity);
                }
                return(true);

            case "CREATORGIVENNAME":
            case "AUTHORGIVENNAME":
            case "GIVENNAME":
                if (Package.Bib_Info.Names_Count > 0)
                {
                    Name_Info lastNamedEntity = Package.Bib_Info.Names[Package.Bib_Info.Names_Count - 1];
                    if (lastNamedEntity.Given_Name.Length == 0)
                    {
                        lastNamedEntity.Given_Name = Data;
                    }
                    else
                    {
                        Name_Info newNameEntity = new Name_Info {
                            Given_Name = Data
                        };
                        Package.Bib_Info.Add_Named_Entity(newNameEntity);
                    }
                }
                else
                {
                    Name_Info newNameEntity = new Name_Info {
                        Given_Name = Data
                    };
                    Package.Bib_Info.Add_Named_Entity(newNameEntity);
                }
                return(true);

            case "CREATORROLE":
            case "AUTHORROLE":
            case "CREATORROLES":
            case "AUTHORROLES":
            case "CREATORATTRIBUTION":
                if (Package.Bib_Info.Names_Count > 0)
                {
                    Name_Info thisCreator = Package.Bib_Info.Names[Package.Bib_Info.Names_Count - 1];
                    if ((thisCreator.Roles.Count == 1) && ((thisCreator.Roles[0].Role == "creator") || (thisCreator.Roles[1].Role == "contributor")))
                    {
                        thisCreator.Roles.Clear();
                    }
                    Package.Bib_Info.Names[Package.Bib_Info.Names_Count - 1].Add_Role(Data);
                }
                return(true);

            case "CULTURALCONTEXT":
            case "CULTURE":
                VRACore_Info vraCoreInfo = Package.Get_Metadata_Module("VRACore") as VRACore_Info;
                if (vraCoreInfo == null)
                {
                    vraCoreInfo = new VRACore_Info();
                    Package.Add_Metadata_Module("VRACore", vraCoreInfo);
                }
                vraCoreInfo.Add_Cultural_Context(Data);
                return(true);

            case "DONOR":
                Package.Bib_Info.Donor.Full_Name = Data;
                return(true);

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

            case "GENREAUTHORITY":
                if (Package.Bib_Info.Genres_Count > 0)
                {
                    Package.Bib_Info.Genres[Package.Bib_Info.Genres_Count - 1].Authority = Data;
                }
                return(true);

            case "HOLDINGLOCATIONCODE":
            case "HOLDINGCODE":
                Package.Bib_Info.Location.Holding_Code = Data;
                return(true);

            case "HOLDINGLOCATIONSTATEMENT":
            case "HOLDINGSTATEMENT":
            case "CONTRIBUTINGINSTITUTION":
            case "LOCATIONCURRENT":
            case "LOCATIONCURRENTSITE":
            case "LOCATIONCURRENTREPOSITORY":
                Package.Bib_Info.Location.Holding_Name = Data;
                return(true);

            case "LOCATIONFORMERSITE":
                Package.Bib_Info.Add_Note(Data, Note_Type_Enum.OriginalLocation);
                return(true);

            case "IDENTIFIER":
            case "IDNUMBERFORMERREPOSITORY":
            case "IDNUMBERCURRENTREPOSITORY":
            case "IDNUMBERCURRENTRESPOSITORY":
                Package.Bib_Info.Add_Identifier(Data);
                return(true);

            case "IDENTIFIERTYPE":
                if (Package.Bib_Info.Identifiers_Count > 0)
                {
                    Package.Bib_Info.Identifiers[Package.Bib_Info.Identifiers_Count - 1].Type = Data;
                }
                return(true);

            case "INSCRIPTION":
                VRACore_Info vraCoreInfo8 = Package.Get_Metadata_Module("VRACore") as VRACore_Info;
                if (vraCoreInfo8 == null)
                {
                    vraCoreInfo8 = new VRACore_Info();
                    Package.Add_Metadata_Module("VRACore", vraCoreInfo8);
                }
                vraCoreInfo8.Add_Inscription(Data);
                return(true);

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

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

            case "PLACEOFPUBLICATION":
            case "PUBLICATIONPLACE":
            case "PUBPLACE":
            case "PUBLICATIONLOCATION":
            case "PLACE":
                Package.Bib_Info.Origin_Info.Add_Place(Data);
                return(true);

            case "RELATEDURLLABEL":
                Package.Bib_Info.Location.Other_URL_Display_Label = Data;
                return(true);

            case "RELATEDURL":
            case "RELATEDURLLINK":
                Package.Bib_Info.Location.Other_URL = Data;
                return(true);

            case "RELATEDURLNOTE":
            case "RELATEDURLNOTES":
                Package.Bib_Info.Location.Other_URL_Note = Data;
                return(true);

            case "SOURCEINSTITUTIONCODE":
            case "SOURCECODE":
                Package.Bib_Info.Source.Code = Data;
                return(true);

            case "SOURCEINSTITUTIONSTATEMENT":
            case "SOURCESTATEMENT":
            case "SOURCE":
                Package.Bib_Info.Source.Statement = Data;
                return(true);

            case "SUBJECTKEYWORD":
            case "SUBJECTKEYWORDS":
            case "SUBJECT":
            case "SUBJECTS":
            case "KEYWORDS":
                Package.Bib_Info.Add_Subject(Data, String.Empty);
                return(true);

            case "SUBJECTKEYWORDAUTHORITY":
            case "SUBJECTAUTHORITY":
                if (Package.Bib_Info.Subjects_Count > 0)
                {
                    Package.Bib_Info.Subjects[Package.Bib_Info.Subjects_Count - 1].Authority = Data;
                }
                return(true);

            case "BIBID":
            case "BIB":
            case "BIBLIOGRAHPICID":
            case "BIBLIOGRAPHICIDENTIFIER":
                Package.Bib_Info.BibID = Data.ToUpper();
                return(true);

            case "VID":
                Package.Bib_Info.VID = Data.PadLeft(5, '0');
                return(true);

            case "DATE":
            case "DATECREATION":
                try
                {
                    // first, try converting the string value to a date object
                    Package.Bib_Info.Origin_Info.Date_Issued = Convert.ToDateTime(Data).ToShortDateString();
                }
                catch
                {
                    try
                    {
                        // second, try converting the string value to an integer
                        Package.Bib_Info.Origin_Info.Date_Issued = Convert.ToInt32(Data).ToString();
                    }
                    catch
                    {
                        Package.Bib_Info.Origin_Info.Date_Issued = Data;
                    }
                }
                return(true);

            case "DATEBEGINNING":
                Package.Bib_Info.Origin_Info.MARC_DateIssued_Start = Data;
                return(true);

            case "DATECOMPLETION":
                Package.Bib_Info.Origin_Info.MARC_DateIssued_End = Data;
                return(true);

            case "EDITION":
                Package.Bib_Info.Origin_Info.Edition = Data;
                return(true);

            case "FORMAT":
            case "PHYSICALDESCRIPTION":
            case "EXTENT":
                Package.Bib_Info.Original_Description.Extent = Data;
                return(true);

            case "NOTE":
            case "NOTES":
            case "DESCRIPTION":
                Package.Bib_Info.Add_Note(Data);
                return(true);

            case "PROVENANCE":
                Package.Bib_Info.Add_Note(Data, Note_Type_Enum.Acquisition);
                return(true);

            case "USAGESTATEMENT":
                Package.Bib_Info.Add_Note(Data, Note_Type_Enum.CitationReference);
                return(true);

            case "CONTACT":
            case "CONTACTNOTES":
            case "CONTACTINFORMATION":
                Package.Bib_Info.Add_Note(Data, Note_Type_Enum.NONE, "Contact");
                return(true);

            case "RIGHTS":
                Package.Bib_Info.Access_Condition.Text = Data;
                return(true);

            case "BIBSERIESTITLE":
            case "SERIESTITLE":
            case "TITLESERIES":
                Package.Bib_Info.SeriesTitle.Title = Data;
                Package.Behaviors.GroupTitle       = Data;
                return(true);

            case "MATERIALTYPE":
            case "TYPE":
            case "RECORDTYPE":
                string upper_data = Data.ToUpper();
                if (upper_data.IndexOf("NEWSPAPER", StringComparison.Ordinal) >= 0)
                {
                    Package.Bib_Info.SobekCM_Type = TypeOfResource_SobekCM_Enum.Newspaper;
                    return(true);
                }
                if ((upper_data.IndexOf("MONOGRAPH", StringComparison.Ordinal) >= 0) || (upper_data.IndexOf("BOOK", StringComparison.Ordinal) >= 0))
                {
                    Package.Bib_Info.SobekCM_Type = TypeOfResource_SobekCM_Enum.Book;
                    return(true);
                }
                if (upper_data.IndexOf("SERIAL", StringComparison.Ordinal) >= 0)
                {
                    Package.Bib_Info.SobekCM_Type = TypeOfResource_SobekCM_Enum.Serial;
                    return(true);
                }
                if (upper_data.IndexOf("AERIAL", StringComparison.Ordinal) >= 0)
                {
                    Package.Bib_Info.SobekCM_Type = TypeOfResource_SobekCM_Enum.Aerial;
                    if (Package.Bib_Info.Original_Description.Extent.Length == 0)
                    {
                        Package.Bib_Info.Original_Description.Extent = "Aerial Photograph";
                    }
                    return(true);
                }
                if (upper_data.IndexOf("PHOTO", StringComparison.Ordinal) >= 0)
                {
                    Package.Bib_Info.SobekCM_Type = TypeOfResource_SobekCM_Enum.Photograph;
                    return(true);
                }
                if (upper_data.IndexOf("POSTCARD", StringComparison.Ordinal) >= 0)
                {
                    Package.Bib_Info.SobekCM_Type = TypeOfResource_SobekCM_Enum.Photograph;
                    if (Package.Bib_Info.Original_Description.Extent.Length == 0)
                    {
                        Package.Bib_Info.Original_Description.Extent = "Postcard";
                    }
                    return(true);
                }
                if (upper_data.IndexOf("MAP", StringComparison.Ordinal) >= 0)
                {
                    Package.Bib_Info.SobekCM_Type = TypeOfResource_SobekCM_Enum.Map;
                    return(true);
                }
                if (upper_data.IndexOf("TEXT", StringComparison.Ordinal) >= 0)
                {
                    Package.Bib_Info.SobekCM_Type = TypeOfResource_SobekCM_Enum.Book;
                    return(true);
                }
                if (upper_data.IndexOf("AUDIO", StringComparison.Ordinal) >= 0)
                {
                    Package.Bib_Info.SobekCM_Type = TypeOfResource_SobekCM_Enum.Audio;
                    return(true);
                }
                if (upper_data.IndexOf("VIDEO", StringComparison.Ordinal) >= 0)
                {
                    Package.Bib_Info.SobekCM_Type = TypeOfResource_SobekCM_Enum.Video;
                    return(true);
                }
                if ((upper_data.IndexOf("ARCHIVE", StringComparison.Ordinal) >= 0) || (upper_data.IndexOf("ARCHIVAL", StringComparison.Ordinal) >= 0))
                {
                    Package.Bib_Info.SobekCM_Type = TypeOfResource_SobekCM_Enum.Archival;
                    return(true);
                }
                if (upper_data.IndexOf("ARTIFACT", StringComparison.Ordinal) >= 0)
                {
                    Package.Bib_Info.SobekCM_Type = TypeOfResource_SobekCM_Enum.Artifact;
                    return(true);
                }
                if (upper_data.IndexOf("IMAGE", StringComparison.Ordinal) >= 0)
                {
                    Package.Bib_Info.SobekCM_Type = TypeOfResource_SobekCM_Enum.Photograph;
                    return(true);
                }

                // if there was no match, set type to "UNDETERMINED"
                Package.Bib_Info.SobekCM_Type = TypeOfResource_SobekCM_Enum.UNKNOWN;

                if (Package.Bib_Info.Original_Description.Extent.Length == 0)
                {
                    Package.Bib_Info.Original_Description.Extent = "Undetermined";
                }
                return(true);

            case "BIBUNIFORMTITLE":
            case "UNIFORMTITLE":
                Package.Bib_Info.Add_Other_Title(Data, Title_Type_Enum.Uniform);
                Package.Behaviors.GroupTitle = Data;
                return(true);

            case "VOLUMETITLE":
            case "TITLE":
                if (String.IsNullOrEmpty(Package.Bib_Info.Main_Title.Title))
                {
                    Package.Bib_Info.Main_Title.Title = Data;
                }
                else
                {
                    Package.Bib_Info.Add_Other_Title(Data, Title_Type_Enum.Alternative);
                }
                return(true);

            case "TITLELANGUAGE":
                Package.Bib_Info.Main_Title.Language = Data;
                return(true);

            case "ALEPH":
                Package.Bib_Info.Add_Identifier(Data, "ALEPH");
                return(true);

            case "OCLC":
                Package.Bib_Info.Add_Identifier(Data, "OCLC");
                return(true);

            case "LCCN":
                Package.Bib_Info.Add_Identifier(Data, "LCCN");
                return(true);

            case "ISBN":
                Package.Bib_Info.Add_Identifier(Data, "ISBN");
                return(true);

            case "ISSN":
                Package.Bib_Info.Add_Identifier(Data, "ISSN");
                return(true);

            case "SUBTITLE":
                Package.Bib_Info.Main_Title.Subtitle = Data;
                return(true);

            case "VOLUME":
                Package.Bib_Info.Series_Part_Info.Enum1 = Data;
                Package.Behaviors.Serial_Info.Add_Hierarchy(Package.Behaviors.Serial_Info.Count + 1, 1, Data);
                return(true);

            case "ISSUE":
                if (Package.Bib_Info.Series_Part_Info.Enum1.Length == 0)
                {
                    Package.Bib_Info.Series_Part_Info.Enum1 = Data;
                }
                else
                {
                    Package.Bib_Info.Series_Part_Info.Enum2 = Data;
                }
                Package.Behaviors.Serial_Info.Add_Hierarchy(Package.Behaviors.Serial_Info.Count + 1, 1, Data);
                return(true);

            case "SECTION":
                if (Package.Bib_Info.Series_Part_Info.Enum2.Length == 0)
                {
                    if (Package.Bib_Info.Series_Part_Info.Enum1.Length == 0)
                    {
                        Package.Bib_Info.Series_Part_Info.Enum1 = Data;
                    }
                    else
                    {
                        Package.Bib_Info.Series_Part_Info.Enum2 = Data;
                    }
                }
                else
                {
                    Package.Bib_Info.Series_Part_Info.Enum3 = Data;
                }
                Package.Behaviors.Serial_Info.Add_Hierarchy(Package.Behaviors.Serial_Info.Count + 1, 1, Data);
                // Do nothing for now
                return(true);

            case "YEAR":
                Package.Bib_Info.Series_Part_Info.Year = Data;

                if (Data.Length == 1)
                {
                    year = "0" + Data;
                }
                else
                {
                    year = Data;
                }
                build_date_string(Package);

                return(true);

            case "MONTH":
                Package.Bib_Info.Series_Part_Info.Month = Data;
                month = Data;
                build_date_string(Package);

                return(true);

            case "DAY":
                Package.Bib_Info.Series_Part_Info.Day = Data;
                day = Data;
                build_date_string(Package);

                return(true);

            case "COORDINATES":
                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);
                }
                string[] coordinates = Data.Split(", ;".ToCharArray());
                try
                {
                    if (coordinates.Length == 2)
                    {
                        geoInfo.Add_Point(Convert.ToDouble(coordinates[0]), Convert.ToDouble(coordinates[1]), String.Empty);
                    }
                    else
                    {
                        coordinates = Data.Split(",;".ToCharArray());
                        if (coordinates.Length == 2)
                        {
                            geoInfo.Add_Point(Convert.ToDouble(coordinates[0]), Convert.ToDouble(coordinates[1]), String.Empty);
                        }
                    }
                }
                catch
                {
                }
                return(true);

            case "LATITUDE":
            case "COORDINATESLATITUDE":
                GeoSpatial_Information geoInfo2 = Package.Get_Metadata_Module(GlobalVar.GEOSPATIAL_METADATA_MODULE_KEY) as GeoSpatial_Information;
                if (geoInfo2 == null)
                {
                    geoInfo2 = new GeoSpatial_Information();
                    Package.Add_Metadata_Module(GlobalVar.GEOSPATIAL_METADATA_MODULE_KEY, geoInfo2);
                }
                try
                {
                    if (geoInfo2.Point_Count == 0)
                    {
                        geoInfo2.Add_Point(Convert.ToDouble(Data), 0, String.Empty);
                    }
                    else
                    {
                        geoInfo2.Points[0].Latitude = Convert.ToDouble(Data);
                    }
                }
                catch
                {
                }
                return(true);

            case "LONGITUDE":
            case "COORDINATESLONGITUDE":
                GeoSpatial_Information geoInfo3 = Package.Get_Metadata_Module(GlobalVar.GEOSPATIAL_METADATA_MODULE_KEY) as GeoSpatial_Information;
                if (geoInfo3 == null)
                {
                    geoInfo3 = new GeoSpatial_Information();
                    Package.Add_Metadata_Module(GlobalVar.GEOSPATIAL_METADATA_MODULE_KEY, geoInfo3);
                }
                try
                {
                    if (geoInfo3.Point_Count == 0)
                    {
                        geoInfo3.Add_Point(0, Convert.ToDouble(Data.Replace("°", "")), String.Empty);
                    }
                    else
                    {
                        geoInfo3.Points[0].Longitude = Convert.ToDouble(Data.Replace("°", ""));
                    }
                }
                catch
                {
                }
                return(true);

            case "PROJECTION":
            case "MAPPROJECTION":
                Guarantee_Cartographics(Package).Projection = Data;
                return(true);

            case "SCALE":
            case "MAPSCALE":
                Guarantee_Cartographics(Package).Scale = Data;
                return(true);

            //case Mapped_Fields.Spatial_Coverage:
            //    Package.Bib_Info.Hierarchical_Spatials[0].Area = Data;
            //    return true;

            case "ICON/WORDMARK":
            case "ICON/WORDMARKS":
            case "ICON":
            case "ICONS":
            case "WORDMARK":
            case "WORDMARKS":
                Package.Behaviors.Add_Wordmark(Data);
                return(true);

            case "WEBSKINS":
            case "WEBSKIN":
            case "SKINS":
            case "SKIN":
                Package.Behaviors.Add_Web_Skin(Data);
                return(true);

            case "TEMPORALCOVERAGE":
            case "TEMPORAL":
            case "TIMEPERIOD":
                Package.Bib_Info.Add_Temporal_Subject(-1, -1, Data);
                return(true);

            case "COVERAGE":
                // Was this a number.. likely, a year?
                int possible_year;
                if ((Data.Length >= 4) && (Int32.TryParse(Data.Substring(0, 4), out possible_year)))
                {
                    Package.Bib_Info.Add_Temporal_Subject(-1, -1, Data);
                }
                else
                {
                    Package.Bib_Info.Add_Spatial_Subject(Data);
                }
                return(true);

            case "AFFILIATIONUNIVERSITY":
            case "UNIVERSITY":
                Guarantee_Affiliation_Collection(Package);
                Package.Bib_Info.Affiliations[0].University = Data;
                return(true);

            case "AFFILIATIONCAMPUS":
            case "CAMPUS":
                Guarantee_Affiliation_Collection(Package);
                Package.Bib_Info.Affiliations[0].Campus = Data;
                return(true);

            case "AFFILIATIONCOLLEGE":
            case "COLLEGE":
                Guarantee_Affiliation_Collection(Package);
                Package.Bib_Info.Affiliations[0].College = Data;
                return(true);

            case "AFFILIATIONUNIT":
            case "UNIT":
                Guarantee_Affiliation_Collection(Package);
                Package.Bib_Info.Affiliations[0].Unit = Data;
                return(true);

            case "AFFILIATIONDEPARTMENT":
            case "DEPARTMENT":
                Guarantee_Affiliation_Collection(Package);
                Package.Bib_Info.Affiliations[0].Department = Data;
                return(true);

            case "AFFILIATIONINSTITUTE":
            case "INSTITUTE":
                Guarantee_Affiliation_Collection(Package);
                Package.Bib_Info.Affiliations[0].Institute = Data;
                return(true);

            case "AFFILIATIONCENTER":
            case "CENTER":
                Guarantee_Affiliation_Collection(Package);
                Package.Bib_Info.Affiliations[0].Center = Data;
                return(true);

            case "AFFILIATIONSECTION":
                Guarantee_Affiliation_Collection(Package);
                Package.Bib_Info.Affiliations[0].Section = Data;
                return(true);

            case "AFFILIATIONSUBSECTION":
                Guarantee_Affiliation_Collection(Package);
                Package.Bib_Info.Affiliations[0].SubSection = Data;
                return(true);

            case "GEOGRAPHYCONTINENT":
            case "CONTINENT":
                Guarantee_Hierarchical_Spatial(Package).Continent = Data;
                return(true);

            case "GEOGRAPHYCOUNTRY":
            case "COUNTRY":
                Guarantee_Hierarchical_Spatial(Package).Country = Data;
                return(true);

            case "GEOGRAPHYPROVINCE":
            case "PROVINCE":
                Guarantee_Hierarchical_Spatial(Package).Province = Data;
                return(true);

            case "GEOGRAPHYREGION":
            case "REGION":
                Guarantee_Hierarchical_Spatial(Package).Region = Data;
                return(true);

            case "GEOGRAPHYSTATE":
            case "STATE":
                Guarantee_Hierarchical_Spatial(Package).State = Data;
                return(true);

            case "GEOGRAPHYTERRITORY":
            case "TERRITORY":
                Guarantee_Hierarchical_Spatial(Package).Territory = Data;
                return(true);

            case "GEOGRAPHYCOUNTY":
            case "COUNTY":
                Guarantee_Hierarchical_Spatial(Package).County = Data;
                return(true);

            case "GEOGRAPHYCITY":
            case "CITY":
                Guarantee_Hierarchical_Spatial(Package).City = Data;
                return(true);

            case "GEOGRAPHYISLAND":
            case "ISLAND":
                Guarantee_Hierarchical_Spatial(Package).Island = Data;
                return(true);

            case "GEOGRAPHYAREA":
            case "AREA":
                Guarantee_Hierarchical_Spatial(Package).Area = Data;
                return(true);

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

            case "COPYRIGHTDATE":
            case "COPYRIGHT":
                Package.Bib_Info.Origin_Info.Date_Copyrighted = Data;
                return(true);

            case "EADNAME":
            case "EAD":
                Package.Bib_Info.Location.EAD_Name = Data;
                return(true);

            case "EADURL":
                Package.Bib_Info.Location.EAD_URL = Data;
                return(true);

            case "COMMENTS":
            case "INTERNALCOMMENTS":
            case "INTERNAL":
                Package.Tracking.Internal_Comments = Data;
                return(true);

            case "CONTAINERBOX":
            case "BOX":
                Package.Bib_Info.Add_Container("Box", Data, 1);
                return(true);

            case "CONTAINERDIVIDER":
            case "DIVIDER":
                Package.Bib_Info.Add_Container("Divider", Data, 2);
                return(true);

            case "CONTAINERFOLDER":
            case "FOLDER":
                Package.Bib_Info.Add_Container("Folder", Data, 3);
                return(true);

            case "VIEWERS":
            case "VIEWER":
                Package.Behaviors.Add_View(Data);
                return(true);

            case "VISIBILITY":
                switch (Data.ToUpper())
                {
                case "DARK":
                    Package.Behaviors.Dark_Flag = true;
                    Package.Behaviors.IP_Restriction_Membership = -1;
                    return(true);

                case "PRIVATE":
                    Package.Behaviors.Dark_Flag = false;
                    Package.Behaviors.IP_Restriction_Membership = -1;
                    return(true);

                case "PUBLIC":
                    Package.Behaviors.Dark_Flag = false;
                    Package.Behaviors.IP_Restriction_Membership = 0;
                    return(true);

                case "RESTRICTED":
                    Package.Behaviors.Dark_Flag = false;
                    Package.Behaviors.IP_Restriction_Membership = 1;
                    return(true);
                }
                return(true);

            case "TICKLER":
                Package.Behaviors.Add_Tickler(Data);
                return(true);

            case "TRACKINGBOX":
                Package.Tracking.Tracking_Box = Data;
                return(true);

            case "BORNDIGITAL":
                if (Data.ToUpper().Trim() == "TRUE")
                {
                    Package.Tracking.Born_Digital = true;
                }
                return(true);

            case "MATERIALRECEIVED":
            case "MATERIALRECEIVEDDATE":
            case "MATERIALRECDDATE":
            case "MATERIALRECD":
                DateTime materialReceivedDate;
                if (DateTime.TryParse(Data, out materialReceivedDate))
                {
                    Package.Tracking.Material_Received_Date = materialReceivedDate;
                }
                return(true);

            case "MATERIAL":
            case "MATERIALS":
            case "MATERIALMEDIUM":
                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 "MATERIALSUPPORT":
                VRACore_Info vraCoreInfo2b = Package.Get_Metadata_Module("VRACore") as VRACore_Info;
                if (vraCoreInfo2b == null)
                {
                    vraCoreInfo2b = new VRACore_Info();
                    Package.Add_Metadata_Module("VRACore", vraCoreInfo2b);
                }
                vraCoreInfo2b.Add_Material(Data, "support");
                return(true);

            case "MEASUREMENT":
            case "MEASUREMENTS":
            case "MEASUREMENTDIMENSIONS":
            case "MEASUREMENTSDIMENSIONS":
            case "DIMENSIONS":
                VRACore_Info vraCoreInfo3 = Package.Get_Metadata_Module("VRACore") as VRACore_Info;
                if (vraCoreInfo3 == null)
                {
                    vraCoreInfo3 = new VRACore_Info();
                    Package.Add_Metadata_Module("VRACore", vraCoreInfo3);
                }
                if (vraCoreInfo3.Measurement_Count == 0)
                {
                    vraCoreInfo3.Add_Measurement(Data, String.Empty);
                }
                else
                {
                    vraCoreInfo3.Measurements[0].Measurements = Data;
                }
                return(true);

            case "MEASUREMENTFORMAT":
            case "MEASUREMENTUNITS":
            case "MEASUREMENTSFORMAT":
            case "MEASUREMENTSUNITS":
                VRACore_Info vraCoreInfo3b = Package.Get_Metadata_Module("VRACore") as VRACore_Info;
                if (vraCoreInfo3b == null)
                {
                    vraCoreInfo3b = new VRACore_Info();
                    Package.Add_Metadata_Module("VRACore", vraCoreInfo3b);
                }
                if (vraCoreInfo3b.Measurement_Count == 0)
                {
                    vraCoreInfo3b.Add_Measurement(String.Empty, Data);
                }
                else
                {
                    vraCoreInfo3b.Measurements[0].Units = Data;
                }
                return(true);



            case "STATEEDITION":
                VRACore_Info vraCoreInfo4 = Package.Get_Metadata_Module("VRACore") as VRACore_Info;
                if (vraCoreInfo4 == null)
                {
                    vraCoreInfo4 = new VRACore_Info();
                    Package.Add_Metadata_Module("VRACore", vraCoreInfo4);
                }
                vraCoreInfo4.Add_State_Edition(Data);
                return(true);

            case "STYLE":
            case "PERIOD":
            case "STYLEPERIOD":
                VRACore_Info vraCoreInfo5 = Package.Get_Metadata_Module("VRACore") as VRACore_Info;
                if (vraCoreInfo5 == null)
                {
                    vraCoreInfo5 = new VRACore_Info();
                    Package.Add_Metadata_Module("VRACore", vraCoreInfo5);
                }
                vraCoreInfo5.Add_Style_Period(Data);
                return(true);

            case "TECHNIQUE":
                VRACore_Info vraCoreInfo6 = Package.Get_Metadata_Module("VRACore") as VRACore_Info;
                if (vraCoreInfo6 == null)
                {
                    vraCoreInfo6 = new VRACore_Info();
                    Package.Add_Metadata_Module("VRACore", vraCoreInfo6);
                }
                vraCoreInfo6.Add_Technique(Data);
                return(true);

            case "TARGETAUDIENCE":
            case "AUDIENCE":
                Package.Bib_Info.Add_Target_Audience(Data);
                return(true);

            default:
                // No mapping exists and this is a non-known no-mapping
                return(false);
            }
        }
        public void Do_Work()
        {
            string        username = WindowsIdentity.GetCurrent().Name;
            List <string> directories_to_process = new List <string>();

            try
            {
                recurse_through_directories(directory, directories_to_process);
            }
            catch
            {
            }

            // Now, iterate through all the directories
            int current_directory  = 1;
            int errors_encountered = 0;

            foreach (string thisDirectory in directories_to_process)
            {
                try
                {
                    DirectoryInfo thisDirectoryInfo = new DirectoryInfo(thisDirectory);

                    string folder_name_for_progress = thisDirectoryInfo.Name;
                    if (folder_name_for_progress.Length <= 5)
                    {
                        folder_name_for_progress = (thisDirectoryInfo.Parent.Name) + "\\" + folder_name_for_progress;
                    }
                    OnNewFolder(folder_name_for_progress + " ( " + current_directory + " of " + directories_to_process.Count + " )");

                    // Get the metadata file
                    string[] metadata = Directory.GetFiles(thisDirectory, filter);
                    if (metadata.Length > 0)
                    {
                        SobekCM_Item newItem = null;
                        if (metadata_type.IndexOf("METS") >= 0)
                        {
                            newItem = SobekCM_Item.Read_METS(metadata[0]);
                        }
                        else
                        {
                            newItem = new SobekCM_Item();
                            newItem.Source_Directory = thisDirectory;

                            newItem = new SobekCM_Item();
                            List <string> addOns = MetaTemplate_UserSettings.AddOns_Enabled;

                            // Set the initial agents
                            if (MetaTemplate_UserSettings.Individual_Creator.Length > 0)
                            {
                                newItem.METS_Header.Creator_Individual = MetaTemplate_UserSettings.Individual_Creator;
                            }
                            else
                            {
                                newItem.METS_Header.Creator_Individual = username;
                            }
                            newItem.METS_Header.Creator_Software = "SobekCM METS Editor";

                            // Add FCLA add-on defaults
                            if (addOns.Contains("FCLA"))
                            {
                                PALMM_Info palmmInfo = newItem.Get_Metadata_Module(GlobalVar.PALMM_METADATA_MODULE_KEY) as PALMM_Info;
                                if (palmmInfo == null)
                                {
                                    palmmInfo = new PALMM_Info();
                                    newItem.Add_Metadata_Module(GlobalVar.PALMM_METADATA_MODULE_KEY, palmmInfo);
                                }
                                palmmInfo.PALMM_Project = MetaTemplate_UserSettings.PALMM_Code;
                                palmmInfo.toPALMM       = MetaTemplate_UserSettings.FCLA_Flag_PALMM;


                                DAITSS_Info daitssInfo = newItem.Get_Metadata_Module(GlobalVar.DAITSS_METADATA_MODULE_KEY) as DAITSS_Info;
                                if (daitssInfo == null)
                                {
                                    daitssInfo = new DAITSS_Info();
                                    newItem.Add_Metadata_Module(GlobalVar.DAITSS_METADATA_MODULE_KEY, daitssInfo);
                                }
                                daitssInfo.toArchive  = MetaTemplate_UserSettings.FCLA_Flag_FDA;
                                daitssInfo.Account    = MetaTemplate_UserSettings.FDA_Account;
                                daitssInfo.SubAccount = MetaTemplate_UserSettings.FDA_SubAccount;
                                daitssInfo.Project    = MetaTemplate_UserSettings.FDA_Project;
                            }

                            // Add SobekCM add-on defaults
                            if (addOns.Contains("SOBEKCM"))
                            {
                                // Add any wordmarks
                                List <string> wordmarks = MetaTemplate_UserSettings.SobekCM_Wordmarks;
                                foreach (string thisWordmark in wordmarks)
                                {
                                    newItem.Behaviors.Add_Wordmark(thisWordmark);
                                }

                                // Add any aggregations
                                List <string> aggregations = MetaTemplate_UserSettings.SobekCM_Aggregations;
                                foreach (string thisAggregation in aggregations)
                                {
                                    newItem.Behaviors.Add_Aggregation(thisAggregation);
                                }

                                // Add any web skins
                                List <string> webskins = MetaTemplate_UserSettings.SobekCM_Web_Skins;
                                foreach (string thisWebSkin in webskins)
                                {
                                    newItem.Behaviors.Add_Web_Skin(thisWebSkin);
                                }

                                // Add any viewers
                                List <string> viewers = MetaTemplate_UserSettings.SobekCM_Viewers;
                                foreach (string thisViewer in viewers)
                                {
                                    if (String.Compare(thisViewer, "Page Image (JPEG)") == 0)
                                    {
                                        newItem.Behaviors.Add_View(View_Enum.JPEG);
                                    }
                                    if (String.Compare(thisViewer, "Zoomable (JPEG2000)") == 0)
                                    {
                                        newItem.Behaviors.Add_View(View_Enum.JPEG2000);
                                    }
                                    if (String.Compare(thisViewer, "Page Turner") == 0)
                                    {
                                        newItem.Behaviors.Add_View(View_Enum.PAGE_TURNER);
                                    }
                                    if (String.Compare(thisViewer, "Text") == 0)
                                    {
                                        newItem.Behaviors.Add_View(View_Enum.TEXT);
                                    }
                                    if (String.Compare(thisViewer, "Thumbnails") == 0)
                                    {
                                        newItem.Behaviors.Add_View(View_Enum.RELATED_IMAGES);
                                    }
                                }
                            }

                            // Add all other defaults
                            newItem.Bib_Info.Source.Code      = MetaTemplate_UserSettings.Default_Source_Code;
                            newItem.Bib_Info.Source.Statement = MetaTemplate_UserSettings.Default_Source_Statement;
                            if (MetaTemplate_UserSettings.Default_Funding_Note.Length > 0)
                            {
                                newItem.Bib_Info.Add_Note(MetaTemplate_UserSettings.Default_Funding_Note, Note_Type_Enum.funding);
                            }
                            if (MetaTemplate_UserSettings.Default_Rights_Statement.Length > 0)
                            {
                                newItem.Bib_Info.Access_Condition.Text = MetaTemplate_UserSettings.Default_Rights_Statement;
                            }

                            // Set some final values
                            newItem.Bib_Info.Type.MODS_Type = TypeOfResource_MODS_Enum.Text;

                            // Assign an ObjectID
                            switch (next_bibid_counter)
                            {
                            case -1:
                                newItem.METS_Header.ObjectID = thisDirectoryInfo.Name;
                                if ((newItem.METS_Header.ObjectID.Length == 16) && (newItem.METS_Header.ObjectID[10] == '_'))
                                {
                                    newItem.VID   = newItem.BibID.Substring(11);
                                    newItem.BibID = newItem.BibID.Substring(0, 10).ToUpper();
                                }
                                break;

                            case -2:
                                newItem.METS_Header.ObjectID = (new FileInfo(metadata[0])).Name;
                                if ((newItem.METS_Header.ObjectID.Length == 16) && (newItem.METS_Header.ObjectID[10] == '_'))
                                {
                                    newItem.VID   = newItem.BibID.Substring(11);
                                    newItem.BibID = newItem.BibID.Substring(0, 10).ToUpper();
                                }
                                break;

                            default:
                                string next_bibid = next_bibid_counter.ToString();
                                next_bibid_counter++;
                                newItem.BibID = (bibid_start + next_bibid.PadLeft(10 - bibid_start.Length, '0')).ToUpper();
                                newItem.VID   = "00001";
                                break;
                            }

                            string errors = String.Empty;
                            if (metadata_type.IndexOf("DUBLIN CORE") >= 0)
                            {
                                // Open a stream to read the indicated import file
                                Stream reader = new FileStream(metadata[0], FileMode.Open, FileAccess.Read);
                                DC_File_ReaderWriter dcreader = new DC_File_ReaderWriter();
                                dcreader.Read_Metadata(reader, newItem, null, out errors);
                            }

                            if (metadata_type.IndexOf("MODS") >= 0)
                            {
                                // Open a stream to read the indicated import file
                                Stream reader = new FileStream(metadata[0], FileMode.Open, FileAccess.Read);
                                MODS_File_ReaderWriter dcreader = new MODS_File_ReaderWriter();
                                dcreader.Read_Metadata(reader, newItem, null, out errors);
                            }

                            if (metadata_type.IndexOf("MARCXML") >= 0)
                            {
                                // Open a stream to read the indicated import file
                                Stream reader = new FileStream(metadata[0], FileMode.Open, FileAccess.Read);
                                MarcXML_File_ReaderWriter dcreader = new MarcXML_File_ReaderWriter();
                                dcreader.Read_Metadata(reader, newItem, null, out errors);
                            }
                        }

                        // Make sure there is a title
                        if (newItem.Bib_Info.Main_Title.ToString().Trim().Length == 0)
                        {
                            newItem.Bib_Info.Main_Title.Title = "Missing Title";
                        }

                        // We now have a good METS file, so let's look for files to add
                        string[]      existing_files    = Directory.GetFiles(thisDirectory);
                        bool          image_files_found = false;
                        List <string> otherFiles        = new List <string>();
                        foreach (string thisFile in existing_files)
                        {
                            string upper_case = new FileInfo(thisFile).Name.ToUpper();
                            if ((upper_case.IndexOf(".TIF") > 0) || (upper_case.IndexOf(".JPG") > 0) || (upper_case.IndexOf(".JP2") > 0))
                            {
                                image_files_found = true;
                            }
                            else if ((upper_case.IndexOf(".METS") < 0) && (upper_case.IndexOf(".TXT") < 0) && (upper_case.IndexOf(".PRO") < 0) && (upper_case.IndexOf(".XML") < 0) && (upper_case.IndexOf(".MODS") < 0) && (upper_case.IndexOf(".DC") < 0))
                            {
                                otherFiles.Add((new FileInfo(thisFile)).Name);
                            }
                        }

                        // Add the image files first
                        newItem.Source_Directory = thisDirectory;
                        Bib_Package_Builder.Add_All_Files(newItem, "*.tif|*.jpg|*.jp2|*.txt|*.pro|*.gif", MetaTemplate_UserSettings.Always_Recurse_Through_Subfolders_On_New, MetaTemplate_UserSettings.Page_Images_In_Seperate_Folders_Can_Be_Same_Page);

                        // Add any downloads next
                        foreach (string thisFile in otherFiles)
                        {
                            newItem.Divisions.Download_Tree.Add_File(thisFile);
                        }

                        // Now, save this METS file
                        // Prepare to save the enw METS

                        // Determine the filename
                        string mets_file = thisDirectory + "\\" + newItem.METS_Header.ObjectID + MetaTemplate_UserSettings.METS_File_Extension;

                        // Save the actual file
                        newItem.Divisions.Suppress_Checksum = !MetaTemplate_UserSettings.Include_Checksums;

                        // Save the actual file
                        METS_File_ReaderWriter metsWriter = new METS_File_ReaderWriter();
                        string writing_error = String.Empty;
                        metsWriter.Write_Metadata(mets_file, newItem, null, out writing_error);
                    }
                }
                catch (Exception ee)
                {
                    errors_encountered++;
                }

                OnNewProgress(current_directory, directories_to_process.Count);
                current_directory++;
            }

            OnComplete(current_directory, errors_encountered);
        }
        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 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
            VRACore_Info vraInfo = Return_Package.Get_Metadata_Module(GlobalVar.VRACORE_METADATA_MODULE_KEY) as VRACore_Info;
            if (vraInfo == null)
            {
                vraInfo = new VRACore_Info();
                Return_Package.Add_Metadata_Module(GlobalVar.VRACORE_METADATA_MODULE_KEY, vraInfo);
            }

            // 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("vra:") == 0)
                        name = name.Substring(4);

                    switch (name)
                    {
                        case "culturalcontext":
                            Input_XmlReader.Read();
                            if (Input_XmlReader.NodeType == XmlNodeType.Text)
                            {
                                if (Input_XmlReader.Value.Length > 0)
                                    vraInfo.Add_Cultural_Context(Input_XmlReader.Value);
                            }
                            break;

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

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

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

                        case "stateedition":
                            Input_XmlReader.Read();
                            if (Input_XmlReader.NodeType == XmlNodeType.Text)
                            {
                                if (Input_XmlReader.Value.Length > 0)
                                    vraInfo.Add_State_Edition(Input_XmlReader.Value);
                            }
                            break;

                        case "styleperiod":
                            Input_XmlReader.Read();
                            if (Input_XmlReader.NodeType == XmlNodeType.Text)
                            {
                                if (Input_XmlReader.Value.Length > 0)
                                    vraInfo.Add_Style_Period(Input_XmlReader.Value);
                            }
                            break;

                        case "technique":
                            Input_XmlReader.Read();
                            if (Input_XmlReader.NodeType == XmlNodeType.Text)
                            {
                                if (Input_XmlReader.Value.Length > 0)
                                    vraInfo.Add_Technique(Input_XmlReader.Value);
                            }
                            break;
                    }
                }
            } while (Input_XmlReader.Read());

            return true;
        }
예제 #42
0
        /// <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.EAD;
            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
                {
                    StringReader  strReader = new StringReader(description_builder.ToString());
                    XmlTextReader reader2   = new XmlTextReader(strReader);

                    // 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() == "ead"))
                            {
                                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("ead"))
                        {
                            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);
        }
        /// <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
            Zoological_Taxonomy_Info taxonInfo = Return_Package.Get_Metadata_Module(GlobalVar.ZOOLOGICAL_TAXONOMY_METADATA_MODULE_KEY) as Zoological_Taxonomy_Info;
            if (taxonInfo == null)
            {
                taxonInfo = new Zoological_Taxonomy_Info();
                Return_Package.Add_Metadata_Module(GlobalVar.ZOOLOGICAL_TAXONOMY_METADATA_MODULE_KEY, 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();
                    if (name.IndexOf("dwc:") == 0)
                        name = name.Substring(4);

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

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

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

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

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

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

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

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

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

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

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

            return true;
        }
        /// <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> Accepts two options: (1) 'METS_File_ReaderWriter:Minimize_File_Info' which tells whether the reader 
        /// should just skip the file reading portion completely, and just read the bibliographic data ( Default is FALSE).
        /// (2) 'METS_File_ReaderWriter:Support_Divisional_dmdSec_amdSec' </remarks>
        public bool Read_Metadata(Stream Input_Stream, SobekCM_Item Return_Package, Dictionary<string, object> Options, out string Error_Message)
        {
            Error_Message = String.Empty;

            // Read the options from the dictionary of options
            bool minimizeFileInfo = false;
            if (Options != null)
            {
                if (Options.ContainsKey("METS_File_ReaderWriter:Minimize_File_Info"))
                    bool.TryParse(Options["METS_File_ReaderWriter:Minimize_File_Info"].ToString(), out minimizeFileInfo);

                if (Options.ContainsKey("METS_File_ReaderWriter:Support_Divisional_dmdSec_amdSec"))
                {
                    bool supportDivisionalDmdSecAmdSec;
                    bool.TryParse(Options["METS_File_ReaderWriter:Support_Divisional_dmdSec_amdSec"].ToString(), out supportDivisionalDmdSecAmdSec);
                }
            }

            // Keep a list of all the files created, by file id, as additional data is gathered
            // from the different locations ( amdSec, fileSec, structmap )
            Dictionary<string, SobekCM_File_Info> files_by_fileid = new Dictionary<string, SobekCM_File_Info>();

            // For now, to do support for old way of doing downloads, build a list to hold
            // the deprecated download files
            List<Download_Info_DEPRECATED> deprecatedDownloads = new List<Download_Info_DEPRECATED>();

            // Need to store the unanalyzed sections of dmdSec and amdSec until we determine if 
            // the scope is the whole package, or the top-level div.  We use lists as the value since
            // several sections may have NO id and the METS may even (incorrectly) have multiple sections
            // with the same ID
            Dictionary<string, List<Unanalyzed_METS_Section>> dmdSec = new Dictionary<string, List<Unanalyzed_METS_Section>>();
            Dictionary<string, List<Unanalyzed_METS_Section>> amdSec = new Dictionary<string, List<Unanalyzed_METS_Section>>();

            // Dictionaries store the link between dmdSec and amdSec id's to single divisions
            Dictionary<string, abstract_TreeNode> division_dmdids = new Dictionary<string, abstract_TreeNode>();
            Dictionary<string, abstract_TreeNode> division_amdids = new Dictionary<string, abstract_TreeNode>();


            try
            {
                // Try to read the XML
                XmlReader r = new XmlTextReader(Input_Stream);

                // Begin stepping through each of the XML nodes
                while (r.Read())
                {
                    #region Handle some processing instructions requested by Florida SUS's / FLVC (hope to deprecate)

                    // Handle some processing instructions requested by Florida SUS's / FLVC
                    if (r.NodeType == XmlNodeType.ProcessingInstruction)
                    {
                        if (r.Name.ToLower() == "fcla")
                        {
                            string value = r.Value.ToLower();
                            if (value.IndexOf("fda=\"yes\"") >= 0)
                            {
                                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);
                                }
                                daitssInfo.toArchive = true;
                            }
                            if (value.IndexOf("fda=\"no\"") >= 0)
                            {
                                DAITSS_Info daitssInfo2 = Return_Package.Get_Metadata_Module(GlobalVar.DAITSS_METADATA_MODULE_KEY) as DAITSS_Info;
                                if (daitssInfo2 == null)
                                {
                                    daitssInfo2 = new DAITSS_Info();
                                    Return_Package.Add_Metadata_Module(GlobalVar.DAITSS_METADATA_MODULE_KEY, daitssInfo2);
                                }
                                daitssInfo2.toArchive = false;
                            }
                        }
                    }

                    #endregion

                    if (r.NodeType == XmlNodeType.Element)
                    {
                        switch (r.Name.Replace("METS:", ""))
                        {
                            case "mets":
                                if (r.MoveToAttribute("OBJID"))
                                    Return_Package.METS_Header.ObjectID = r.Value;
                                break;

                            case "metsHdr":
                                read_mets_header(r.ReadSubtree(), Return_Package);
                                break;

                            case "dmdSec":
                            case "dmdSecFedora":
                                Unanalyzed_METS_Section thisDmdSec = store_dmd_sec(r.ReadSubtree());
                                if ( dmdSec.ContainsKey(thisDmdSec.ID))
                                    dmdSec[thisDmdSec.ID].Add(thisDmdSec);
                                else
                                {
                                    List<Unanalyzed_METS_Section> newDmdSecList = new List<Unanalyzed_METS_Section>();
                                    newDmdSecList.Add(thisDmdSec);
                                    dmdSec[thisDmdSec.ID] = newDmdSecList;
                                }
                                
                                break;

                            case "amdSec":
                                Unanalyzed_METS_Section thisAmdSec = store_amd_sec(r.ReadSubtree());
                                if (amdSec.ContainsKey(thisAmdSec.ID))
                                    amdSec[thisAmdSec.ID].Add(thisAmdSec);
                                else
                                {
                                    List<Unanalyzed_METS_Section> newAmdSecList = new List<Unanalyzed_METS_Section> {thisAmdSec};
                                    amdSec[thisAmdSec.ID] = newAmdSecList;
                                }
                                break;

                            case "fileSec":
                                read_file_sec(r.ReadSubtree(), minimizeFileInfo, files_by_fileid);
                                break;

                            case "structMap":
                                if (!r.IsEmptyElement)
                                {
                                    read_struct_map(r.ReadSubtree(), Return_Package, files_by_fileid, division_dmdids, division_amdids);
                                }
                                break;

                            case "behaviorSec":
                                read_behavior_sec(r.ReadSubtree(), Return_Package);
                                break;
                        }
                    }
                }

                // writer.Close();
                r.Close();

            }
            catch 
            {
                // Do nothinh
            }

            Input_Stream.Close();

            // Load some options for interoperability
            Dictionary<string, object> options = new Dictionary<string, object>();
            options.Add("SobekCM_FileInfo_METS_amdSec_ReaderWriter:Files_By_FileID", files_by_fileid);

            #region Process the previously stored dmd sections

            // Now, process the previously stored dmd sections
            foreach (string thisDmdSecId in dmdSec.Keys)
            {
                // Could be multiple stored sections with the same (or no) ID
                foreach (Unanalyzed_METS_Section metsSection in dmdSec[thisDmdSecId])
                {
                    XmlReader reader = XmlReader.Create(new StringReader(metsSection.Inner_XML));
                    string mdtype = String.Empty;
                    string othermdtype = String.Empty;
                    while (reader.Read())
                    {
                        if (reader.NodeType == XmlNodeType.Element)
                        {
                            if (reader.Name.ToLower().Replace("mets:", "") == "mdwrap")
                            {

                                if (reader.MoveToAttribute("MDTYPE"))
                                    mdtype = reader.Value;
                                if (reader.MoveToAttribute("OTHERMDTYPE"))
                                    othermdtype = reader.Value;

                                // NOt crazy about this part, but sometimes people do not use the OTHERMDTYPE
                                // tag correctly, and just use the LABEL to differentiate the types
                                if ((mdtype == "OTHER") && (othermdtype.Length == 0) && (reader.MoveToAttribute("LABEL")))
                                    othermdtype = reader.Value;

                                // Now, determine if this was a division-level read, or a package-wide
                                if (division_dmdids.ContainsKey(thisDmdSecId))
                                {
                                    // Division level dmdSec
                                    // Get the division
                                    abstract_TreeNode node = division_dmdids[thisDmdSecId];

                                    // Get an appropriate reader from the metadata configuration
                                    iDivision_dmdSec_ReaderWriter rw = ResourceObjectSettings.MetadataConfig.Get_Division_DmdSec_ReaderWriter(mdtype, othermdtype);

                                    // Is this dmdSec analyzable? (i.e., did we find an appropriate reader/writer?)
                                    if (rw == null)
                                    {
                                        node.Add_Unanalyzed_DMDSEC(metsSection);
                                    }
                                    else
                                    {
                                        rw.Read_dmdSec(reader, node, options);
                                    }
                                }
                                else
                                {
                                    // Package-level dmdSec 
                                    // Get an appropriate reader from the metadata configuration
                                    iPackage_dmdSec_ReaderWriter rw = ResourceObjectSettings.MetadataConfig.Get_Package_DmdSec_ReaderWriter(mdtype, othermdtype);

                                    // Is this dmdSec analyzable? (i.e., did we find an appropriate reader/writer?)
                                    if (rw == null)
                                    {
                                        Return_Package.Add_Unanalyzed_DMDSEC(metsSection);
                                    }
                                    else
                                    {
                                        rw.Read_dmdSec(reader, Return_Package, options);
                                    }
                                }
                            }
                        }
                    }
                }
            }

            #endregion

            #region Process the previously stored amd sections

            // Now, process the previously stored amd sections
            foreach (string thisAmdSecId in amdSec.Keys)
            {
                // Could be multiple stored sections with the same (or no) ID
                foreach (Unanalyzed_METS_Section metsSection in amdSec[thisAmdSecId])
                {
                    XmlReader reader = XmlReader.Create(new StringReader(metsSection.Inner_XML));
                    string mdtype = String.Empty;
                    string othermdtype = String.Empty;
                    while (reader.Read())
                    {
                        if (reader.NodeType == XmlNodeType.Element)
                        {
                            if (reader.Name.ToLower().Replace("mets:", "") == "mdwrap")
                            {

                                if (reader.MoveToAttribute("MDTYPE"))
                                    mdtype = reader.Value;
                                if (reader.MoveToAttribute("OTHERMDTYPE"))
                                    othermdtype = reader.Value;

                                // Package-level amdSec 
                                // Get an appropriate reader from the metadata configuration
                                iPackage_amdSec_ReaderWriter rw = ResourceObjectSettings.MetadataConfig.Get_Package_AmdSec_ReaderWriter(mdtype, othermdtype);

                                // Is this amdSec analyzable? (i.e., did we find an appropriate reader/writer?)
                                if (rw == null)
                                {
                                    Return_Package.Add_Unanalyzed_AMDSEC(metsSection);
                                }
                                else
                                {
                                    rw.Read_amdSec(reader, Return_Package, options);
                                }
                            }
                        }
                    }
                }
            }

            #endregion

            #region Special code used for moving downloads into the structure map system, and out of the old SobekCM METS section 

            // For backward compatability, move from the old download system to the
            // new structure.  This has to happen here at the end so that we have access

            // Were there some downloads added here?
            if (deprecatedDownloads.Count > 0)
            {
                // Get the list of downloads from the download tree
                List<SobekCM_File_Info> newStructureDownloads = Return_Package.Divisions.Download_Tree.All_Files;

                // Step through each download in the old system
                foreach (Download_Info_DEPRECATED thisDownload in deprecatedDownloads)
                {
                    // Get the label (if there is one)
                    string label = thisDownload.Label;
                    string filename = thisDownload.FileName;
                    bool found = false;
                    if ((filename.Length == 0) && (thisDownload.File_ID.Length > 0))
                    {
                        if (files_by_fileid.ContainsKey(thisDownload.File_ID))
                        {
                            SobekCM_File_Info thisDownloadFile = files_by_fileid[thisDownload.File_ID];
                            filename = thisDownloadFile.System_Name;

                            // Ensure a file of this name doesn't already exist
                            foreach (SobekCM_File_Info existingFile in newStructureDownloads)
                            {
                                if (existingFile.System_Name.ToUpper().Trim() == filename.ToUpper().Trim())
                                {
                                    found = true;
                                    break;
                                }
                            }

                            // Not found, so add it
                            if (!found)
                            {
                                // Determine the label if it was missing or identical to file name
                                if ((label.Length == 0) || (label == filename))
                                {
                                    label = filename;
                                    int first_period_index = label.IndexOf('.');
                                    if (first_period_index > 0)
                                    {
                                        label = label.Substring(0, first_period_index);
                                    }
                                }

                                // Add the root to the download tree, if not existing
                                Division_TreeNode newRoot;
                                if (Return_Package.Divisions.Download_Tree.Roots.Count == 0)
                                {
                                    newRoot = new Division_TreeNode("Main", String.Empty);
                                    Return_Package.Divisions.Download_Tree.Roots.Add(newRoot);
                                }
                                else
                                {
                                    newRoot = (Division_TreeNode) Return_Package.Divisions.Download_Tree.Roots[0];
                                }

                                // Add a page for this, with the provided label if there was one
                                Page_TreeNode newPage = new Page_TreeNode(label);
                                newRoot.Nodes.Add(newPage);

                                // Now, add this existing file
                                newPage.Files.Add(thisDownloadFile);

                                // Add to the list of files added (in case it appears twice)
                                newStructureDownloads.Add(thisDownloadFile);
                            }
                        }
                    }
                    else
                    {
                        // Ensure a file of this name doesn't already exist
                        foreach (SobekCM_File_Info existingFile in newStructureDownloads)
                        {
                            if (existingFile.System_Name.ToUpper().Trim() == filename.ToUpper().Trim())
                            {
                                found = true;
                                break;
                            }
                        }

                        // Not found, so add it
                        if (!found)
                        {
                            // Determine the label if it was missing or identical to file name
                            if ((label.Length == 0) || (label == filename))
                            {
                                label = filename;
                                int first_period_index = label.IndexOf('.');
                                if (first_period_index > 0)
                                {
                                    label = label.Substring(0, first_period_index);
                                }
                            }

                            // Add the root to the download tree, if not existing
                            Division_TreeNode newRoot;
                            if (Return_Package.Divisions.Download_Tree.Roots.Count == 0)
                            {
                                newRoot = new Division_TreeNode("Main", String.Empty);
                                Return_Package.Divisions.Download_Tree.Roots.Add(newRoot);
                            }
                            else
                            {
                                newRoot = (Division_TreeNode) Return_Package.Divisions.Download_Tree.Roots[0];
                            }

                            // Add a page for this, with the provided label if there was one
                            Page_TreeNode newPage = new Page_TreeNode(label);
                            newRoot.Nodes.Add(newPage);

                            // Now, add this existing file
                            SobekCM_File_Info thisDownloadFile = new SobekCM_File_Info(filename);
                            newPage.Files.Add(thisDownloadFile);

                            // Add to the list of files added (in case it appears twice)
                            newStructureDownloads.Add(thisDownloadFile);
                        }
                    }
                }
            }

            #endregion

            #region Special code for distributing any page-level coordinate information read from the old SobekCM coordinate metadata

            // Get the geospatial data
            GeoSpatial_Information geoSpatial = Return_Package.Get_Metadata_Module(GlobalVar.GEOSPATIAL_METADATA_MODULE_KEY) as GeoSpatial_Information;
            if ((geoSpatial != null) && ( geoSpatial.Polygon_Count > 0 ))
            {
                // See if any has the page sequence filled out, which means it came from the old metadata system
                bool redistribute = false;
                foreach (Coordinate_Polygon thisPolygon in geoSpatial.Polygons)
                {
                    if (thisPolygon.Page_Sequence > 0)
                    {
                        redistribute = true;
                        break;
                    }
                }

                // If we need to redistribute, get started!
                if (redistribute)
                {
                    // Get the pages, by sequence
                    List<abstract_TreeNode> pagesBySequence = Return_Package.Divisions.Physical_Tree.Pages_PreOrder;
                    List<Coordinate_Polygon> polygonsToRemove = new List<Coordinate_Polygon>();

                    // Step through each polygon
                    foreach (Coordinate_Polygon thisPolygon in geoSpatial.Polygons)
                    {
                        if ((thisPolygon.Page_Sequence > 0) && ( thisPolygon.Page_Sequence <= pagesBySequence.Count ))
                        {
                            // Get the page
                            abstract_TreeNode thisPageFromSequence = pagesBySequence[thisPolygon.Page_Sequence - 1];

                            // We can assume this page does not already have the coordiantes
                            GeoSpatial_Information thisPageCoord = new GeoSpatial_Information();
                            thisPageFromSequence.Add_Metadata_Module( GlobalVar.GEOSPATIAL_METADATA_MODULE_KEY, thisPageCoord );
                            thisPageCoord.Add_Polygon( thisPolygon);

                            // Remove this from the package-level coordinates
                            polygonsToRemove.Add(thisPolygon);
                        }
                    }

                    // Now, remove all polygons flagged to be removed
                    foreach (Coordinate_Polygon thisPolygon in polygonsToRemove)
                    {
                        geoSpatial.Remove_Polygon(thisPolygon);
                    }
                }
            }

            #endregion

            #region Copy any serial hierarchy in the Behaviors.Serial_Info part into the bib portion, if not there

            // Do some final cleanup on the SERIAL HIERARCHY
            if ((Return_Package.Behaviors.hasSerialInformation) && (Return_Package.Behaviors.Serial_Info.Count > 0))
            {
                if ((Return_Package.Bib_Info.Series_Part_Info.Enum1.Length == 0) && (Return_Package.Bib_Info.Series_Part_Info.Year.Length == 0))
                {
                    if (Return_Package.Bib_Info.SobekCM_Type == TypeOfResource_SobekCM_Enum.Newspaper)
                    {
                        Return_Package.Bib_Info.Series_Part_Info.Year = Return_Package.Behaviors.Serial_Info[0].Display;
                        Return_Package.Bib_Info.Series_Part_Info.Year_Index = Return_Package.Behaviors.Serial_Info[0].Order;

                        if (Return_Package.Behaviors.Serial_Info.Count > 1)
                        {
                            Return_Package.Bib_Info.Series_Part_Info.Month = Return_Package.Behaviors.Serial_Info[1].Display;
                            Return_Package.Bib_Info.Series_Part_Info.Month_Index = Return_Package.Behaviors.Serial_Info[1].Order;
                        }
                    }

                    if (Return_Package.Behaviors.Serial_Info.Count > 2)
                    {
                        Return_Package.Bib_Info.Series_Part_Info.Day = Return_Package.Behaviors.Serial_Info[2].Display;
                        Return_Package.Bib_Info.Series_Part_Info.Day_Index = Return_Package.Behaviors.Serial_Info[2].Order;
                    }
                }
                else
                {
                    Return_Package.Bib_Info.Series_Part_Info.Enum1 = Return_Package.Behaviors.Serial_Info[0].Display;
                    Return_Package.Bib_Info.Series_Part_Info.Enum1_Index = Return_Package.Behaviors.Serial_Info[0].Order;

                    if (Return_Package.Behaviors.Serial_Info.Count > 1)
                    {
                        Return_Package.Bib_Info.Series_Part_Info.Enum2 = Return_Package.Behaviors.Serial_Info[1].Display;
                        Return_Package.Bib_Info.Series_Part_Info.Enum2_Index = Return_Package.Behaviors.Serial_Info[1].Order;
                    }

                    if (Return_Package.Behaviors.Serial_Info.Count > 2)
                    {
                        Return_Package.Bib_Info.Series_Part_Info.Enum3 = Return_Package.Behaviors.Serial_Info[2].Display;
                        Return_Package.Bib_Info.Series_Part_Info.Enum3_Index = Return_Package.Behaviors.Serial_Info[2].Order;
                    }
                }
            }

            #endregion

            return true;
        }
예제 #45
0
        /// <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);
            }
        }
예제 #46
0
        private void Finish_Building_Item(SobekCM_Item Package_To_Finalize, DataSet DatabaseInfo, bool Multiple, Custom_Tracer Tracer)
        {
            Tracer.Add_Trace("SobekCM_METS_Based_ItemBuilder.Finish_Building_Item", "Load the data from the database into the resource object");

            if ((DatabaseInfo == null) || (DatabaseInfo.Tables[2] == null) || (DatabaseInfo.Tables[2].Rows.Count == 0))
            {
                Tracer.Add_Trace("SobekCM_METS_Based_ItemBuilder.Finish_Building_Item", "Invalid data from the database, either not enough tables, or no rows in Tables[2]");
            }
            else
            {
                // Copy over some basic values
                DataRow mainItemRow = DatabaseInfo.Tables[2].Rows[0];
                Package_To_Finalize.Behaviors.Set_Primary_Identifier(mainItemRow["Primary_Identifier_Type"].ToString(), mainItemRow["Primary_Identifier"].ToString());
                Package_To_Finalize.Behaviors.GroupTitle = mainItemRow["GroupTitle"].ToString();
                Package_To_Finalize.Behaviors.GroupType  = mainItemRow["GroupType"].ToString();
                Package_To_Finalize.Web.File_Root        = mainItemRow["File_Location"].ToString();
                Package_To_Finalize.Web.AssocFilePath    = mainItemRow["File_Location"] + "\\" + Package_To_Finalize.VID + "\\";
                Package_To_Finalize.Behaviors.IP_Restriction_Membership = Convert.ToInt16(mainItemRow["IP_Restriction_Mask"]);
                Package_To_Finalize.Behaviors.CheckOut_Required         = Convert.ToBoolean(mainItemRow["CheckoutRequired"]);
                Package_To_Finalize.Behaviors.Text_Searchable           = Convert.ToBoolean(mainItemRow["TextSearchable"]);
                Package_To_Finalize.Web.ItemID  = Convert.ToInt32(mainItemRow["ItemID"]);
                Package_To_Finalize.Web.GroupID = Convert.ToInt32(mainItemRow["GroupID"]);
                Package_To_Finalize.Behaviors.Suppress_Endeca = Convert.ToBoolean(mainItemRow["SuppressEndeca"]);
                //Package_To_Finalize.Behaviors.Expose_Full_Text_For_Harvesting = Convert.ToBoolean(mainItemRow["SuppressEndeca"]);
                Package_To_Finalize.Tracking.Internal_Comments = mainItemRow["Comments"].ToString();
                Package_To_Finalize.Behaviors.Dark_Flag        = Convert.ToBoolean(mainItemRow["Dark"]);
                Package_To_Finalize.Tracking.Born_Digital      = Convert.ToBoolean(mainItemRow["Born_Digital"]);
                Package_To_Finalize.Behaviors.Main_Thumbnail   = mainItemRow["MainThumbnail"].ToString();
                //Package_To_Finalize.Divisions.Page_Count = Convert.ToInt32(mainItemRow["Pages"]);
                if (mainItemRow["Disposition_Advice"] != DBNull.Value)
                {
                    Package_To_Finalize.Tracking.Disposition_Advice = Convert.ToInt16(mainItemRow["Disposition_Advice"]);
                }
                else
                {
                    Package_To_Finalize.Tracking.Disposition_Advice = -1;
                }
                if (mainItemRow["Material_Received_Date"] != DBNull.Value)
                {
                    Package_To_Finalize.Tracking.Material_Received_Date = Convert.ToDateTime(mainItemRow["Material_Received_Date"]);
                }
                else
                {
                    Package_To_Finalize.Tracking.Material_Received_Date = null;
                }
                if (mainItemRow["Material_Recd_Date_Estimated"] != DBNull.Value)
                {
                    Package_To_Finalize.Tracking.Material_Rec_Date_Estimated = Convert.ToBoolean(mainItemRow["Material_Recd_Date_Estimated"]);
                }
                if (DatabaseInfo.Tables[2].Columns.Contains("Tracking_Box"))
                {
                    if (mainItemRow["Tracking_Box"] != DBNull.Value)
                    {
                        Package_To_Finalize.Tracking.Tracking_Box = mainItemRow["Tracking_Box"].ToString();
                    }
                }
                if (mainItemRow["CitationSet"] != DBNull.Value)
                {
                    Package_To_Finalize.Behaviors.CitationSet = mainItemRow["CitationSet"].ToString();
                }

                // Set more of the sobekcm web portions in the item
                Package_To_Finalize.Web.Set_BibID_VID(Package_To_Finalize.BibID, Package_To_Finalize.VID);
                Package_To_Finalize.Web.Image_Root = Engine_ApplicationCache_Gateway.Settings.Servers.Image_URL;
                if (Multiple)
                {
                    Package_To_Finalize.Web.Siblings = 2;
                }

                // Set the serial hierarchy from the database (if multiple)
                if ((Multiple) && (mainItemRow["Level1_Text"].ToString().Length > 0))
                {
                    Tracer.Add_Trace("SobekCM_METS_Based_ItemBuilder.Finish_Building_Item", "Assigning serial hierarchy from the database info");

                    bool found = false;

                    // Get the values from the database first
                    string level1_text  = mainItemRow["Level1_Text"].ToString();
                    string level2_text  = mainItemRow["Level2_Text"].ToString();
                    string level3_text  = mainItemRow["Level3_Text"].ToString();
                    int    level1_index = Convert.ToInt32(mainItemRow["Level1_Index"]);
                    int    level2_index = Convert.ToInt32(mainItemRow["Level2_Index"]);
                    int    level3_index = Convert.ToInt32(mainItemRow["Level3_Index"]);

                    // Does this match the enumeration
                    if (level1_text.ToUpper().Trim() == Package_To_Finalize.Bib_Info.Series_Part_Info.Enum1.ToUpper().Trim())
                    {
                        // Copy the database values to the enumeration portion
                        Package_To_Finalize.Bib_Info.Series_Part_Info.Enum1       = level1_text;
                        Package_To_Finalize.Bib_Info.Series_Part_Info.Enum1_Index = level1_index;
                        Package_To_Finalize.Bib_Info.Series_Part_Info.Enum2       = level2_text;
                        Package_To_Finalize.Bib_Info.Series_Part_Info.Enum2_Index = level2_index;
                        Package_To_Finalize.Bib_Info.Series_Part_Info.Enum3       = level3_text;
                        Package_To_Finalize.Bib_Info.Series_Part_Info.Enum3_Index = level3_index;
                        found = true;
                    }

                    // Does this match the chronology
                    if ((!found) && (level1_text.ToUpper().Trim() == Package_To_Finalize.Bib_Info.Series_Part_Info.Year.ToUpper().Trim()))
                    {
                        // Copy the database values to the chronology portion
                        Package_To_Finalize.Bib_Info.Series_Part_Info.Year        = level1_text;
                        Package_To_Finalize.Bib_Info.Series_Part_Info.Year_Index  = level1_index;
                        Package_To_Finalize.Bib_Info.Series_Part_Info.Month       = level2_text;
                        Package_To_Finalize.Bib_Info.Series_Part_Info.Month_Index = level2_index;
                        Package_To_Finalize.Bib_Info.Series_Part_Info.Day         = level3_text;
                        Package_To_Finalize.Bib_Info.Series_Part_Info.Day_Index   = level3_index;
                        found = true;
                    }

                    if (!found)
                    {
                        // No match.  If it is numeric, move it to the chronology, otherwise, enumeration
                        bool charFound = level1_text.Trim().Any(ThisChar => !Char.IsNumber(ThisChar));

                        if (charFound)
                        {
                            // Copy the database values to the enumeration portion
                            Package_To_Finalize.Bib_Info.Series_Part_Info.Enum1       = level1_text;
                            Package_To_Finalize.Bib_Info.Series_Part_Info.Enum1_Index = level1_index;
                            Package_To_Finalize.Bib_Info.Series_Part_Info.Enum2       = level2_text;
                            Package_To_Finalize.Bib_Info.Series_Part_Info.Enum2_Index = level2_index;
                            Package_To_Finalize.Bib_Info.Series_Part_Info.Enum3       = level3_text;
                            Package_To_Finalize.Bib_Info.Series_Part_Info.Enum3_Index = level3_index;
                        }
                        else
                        {
                            // Copy the database values to the chronology portion
                            Package_To_Finalize.Bib_Info.Series_Part_Info.Year        = level1_text;
                            Package_To_Finalize.Bib_Info.Series_Part_Info.Year_Index  = level1_index;
                            Package_To_Finalize.Bib_Info.Series_Part_Info.Month       = level2_text;
                            Package_To_Finalize.Bib_Info.Series_Part_Info.Month_Index = level2_index;
                            Package_To_Finalize.Bib_Info.Series_Part_Info.Day         = level3_text;
                            Package_To_Finalize.Bib_Info.Series_Part_Info.Day_Index   = level3_index;
                        }
                    }

                    // Copy the database values to the simple serial portion (used to actually determine serial heirarchy)
                    Package_To_Finalize.Behaviors.Serial_Info.Clear();
                    Package_To_Finalize.Behaviors.Serial_Info.Add_Hierarchy(1, level1_index, level1_text);
                    if (level2_text.Length > 0)
                    {
                        Package_To_Finalize.Behaviors.Serial_Info.Add_Hierarchy(2, level2_index, level2_text);
                        if (level3_text.Length > 0)
                        {
                            Package_To_Finalize.Behaviors.Serial_Info.Add_Hierarchy(3, level3_index, level3_text);
                        }
                    }
                }

                // See if this can be described
                bool can_describe = false;
                foreach (DataRow thisRow in DatabaseInfo.Tables[1].Rows)
                {
                    int thisAggregationValue = Convert.ToInt16(thisRow["Items_Can_Be_Described"]);
                    if (thisAggregationValue == 0)
                    {
                        can_describe = false;
                        break;
                    }
                    if (thisAggregationValue == 2)
                    {
                        can_describe = true;
                    }
                }
                Package_To_Finalize.Behaviors.Can_Be_Described = can_describe;

                // Look for rights information to add
                if (mainItemRow["EmbargoEnd"] != DBNull.Value)
                {
                    try
                    {
                        DateTime embargoEnd     = DateTime.Parse(mainItemRow["EmbargoEnd"].ToString());
                        string   origAccessCode = mainItemRow["Original_AccessCode"].ToString();

                        // Is there already a RightsMD module in the item?
                        // Ensure this metadata module extension exists
                        RightsMD_Info rightsInfo = Package_To_Finalize.Get_Metadata_Module(GlobalVar.PALMM_RIGHTSMD_METADATA_MODULE_KEY) as RightsMD_Info;
                        if (rightsInfo == null)
                        {
                            rightsInfo = new RightsMD_Info();
                            Package_To_Finalize.Add_Metadata_Module(GlobalVar.PALMM_RIGHTSMD_METADATA_MODULE_KEY, rightsInfo);
                        }

                        // Add the data
                        rightsInfo.Access_Code_String = origAccessCode;
                        rightsInfo.Embargo_End        = embargoEnd;
                    }
                    catch (Exception)
                    {
                    }
                }
            }

            // Look for user descriptions
            Tracer.Add_Trace("SobekCM_METS_Based_ItemBuilder.Finish_Building_Item", "Look for user descriptions (or tags)");
            foreach (DataRow thisRow in DatabaseInfo.Tables[0].Rows)
            {
                string   first_name = thisRow["FirstName"].ToString();
                string   nick_name  = thisRow["NickName"].ToString();
                string   last_name  = thisRow["LastName"].ToString();
                int      userid     = Convert.ToInt32(thisRow["UserID"]);
                string   tag        = thisRow["Description_Tag"].ToString();
                int      tagid      = Convert.ToInt32(thisRow["TagID"]);
                DateTime dateAdded  = Convert.ToDateTime(thisRow["Date_Modified"]);

                if (nick_name.Length > 0)
                {
                    Package_To_Finalize.Behaviors.Add_User_Tag(userid, nick_name + " " + last_name, tag, dateAdded, tagid);
                }
                else
                {
                    Package_To_Finalize.Behaviors.Add_User_Tag(userid, first_name + " " + last_name, tag, dateAdded, tagid);
                }
            }

            // Look for ticklers
            Tracer.Add_Trace("SobekCM_METS_Based_ItemBuilder.Finish_Building_Item", "Load ticklers from the database info");
            foreach (DataRow thisRow in DatabaseInfo.Tables[3].Rows)
            {
                Package_To_Finalize.Behaviors.Add_Tickler(thisRow["MetadataValue"].ToString().Trim());
            }

            // Set the aggregations in the package to the aggregation links from the database
            Tracer.Add_Trace("SobekCM_METS_Based_ItemBuilder.Finish_Building_Item", "Load the aggregations from the database info");
            Package_To_Finalize.Behaviors.Clear_Aggregations();
            foreach (DataRow thisRow in DatabaseInfo.Tables[1].Rows)
            {
                if (!Convert.ToBoolean(thisRow["impliedLink"]))
                {
                    string code = thisRow["Code"].ToString();
                    if (String.Compare(code, "all", StringComparison.OrdinalIgnoreCase) != 0)
                    {
                        Package_To_Finalize.Behaviors.Add_Aggregation(code, thisRow["Name"].ToString(), thisRow["Type"].ToString());
                    }
                }
            }

            // If no collections, add some regardless of whether it was IMPLIED
            if (Package_To_Finalize.Behaviors.Aggregation_Count == 0)
            {
                foreach (DataRow thisRow in DatabaseInfo.Tables[1].Rows)
                {
                    string code = thisRow["Code"].ToString();
                    if (String.Compare(code, "all", StringComparison.OrdinalIgnoreCase) != 0)
                    {
                        Package_To_Finalize.Behaviors.Add_Aggregation(code, thisRow["Name"].ToString(), thisRow["Type"].ToString());
                    }
                }
            }

            // Make sure no icons were retained from the METS file itself
            Tracer.Add_Trace("SobekCM_METS_Based_ItemBuilder.Finish_Building_Item", "Load the wordmarks/icons from the database info");
            Package_To_Finalize.Behaviors.Clear_Wordmarks();

            // Add the icons from the database information
            foreach (DataRow iconRow in DatabaseInfo.Tables[5].Rows)
            {
                string image = iconRow[0].ToString();
                string link  = iconRow[1].ToString().Replace("&", "&amp;").Replace("\"", "&quot;");
                string code  = iconRow[2].ToString();
                string name  = iconRow[3].ToString();
                if (name.Length == 0)
                {
                    name = code.Replace("&", "&amp;").Replace("\"", "&quot;");
                }

                string html;
                if (link.Length == 0)
                {
                    html = "<img class=\"SobekItemWordmark\" src=\"<%BASEURL%>design/wordmarks/" + image + "\" title=\"" + name + "\" alt=\"" + name + "\" />";
                }
                else
                {
                    if (link[0] == '?')
                    {
                        html = "<a href=\"" + link + "\"><img class=\"SobekItemWordmark\" src=\"<%BASEURL%>design/wordmarks/" + image + "\" alt=\"" + name + "\" /></a>";
                    }
                    else
                    {
                        html = "<a href=\"" + link + "\" target=\"_blank\"><img class=\"SobekItemWordmark\" src=\"<%BASEURL%>design/wordmarks/" + image + "\" alt=\"" + name + "\" /></a>";
                    }
                }

                Wordmark_Info newIcon = new Wordmark_Info {
                    HTML = html, Link = link, Title = name, Code = code
                };
                Package_To_Finalize.Behaviors.Add_Wordmark(newIcon);
            }

            // Make sure no web skins were retained from the METS file itself
            Tracer.Add_Trace("SobekCM_METS_Based_ItemBuilder.Finish_Building_Item", "Load the web skins from the database info");
            Package_To_Finalize.Behaviors.Clear_Web_Skins();

            // Add the web skins from the database
            foreach (DataRow skinRow in DatabaseInfo.Tables[6].Rows)
            {
                Package_To_Finalize.Behaviors.Add_Web_Skin(skinRow[0].ToString().ToUpper());
            }

            // Add the key/value settings
            foreach (DataRow settingRow in DatabaseInfo.Tables[7].Rows)
            {
                Package_To_Finalize.Behaviors.Settings.Add(new Tuple <string, string>(settingRow["Setting_Key"].ToString(), settingRow["Setting_Value"].ToString()));
            }

            Tracer.Add_Trace("SobekCM_METS_Based_ItemBuilder.Finish_Building_Item", "Set the views from a combination of the METS and the database info");

            // Make sure no views were retained from the METS file itself
            Package_To_Finalize.Behaviors.Clear_Views();

            // If there is no PURL, add one based on how SobekCM operates
            if (Package_To_Finalize.Bib_Info.Location.PURL.Length == 0)
            {
                Package_To_Finalize.Bib_Info.Location.PURL = Engine_ApplicationCache_Gateway.Settings.Servers.System_Base_URL + Package_To_Finalize.BibID + "/" + Package_To_Finalize.VID;
            }

            // If this is a newspaper, and there is no datecreated, see if we
            // can make one from the  serial hierarchy
            if (Package_To_Finalize.Behaviors.GroupType.ToUpper() == "NEWSPAPER")
            {
                if ((Package_To_Finalize.Bib_Info.Origin_Info.Date_Created.Length == 0) && (Package_To_Finalize.Bib_Info.Origin_Info.Date_Issued.Length == 0))
                {
                    // Is the serial hierarchy three deep?
                    if (Package_To_Finalize.Behaviors.hasSerialInformation)
                    {
                        if (Package_To_Finalize.Behaviors.Serial_Info.Count == 3)
                        {
                            int year;

                            if (Int32.TryParse(Package_To_Finalize.Behaviors.Serial_Info[0].Display, out year))
                            {
                                int day;
                                if (Int32.TryParse(Package_To_Finalize.Behaviors.Serial_Info[2].Display, out day))
                                {
                                    if ((year > 0) && (year < DateTime.Now.Year + 2) && (day > 0) && (day <= 31))
                                    {
                                        // Is the month a number?
                                        int month;
                                        if (Int32.TryParse(Package_To_Finalize.Behaviors.Serial_Info[1].Display, out month))
                                        {
                                            try
                                            {
                                                // Do it this way since hopefully that will work for localization issues
                                                DateTime date = new DateTime(year, month, day);
                                                Package_To_Finalize.Bib_Info.Origin_Info.Date_Created = date.ToShortDateString();
                                            }
                                            catch
                                            {
                                                // If this is an invalid date, catch the error and do nothing
                                            }
                                        }
                                        else
                                        {
                                            Package_To_Finalize.Bib_Info.Origin_Info.Date_Created = Package_To_Finalize.Behaviors.Serial_Info[1].Display + " " + day + ", " + year;
                                        }
                                    }
                                }
                            }
                        }
                        else if (Package_To_Finalize.Behaviors.Serial_Info.Count == 2)
                        {
                            int year;
                            if (Int32.TryParse(Package_To_Finalize.Behaviors.Serial_Info[0].Display, out year))
                            {
                                if ((year > 0) && (year < DateTime.Now.Year + 2) && (Package_To_Finalize.Behaviors.Serial_Info[1].Display.Length > 0))
                                {
                                    Package_To_Finalize.Bib_Info.Origin_Info.Date_Created = Package_To_Finalize.Behaviors.Serial_Info[1].Display + " " + year;
                                }
                            }
                        }
                    }
                }
            }

            // Check to see which views were present from the database, and build the list
            foreach (DataRow viewRow in DatabaseInfo.Tables[4].Rows)
            {
                string viewType  = viewRow[0].ToString();
                string attribute = viewRow[1].ToString();
                string label     = viewRow[2].ToString();
                float  menuOrder = float.Parse(viewRow[3].ToString());
                bool   exclude   = bool.Parse(viewRow[4].ToString());

                Package_To_Finalize.Behaviors.Add_View(viewType, label, attribute, menuOrder, exclude);
            }

            // IF this is dark, add no other views
            if (Package_To_Finalize.Behaviors.Dark_Flag)
            {
                return;
            }

            // We will continue to set the static page count
            // Step through each page and set the static page count
            Tracer.Add_Trace("SobekCM_METS_Based_ItemBuilder.Finish_Building_Item", "Set the static page count");
            pageseq = 0;
            List <Page_TreeNode> pages_encountered = new List <Page_TreeNode>();

            foreach (abstract_TreeNode rootNode in Package_To_Finalize.Divisions.Physical_Tree.Roots)
            {
                recurse_through_nodes(rootNode, pages_encountered);
            }
            Package_To_Finalize.Web.Static_PageCount = pages_encountered.Count;

            Tracer.Add_Trace("SobekCM_METS_Based_ItemBuilder.Finish_Building_Item", "Done merging the database information with the resource object");
        }
        private void read_mets_header(XmlReader r, SobekCM_Item package)
        {
            // Since we are now using child trees, read here to get to the first (top-level) element
            r.Read();

            // Is this an empty element?
            bool isEmptyMetsHeader = r.IsEmptyElement;

            // Read the attributes on the METS header first
            if (r.MoveToAttribute("CREATEDATE"))
            {
                DateTime outDate1;
                if (DateTime.TryParse(r.Value.Replace("T", " ").Replace("Z", ""), out outDate1))
                    package.METS_Header.Create_Date = outDate1;
            }
            if (r.MoveToAttribute("LASTMODDATE"))
            {
                DateTime outDate2;
                if (DateTime.TryParse(r.Value.Replace("T", " ").Replace("Z", ""), out outDate2))
                    package.METS_Header.Modify_Date = outDate2;
            }
            if (r.MoveToAttribute("RECORDSTATUS"))
                package.METS_Header.RecordStatus = r.Value;
            if (r.MoveToAttribute("ID"))
                package.METS_Header.ObjectID = r.Value;

            // If this appears to be BibID_VID format, then assign those as well
            package.BibID = package.METS_Header.ObjectID;
            if ((package.METS_Header.ObjectID.Length == 16) && (package.METS_Header.ObjectID[10] == '_'))
            {
                bool char_found = false;
                foreach (char thisChar in package.METS_Header.ObjectID.Substring(11))
                {
                    if (!char.IsNumber(thisChar))
                    {
                        char_found = true;
                    }
                }
                if (!char_found)
                {
                    string objectid = package.METS_Header.ObjectID;
                    package.BibID = objectid.Substring(0, 10);
                    package.VID = objectid.Substring(11);
                }
            }

            // If this is an empty METS header, skip the rest
            if (isEmptyMetsHeader)
                return;

            // Loop through reading each XML node
            int agent_type = -1;
            while (r.Read())
            {
                // If this is the end of this section, return
                if (r.NodeType == XmlNodeType.EndElement)
                {
                    if ((r.Name == "METS:metsHdr") || (r.Name == "metsHdr"))
                        return;
                    if ((r.Name == "METS:agent") || (r.Name == "agent"))
                        agent_type = -1;
                }

                // Essentially a small enumeration here
                const int UNKNOWN_TYPE = -1;
                const int ORGANIZATION = 1;
                const int OTHER = 2;
                const int INDIVIDUAL = 3;

                if (r.NodeType == XmlNodeType.Element)
                {
                    switch (r.Name.Replace("METS:", ""))
                    {
                        case "agent":
                            if ((r.MoveToAttribute("ROLE")) && (r.GetAttribute("ROLE") == "CREATOR") && (r.MoveToAttribute("TYPE")))
                            {
                                switch (r.Value)
                                {
                                    case "ORGANIZATION":
                                        agent_type = ORGANIZATION;
                                        break;

                                    case "OTHER":
                                        agent_type = OTHER;
                                        break;

                                    case "INDIVIDUAL":
                                        agent_type = INDIVIDUAL;
                                        break;

                                    default:
                                        agent_type = UNKNOWN_TYPE;
                                        break;
                                }
                            }
                            break;

                        case "name":
                            switch (agent_type)
                            {
                                case ORGANIZATION:
                                    r.Read();
                                    package.METS_Header.Creator_Organization = r.Value;
                                    package.Bib_Info.Source.Code = r.Value;
                                    package.Bib_Info.Source.Statement = r.Value;
                                    if (r.Value.IndexOf(",") < 0)
                                    {
                                        // Some presets for source codes in Florida
                                        switch (r.Value.ToUpper())
                                        {
                                            case "UF":
                                                package.Bib_Info.Source.Statement = "University of Florida";
                                                break;

                                            case "FS":
                                            case "FSU":
                                                package.Bib_Info.Source.Statement = "Florida State University";
                                                break;

                                            case "UCF":
                                            case "CF":
                                                package.Bib_Info.Source.Statement = "University of Central Florida";
                                                break;

                                            case "USF":
                                            case "SF":
                                                package.Bib_Info.Source.Statement = "University of South Florida";
                                                break;

                                            case "UNF":
                                            case "NF":
                                                package.Bib_Info.Source.Statement = "University of North Florida";
                                                break;

                                            case "UWF":
                                            case "WF":
                                                package.Bib_Info.Source.Statement = "University of West Florida";
                                                break;

                                            case "FIU":
                                            case "FI":
                                                package.Bib_Info.Source.Statement = "Florida International University";
                                                break;

                                            case "FGCU":
                                            case "FG":
                                            case "GC":
                                                package.Bib_Info.Source.Statement = "Florida Gulf Coast University";
                                                break;

                                            case "FAMU":
                                            case "AM":
                                                package.Bib_Info.Source.Statement = "Florida Agricultural and Mechanical University";
                                                break;

                                            case "FAU":
                                                package.Bib_Info.Source.Statement = "Florida Atlantic University";
                                                break;

                                            case "FCLA":
                                                package.Bib_Info.Source.Statement = "Florida Center for Library Automation";
                                                break;
                                        }
                                    }
                                    else
                                    {
                                        string code = r.Value.Substring(0, r.Value.IndexOf(","));
                                        string name = r.Value.Substring(r.Value.IndexOf(",") + 1);
                                        package.Bib_Info.Source.Statement = name;
                                        package.Bib_Info.Source.Code = code;
                                    }
                                    break;

                                case OTHER:
                                    r.Read();
                                    package.METS_Header.Creator_Software = r.Value;
                                    break;

                                case INDIVIDUAL:
                                    r.Read();
                                    package.METS_Header.Creator_Individual = r.Value;
                                    break;
                            }
                            break;

                        case "note":
                            switch (agent_type)
                            {
                                case ORGANIZATION:
                                    r.Read();
                                    package.METS_Header.Add_Creator_Org_Notes(r.Value);
                                    if (r.Value.Trim().IndexOf("projects=") == 0)
                                    {
                                        PALMM_Info palmmInfo = package.Get_Metadata_Module("PALMM") as PALMM_Info;
                                        if (palmmInfo == null)
                                        {
                                            palmmInfo = new PALMM_Info();
                                            package.Add_Metadata_Module("PALMM", palmmInfo);
                                        }
                                        palmmInfo.PALMM_Project = r.Value.Trim().Replace("projects=", "");
                                    }
                                    if (r.Value.Trim().IndexOf("server=") == 0)
                                    {
                                        PALMM_Info palmmInfo2 = package.Get_Metadata_Module("PALMM") as PALMM_Info;
                                        if (palmmInfo2 == null)
                                        {
                                            palmmInfo2 = new PALMM_Info();
                                            package.Add_Metadata_Module("PALMM", palmmInfo2);
                                        }
                                        palmmInfo2.PALMM_Server = r.Value.Trim().Replace("server=", "");
                                    }
                                    break;

                                case INDIVIDUAL:
                                    r.Read();
                                    package.METS_Header.Add_Creator_Individual_Notes(r.Value);
                                    break;
                            }
                            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)
        {
            // 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> 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.ToUpper().Replace("#", "").Replace(" ", "").Replace(".", "").Replace(":", "").Replace("\\", "").Replace("/", "").Replace(")", "").Replace("(", "").Trim();
            if (correctName.Length == 0)
            {
                correctName = "None";
            }
            else
            {
                // Find the first number
                int charIndex = 0;
                while ((charIndex < correctName.Length) && (!Char.IsNumber(correctName[charIndex])))
                {
                    charIndex++;
                }

                // If the index stopped before the end (that is, it found a number),
                // trim the number of the column name
                if ((charIndex < correctName.Length) && (charIndex > 0))
                {
                    correctName = correctName.Substring(0, charIndex);
                }

                // If it was all numbers, just assign NONE
                if (charIndex == 0)
                {
                    correctName = "None";
                }
            }

            // Everything depends on the field which is mapped
            switch (correctName)
            {
                case "NONE":
                    // Do nothing, since no mapping exists
                    return true;

                case "ABSTRACT":
                case "SUMMARY":
                    Package.Bib_Info.Add_Abstract(Data, "en");
                    return true;

                case "ACCESSION":
                case "ACCESSIONNUMBER":
                    Package.Bib_Info.Add_Identifier(Data, "Accession Number");
                    return true;

                case "ALTERNATETITLE":
                case "ALTTITLE":
                case "TITLEVARIANT":
                    Package.Bib_Info.Add_Other_Title(Data, Title_Type_Enum.Alternative);
                    return true;

                case "ALTERNATETITLELANGUAGE":
                case "ALTTITLELANGUAGE":
                    List<Title_Info> otherTitles = Package.Bib_Info.Other_Titles.Where(ThisTitle => ThisTitle.Title_Type == Title_Type_Enum.Alternative).ToList();
                    if (otherTitles.Count > 0)
                    {
                        otherTitles[otherTitles.Count - 1].Language = Data;
                    }
                    return true;

                case "TITLETRANSLATION":
                case "TRANSLATEDTITLE":
                    Package.Bib_Info.Add_Other_Title(Data, Title_Type_Enum.Translated);
                    return true;

                case "ATTRIBUTION":
                    Package.Bib_Info.Add_Note(Data, Note_Type_Enum.Funding);
                    return true;

                case "COLLECTION":
                case "COLLECTIONCODE":
                case "AGGREGATION":
                case "AGGREGATIONCODE":
                case "SUBCOLLECTION":
                case "SUBCOLLECTIONS":
                    Package.Behaviors.Add_Aggregation(Data.ToUpper());
                    return true;

                case "CLASSIFICATION":
                    Package.Bib_Info.Add_Classification(Data);
                    return true;

                case "CLASSIFICATIONTYPE":
                case "CLASSIFICATIONAUTHORITY":
                    if (Package.Bib_Info.Classifications_Count > 0)
                    {
                        Package.Bib_Info.Classifications[Package.Bib_Info.Classifications_Count - 1].Authority = Data;
                    }
                    return true;

                case "CONTRIBUTOR":
                case "CONTRIBUTORS":
                    Package.Bib_Info.Add_Named_Entity(new Name_Info(Data, "contributor"));
                    return true;

                case "CREATOR":
                case "CREATORS":
                case "AUTHOR":
                    // Ensure it doesn't already exist
                    if (Package.Bib_Info.Names_Count > 0)
                    {
                        foreach (Name_Info thisName in Package.Bib_Info.Names)
                        {
                            if (String.Compare(thisName.Full_Name, Data, StringComparison.OrdinalIgnoreCase) == 0)
                                return true;
                        }
                    }
                    Package.Bib_Info.Add_Named_Entity(new Name_Info(Data, "creator"));
                    return true;

                case "CREATORPERSONALNAME":

                    // Ensure it doesn't already exist
                    if (Package.Bib_Info.Names_Count > 0)
                    {
                        foreach (Name_Info thisName in Package.Bib_Info.Names)
                        {
                            if (String.Compare(thisName.Full_Name, Data, StringComparison.OrdinalIgnoreCase) == 0)
                                return true;
                        }
                    }

                    Name_Info personalCreator = new Name_Info(Data, "creator");
                    personalCreator.Name_Type = Name_Info_Type_Enum.Personal;
                    Package.Bib_Info.Add_Named_Entity(personalCreator);
                    return true;

                case "CREATORCORPORATENAME":
                    Name_Info corporateCreator = new Name_Info(Data, "creator");
                    corporateCreator.Name_Type = Name_Info_Type_Enum.Corporate;
                    Package.Bib_Info.Add_Named_Entity(corporateCreator);
                    return true;

                case "CREATORLANGUAGE":
                    if (Package.Bib_Info.Names_Count > 0)
                    {
                        Package.Bib_Info.Names[Package.Bib_Info.Names_Count - 1].Description = Data;
                    }
                    return true;

                case "CREATORAFFILIATION":
                case "AUTHORAFFILIATION":
                    if (Package.Bib_Info.Names_Count > 0)
                    {
                        Package.Bib_Info.Names[Package.Bib_Info.Names_Count - 1].Affiliation = Data;
                    }
                    return true;

                case "CREATORDATES":
                case "AUTHORDATES":
                    if (Package.Bib_Info.Names_Count > 0)
                    {
                        Package.Bib_Info.Names[Package.Bib_Info.Names_Count - 1].Dates = Data;
                    }
                    return true;

                case "CREATORFAMILYNAME":
                case "AUTHORFAMILYNAME":
                case "FAMILYNAME":
                    if (Package.Bib_Info.Names_Count > 0)
                    {
                        Name_Info lastNamedEntity = Package.Bib_Info.Names[Package.Bib_Info.Names_Count - 1];
                        if (lastNamedEntity.Family_Name.Length == 0)
                            lastNamedEntity.Family_Name = Data;
                        else
                        {
                            Name_Info newNameEntity = new Name_Info { Family_Name = Data };
                            Package.Bib_Info.Add_Named_Entity(newNameEntity);
                        }
                    }
                    else
                    {
                        Name_Info newNameEntity = new Name_Info { Family_Name = Data };
                        Package.Bib_Info.Add_Named_Entity(newNameEntity);
                    }
                    return true;

                case "CREATORGIVENNAME":
                case "AUTHORGIVENNAME":
                case "GIVENNAME":
                    if (Package.Bib_Info.Names_Count > 0)
                    {
                        Name_Info lastNamedEntity = Package.Bib_Info.Names[Package.Bib_Info.Names_Count - 1];
                        if (lastNamedEntity.Given_Name.Length == 0)
                            lastNamedEntity.Given_Name = Data;
                        else
                        {
                            Name_Info newNameEntity = new Name_Info { Given_Name = Data };
                            Package.Bib_Info.Add_Named_Entity(newNameEntity);
                        }
                    }
                    else
                    {
                        Name_Info newNameEntity = new Name_Info { Given_Name = Data };
                        Package.Bib_Info.Add_Named_Entity(newNameEntity);
                    }
                    return true;

                case "CREATORROLE":
                case "AUTHORROLE":
                case "CREATORROLES":
                case "AUTHORROLES":
                case "CREATORATTRIBUTION":
                    if (Package.Bib_Info.Names_Count > 0)
                    {
                        Name_Info thisCreator = Package.Bib_Info.Names[Package.Bib_Info.Names_Count - 1];
                        if ((thisCreator.Roles.Count == 1) && ((thisCreator.Roles[0].Role == "creator") || (thisCreator.Roles[1].Role == "contributor")))
                            thisCreator.Roles.Clear();
                        Package.Bib_Info.Names[Package.Bib_Info.Names_Count - 1].Add_Role(Data);
                    }
                    return true;

                case "CULTURALCONTEXT":
                case "CULTURE":
                    VRACore_Info vraCoreInfo = Package.Get_Metadata_Module("VRACore") as VRACore_Info;
                    if (vraCoreInfo == null)
                    {
                        vraCoreInfo = new VRACore_Info();
                        Package.Add_Metadata_Module("VRACore", vraCoreInfo);
                    }
                    vraCoreInfo.Add_Cultural_Context(Data);
                    return true;

                case "DONOR":
                    Package.Bib_Info.Donor.Full_Name = Data;
                    return true;

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

                case "GENREAUTHORITY":
                    if (Package.Bib_Info.Genres_Count > 0)
                    {
                        Package.Bib_Info.Genres[Package.Bib_Info.Genres_Count - 1].Authority = Data;
                    }
                    return true;

                case "HOLDINGLOCATIONCODE":
                case "HOLDINGCODE":
                    Package.Bib_Info.Location.Holding_Code = Data;
                    return true;

                case "HOLDINGLOCATIONSTATEMENT":
                case "HOLDINGSTATEMENT":
                case "CONTRIBUTINGINSTITUTION":
                case "LOCATIONCURRENT":
                case "LOCATIONCURRENTSITE":
                case "LOCATIONCURRENTREPOSITORY":
                    Package.Bib_Info.Location.Holding_Name = Data;
                    return true;

                case "LOCATIONFORMERSITE":
                    Package.Bib_Info.Add_Note(Data, Note_Type_Enum.OriginalLocation);
                    return true;

                case "IDENTIFIER":
                case "IDNUMBERFORMERREPOSITORY":
                case "IDNUMBERCURRENTREPOSITORY":
                case "IDNUMBERCURRENTRESPOSITORY":
                    Package.Bib_Info.Add_Identifier(Data);
                    return true;

                case "IDENTIFIERTYPE":
                    if (Package.Bib_Info.Identifiers_Count > 0)
                    {
                        Package.Bib_Info.Identifiers[Package.Bib_Info.Identifiers_Count - 1].Type = Data;
                    }
                    return true;

                case "INSCRIPTION":
                    VRACore_Info vraCoreInfo8 = Package.Get_Metadata_Module("VRACore") as VRACore_Info;
                    if (vraCoreInfo8 == null)
                    {
                        vraCoreInfo8 = new VRACore_Info();
                        Package.Add_Metadata_Module("VRACore", vraCoreInfo8);
                    }
                    vraCoreInfo8.Add_Inscription(Data);
                    return true;

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

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

                case "PLACEOFPUBLICATION":
                case "PUBLICATIONPLACE":
                case "PUBPLACE":
                case "PUBLICATIONLOCATION":
                case "PLACE":
                    Package.Bib_Info.Origin_Info.Add_Place(Data);
                    return true;

                case "RELATEDURLLABEL":
                    Package.Bib_Info.Location.Other_URL_Display_Label = Data;
                    return true;

                case "RELATEDURL":
                case "RELATEDURLLINK":
                    Package.Bib_Info.Location.Other_URL = Data;
                    return true;

                case "RELATEDURLNOTE":
                case "RELATEDURLNOTES":
                    Package.Bib_Info.Location.Other_URL_Note = Data;
                    return true;

                case "SOURCEINSTITUTIONCODE":
                case "SOURCECODE":
                    Package.Bib_Info.Source.Code = Data;
                    return true;

                case "SOURCEINSTITUTIONSTATEMENT":
                case "SOURCESTATEMENT":
                case "SOURCE":
                    Package.Bib_Info.Source.Statement = Data;
                    return true;

                case "SUBJECTKEYWORD":
                case "SUBJECTKEYWORDS":
                case "SUBJECT":
                case "SUBJECTS":
                case "KEYWORDS":
                    Package.Bib_Info.Add_Subject(Data, String.Empty);
                    return true;

                case "SUBJECTKEYWORDAUTHORITY":
                case "SUBJECTAUTHORITY":
                    if (Package.Bib_Info.Subjects_Count > 0)
                    {
                        Package.Bib_Info.Subjects[Package.Bib_Info.Subjects_Count - 1].Authority = Data;
                    }
                    return true;

                case "BIBID":
                case "BIB":
                case "BIBLIOGRAHPICID":
                case "BIBLIOGRAPHICIDENTIFIER":
                    Package.Bib_Info.BibID = Data.ToUpper();
                    return true;

                case "VID":
                    Package.Bib_Info.VID = Data.PadLeft(5, '0');
                    return true;

                case "DATE":
                case "DATECREATION":
                    try
                    {
                        // first, try converting the string value to a date object
                        Package.Bib_Info.Origin_Info.Date_Issued = Convert.ToDateTime(Data).ToShortDateString();
                    }
                    catch
                    {
                        try
                        {
                            // second, try converting the string value to an integer
                            Package.Bib_Info.Origin_Info.Date_Issued = Convert.ToInt32(Data).ToString();
                        }
                        catch
                        {
                            Package.Bib_Info.Origin_Info.Date_Issued = Data;
                        }
                    }
                    return true;

                case "DATEBEGINNING":
                    Package.Bib_Info.Origin_Info.MARC_DateIssued_Start = Data;
                    return true;

                case "DATECOMPLETION":
                    Package.Bib_Info.Origin_Info.MARC_DateIssued_End = Data;
                    return true;

                case "EDITION":
                    Package.Bib_Info.Origin_Info.Edition = Data;
                    return true;

                case "FORMAT":
                case "PHYSICALDESCRIPTION":
                case "EXTENT":
                    Package.Bib_Info.Original_Description.Extent = Data;
                    return true;

                case "NOTE":
                case "NOTES":
                case "DESCRIPTION":
                    Package.Bib_Info.Add_Note(Data);
                    return true;

                case "PROVENANCE":
                    Package.Bib_Info.Add_Note(Data, Note_Type_Enum.Acquisition);
                    return true;

                case "USAGESTATEMENT":
                    Package.Bib_Info.Add_Note(Data, Note_Type_Enum.CitationReference);
                    return true;

                case "CONTACT":
                case "CONTACTNOTES":
                case "CONTACTINFORMATION":
                    Package.Bib_Info.Add_Note(Data, Note_Type_Enum.NONE, "Contact");
                    return true;

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

                case "BIBSERIESTITLE":
                case "SERIESTITLE":
                case "TITLESERIES":
                    Package.Bib_Info.SeriesTitle.Title = Data;
                    Package.Behaviors.GroupTitle = Data;
                    return true;

                case "MATERIALTYPE":
                case "TYPE":
                case "RECORDTYPE":
                    string upper_data = Data.ToUpper();
                    if (upper_data.IndexOf("NEWSPAPER", StringComparison.Ordinal) >= 0)
                    {
                        Package.Bib_Info.SobekCM_Type = TypeOfResource_SobekCM_Enum.Newspaper;
                        return true;
                    }
                    if ((upper_data.IndexOf("MONOGRAPH", StringComparison.Ordinal) >= 0) || (upper_data.IndexOf("BOOK", StringComparison.Ordinal) >= 0))
                    {
                        Package.Bib_Info.SobekCM_Type = TypeOfResource_SobekCM_Enum.Book;
                        return true;
                    }
                    if (upper_data.IndexOf("SERIAL", StringComparison.Ordinal) >= 0)
                    {
                        Package.Bib_Info.SobekCM_Type = TypeOfResource_SobekCM_Enum.Serial;
                        return true;
                    }
                    if (upper_data.IndexOf("AERIAL", StringComparison.Ordinal) >= 0)
                    {
                        Package.Bib_Info.SobekCM_Type = TypeOfResource_SobekCM_Enum.Aerial;
                        if (Package.Bib_Info.Original_Description.Extent.Length == 0)
                            Package.Bib_Info.Original_Description.Extent = "Aerial Photograph";
                        return true;
                    }
                    if (upper_data.IndexOf("PHOTO", StringComparison.Ordinal) >= 0)
                    {
                        Package.Bib_Info.SobekCM_Type = TypeOfResource_SobekCM_Enum.Photograph;
                        return true;
                    }
                    if (upper_data.IndexOf("POSTCARD", StringComparison.Ordinal) >= 0)
                    {
                        Package.Bib_Info.SobekCM_Type = TypeOfResource_SobekCM_Enum.Photograph;
                        if (Package.Bib_Info.Original_Description.Extent.Length == 0)
                            Package.Bib_Info.Original_Description.Extent = "Postcard";
                        return true;
                    }
                    if (upper_data.IndexOf("MAP", StringComparison.Ordinal) >= 0)
                    {
                        Package.Bib_Info.SobekCM_Type = TypeOfResource_SobekCM_Enum.Map;
                        return true;
                    }
                    if (upper_data.IndexOf("TEXT", StringComparison.Ordinal) >= 0)
                    {
                        Package.Bib_Info.SobekCM_Type = TypeOfResource_SobekCM_Enum.Book;
                        return true;
                    }
                    if (upper_data.IndexOf("AUDIO", StringComparison.Ordinal) >= 0)
                    {
                        Package.Bib_Info.SobekCM_Type = TypeOfResource_SobekCM_Enum.Audio;
                        return true;
                    }
                    if (upper_data.IndexOf("VIDEO", StringComparison.Ordinal) >= 0)
                    {
                        Package.Bib_Info.SobekCM_Type = TypeOfResource_SobekCM_Enum.Video;
                        return true;
                    }
                    if ((upper_data.IndexOf("ARCHIVE", StringComparison.Ordinal) >= 0) || (upper_data.IndexOf("ARCHIVAL", StringComparison.Ordinal) >= 0))
                    {
                        Package.Bib_Info.SobekCM_Type = TypeOfResource_SobekCM_Enum.Archival;
                        return true;
                    }
                    if (upper_data.IndexOf("ARTIFACT", StringComparison.Ordinal) >= 0)
                    {
                        Package.Bib_Info.SobekCM_Type = TypeOfResource_SobekCM_Enum.Artifact;
                        return true;
                    }
                    if (upper_data.IndexOf("IMAGE", StringComparison.Ordinal) >= 0)
                    {
                        Package.Bib_Info.SobekCM_Type = TypeOfResource_SobekCM_Enum.Photograph;
                        return true;
                    }

                    // if there was no match, set type to "UNDETERMINED"
                    Package.Bib_Info.SobekCM_Type = TypeOfResource_SobekCM_Enum.UNKNOWN;

                    if (Package.Bib_Info.Original_Description.Extent.Length == 0)
                        Package.Bib_Info.Original_Description.Extent = "Undetermined";
                    return true;

                case "BIBUNIFORMTITLE":
                case "UNIFORMTITLE":
                    Package.Bib_Info.Add_Other_Title(Data, Title_Type_Enum.Uniform);
                    Package.Behaviors.GroupTitle = Data;
                    return true;

                case "VOLUMETITLE":
                case "TITLE":
                    if (String.IsNullOrEmpty(Package.Bib_Info.Main_Title.Title))
                        Package.Bib_Info.Main_Title.Title = Data;
                    else
                        Package.Bib_Info.Add_Other_Title(Data, Title_Type_Enum.Alternative);
                    return true;

                case "TITLELANGUAGE":
                    Package.Bib_Info.Main_Title.Language = Data;
                    return true;

                case "ALEPH":
                    Package.Bib_Info.Add_Identifier(Data, "ALEPH");
                    return true;

                case "OCLC":
                    Package.Bib_Info.Add_Identifier(Data, "OCLC");
                    return true;

                case "LCCN":
                    Package.Bib_Info.Add_Identifier(Data, "LCCN");
                    return true;

                case "ISBN":
                    Package.Bib_Info.Add_Identifier(Data, "ISBN");
                    return true;

                case "ISSN":
                    Package.Bib_Info.Add_Identifier(Data, "ISSN");
                    return true;

                case "SUBTITLE":
                    Package.Bib_Info.Main_Title.Subtitle = Data;
                    return true;

                case "VOLUME":
                    Package.Bib_Info.Series_Part_Info.Enum1 = Data;
                    Package.Behaviors.Serial_Info.Add_Hierarchy(Package.Behaviors.Serial_Info.Count + 1, 1, Data);
                    return true;

                case "ISSUE":
                    if (Package.Bib_Info.Series_Part_Info.Enum1.Length == 0)
                    {
                        Package.Bib_Info.Series_Part_Info.Enum1 = Data;
                    }
                    else
                    {
                        Package.Bib_Info.Series_Part_Info.Enum2 = Data;
                    }
                    Package.Behaviors.Serial_Info.Add_Hierarchy(Package.Behaviors.Serial_Info.Count + 1, 1, Data);
                    return true;

                case "SECTION":
                    if (Package.Bib_Info.Series_Part_Info.Enum2.Length == 0)
                    {
                        if (Package.Bib_Info.Series_Part_Info.Enum1.Length == 0)
                            Package.Bib_Info.Series_Part_Info.Enum1 = Data;
                        else
                            Package.Bib_Info.Series_Part_Info.Enum2 = Data;
                    }
                    else
                    {
                        Package.Bib_Info.Series_Part_Info.Enum3 = Data;
                    }
                    Package.Behaviors.Serial_Info.Add_Hierarchy(Package.Behaviors.Serial_Info.Count + 1, 1, Data);
                    // Do nothing for now
                    return true;

                case "YEAR":
                    Package.Bib_Info.Series_Part_Info.Year = Data;

                    if (Data.Length == 1)
                        year = "0" + Data;
                    else
                        year = Data;
                    build_date_string(Package);

                    return true;

                case "MONTH":
                    Package.Bib_Info.Series_Part_Info.Month = Data;
                    month = Data;
                    build_date_string(Package);

                    return true;

                case "DAY":
                    Package.Bib_Info.Series_Part_Info.Day = Data;
                    day = Data;
                    build_date_string(Package);

                    return true;

                case "COORDINATES":
                    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);
                    }
                    string[] coordinates = Data.Split(", ;".ToCharArray());
                    try
                    {
                        if (coordinates.Length == 2)
                        {
                            geoInfo.Add_Point(Convert.ToDouble(coordinates[0]), Convert.ToDouble(coordinates[1]), String.Empty);
                        }
                        else
                        {
                            coordinates = Data.Split(",;".ToCharArray());
                            if (coordinates.Length == 2)
                            {
                                geoInfo.Add_Point(Convert.ToDouble(coordinates[0]), Convert.ToDouble(coordinates[1]), String.Empty);
                            }
                        }
                    }
                    catch
                    {
                    }
                    return true;

                case "LATITUDE":
                case "COORDINATESLATITUDE":
                    GeoSpatial_Information geoInfo2 = Package.Get_Metadata_Module(GlobalVar.GEOSPATIAL_METADATA_MODULE_KEY) as GeoSpatial_Information;
                    if (geoInfo2 == null)
                    {
                        geoInfo2 = new GeoSpatial_Information();
                        Package.Add_Metadata_Module(GlobalVar.GEOSPATIAL_METADATA_MODULE_KEY, geoInfo2);
                    }
                    try
                    {
                        if (geoInfo2.Point_Count == 0)
                            geoInfo2.Add_Point(Convert.ToDouble(Data), 0, String.Empty);
                        else
                            geoInfo2.Points[0].Latitude = Convert.ToDouble(Data);
                    }
                    catch
                    {
                    }
                    return true;

                case "LONGITUDE":
                case "COORDINATESLONGITUDE":
                    GeoSpatial_Information geoInfo3 = Package.Get_Metadata_Module(GlobalVar.GEOSPATIAL_METADATA_MODULE_KEY) as GeoSpatial_Information;
                    if (geoInfo3 == null)
                    {
                        geoInfo3 = new GeoSpatial_Information();
                        Package.Add_Metadata_Module(GlobalVar.GEOSPATIAL_METADATA_MODULE_KEY, geoInfo3);
                    }
                    try
                    {
                        if (geoInfo3.Point_Count == 0)
                            geoInfo3.Add_Point(0, Convert.ToDouble(Data.Replace("°", "")), String.Empty);
                        else
                            geoInfo3.Points[0].Longitude = Convert.ToDouble(Data.Replace("°", ""));
                    }
                    catch
                    {
                    }
                    return true;

                case "PROJECTION":
                case "MAPPROJECTION":
                    Guarantee_Cartographics(Package).Projection = Data;
                    return true;

                case "SCALE":
                case "MAPSCALE":
                    Guarantee_Cartographics(Package).Scale = Data;
                    return true;

                //case Mapped_Fields.Spatial_Coverage:
                //    Package.Bib_Info.Hierarchical_Spatials[0].Area = Data;
                //    return true;

                case "ICON/WORDMARK":
                case "ICON/WORDMARKS":
                case "ICON":
                case "ICONS":
                case "WORDMARK":
                case "WORDMARKS":
                    Package.Behaviors.Add_Wordmark(Data);
                    return true;

                case "WEBSKINS":
                case "WEBSKIN":
                case "SKINS":
                case "SKIN":
                    Package.Behaviors.Add_Web_Skin(Data);
                    return true;

                case "TEMPORALCOVERAGE":
                case "TEMPORAL":
                case "TIMEPERIOD":
                    Package.Bib_Info.Add_Temporal_Subject(-1, -1, Data);
                    return true;

                case "COVERAGE":
                    // Was this a number.. likely, a year?
                    int possible_year;
                    if (( Data.Length >= 4 ) && ( Int32.TryParse(Data.Substring(0,4), out possible_year)))
                        Package.Bib_Info.Add_Temporal_Subject(-1, -1, Data);
                    else
                        Package.Bib_Info.Add_Spatial_Subject(Data);
                    return true;

                case "AFFILIATIONUNIVERSITY":
                case "UNIVERSITY":
                    Guarantee_Affiliation_Collection(Package);
                    Package.Bib_Info.Affiliations[0].University = Data;
                    return true;

                case "AFFILIATIONCAMPUS":
                case "CAMPUS":
                    Guarantee_Affiliation_Collection(Package);
                    Package.Bib_Info.Affiliations[0].Campus = Data;
                    return true;

                case "AFFILIATIONCOLLEGE":
                case "COLLEGE":
                    Guarantee_Affiliation_Collection(Package);
                    Package.Bib_Info.Affiliations[0].College = Data;
                    return true;

                case "AFFILIATIONUNIT":
                case "UNIT":
                    Guarantee_Affiliation_Collection(Package);
                    Package.Bib_Info.Affiliations[0].Unit = Data;
                    return true;

                case "AFFILIATIONDEPARTMENT":
                case "DEPARTMENT":
                    Guarantee_Affiliation_Collection(Package);
                    Package.Bib_Info.Affiliations[0].Department = Data;
                    return true;

                case "AFFILIATIONINSTITUTE":
                case "INSTITUTE":
                    Guarantee_Affiliation_Collection(Package);
                    Package.Bib_Info.Affiliations[0].Institute = Data;
                    return true;

                case "AFFILIATIONCENTER":
                case "CENTER":
                    Guarantee_Affiliation_Collection(Package);
                    Package.Bib_Info.Affiliations[0].Center = Data;
                    return true;

                case "AFFILIATIONSECTION":
                    Guarantee_Affiliation_Collection(Package);
                    Package.Bib_Info.Affiliations[0].Section = Data;
                    return true;

                case "AFFILIATIONSUBSECTION":
                    Guarantee_Affiliation_Collection(Package);
                    Package.Bib_Info.Affiliations[0].SubSection = Data;
                    return true;

                case "GEOGRAPHYCONTINENT":
                case "CONTINENT":
                    Guarantee_Hierarchical_Spatial(Package).Continent = Data;
                    return true;

                case "GEOGRAPHYCOUNTRY":
                case "COUNTRY":
                    Guarantee_Hierarchical_Spatial(Package).Country = Data;
                    return true;

                case "GEOGRAPHYPROVINCE":
                case "PROVINCE":
                    Guarantee_Hierarchical_Spatial(Package).Province = Data;
                    return true;

                case "GEOGRAPHYREGION":
                case "REGION":
                    Guarantee_Hierarchical_Spatial(Package).Region = Data;
                    return true;

                case "GEOGRAPHYSTATE":
                case "STATE":
                    Guarantee_Hierarchical_Spatial(Package).State = Data;
                    return true;

                case "GEOGRAPHYTERRITORY":
                case "TERRITORY":
                    Guarantee_Hierarchical_Spatial(Package).Territory = Data;
                    return true;

                case "GEOGRAPHYCOUNTY":
                case "COUNTY":
                    Guarantee_Hierarchical_Spatial(Package).County = Data;
                    return true;

                case "GEOGRAPHYCITY":
                case "CITY":
                    Guarantee_Hierarchical_Spatial(Package).City = Data;
                    return true;

                case "GEOGRAPHYISLAND":
                case "ISLAND":
                    Guarantee_Hierarchical_Spatial(Package).Island = Data;
                    return true;

                case "GEOGRAPHYAREA":
                case "AREA":
                    Guarantee_Hierarchical_Spatial(Package).Area = Data;
                    return true;

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

                case "COPYRIGHTDATE":
                case "COPYRIGHT":
                    Package.Bib_Info.Origin_Info.Date_Copyrighted = Data;
                    return true;

                case "EADNAME":
                case "EAD":
                    Package.Bib_Info.Location.EAD_Name = Data;
                    return true;

                case "EADURL":
                    Package.Bib_Info.Location.EAD_URL = Data;
                    return true;

                case "COMMENTS":
                case "INTERNALCOMMENTS":
                case "INTERNAL":
                    Package.Tracking.Internal_Comments = Data;
                    return true;

                case "CONTAINERBOX":
                case "BOX":
                    Package.Bib_Info.Add_Container("Box", Data, 1);
                    return true;

                case "CONTAINERDIVIDER":
                case "DIVIDER":
                    Package.Bib_Info.Add_Container("Divider", Data, 2);
                    return true;

                case "CONTAINERFOLDER":
                case "FOLDER":
                    Package.Bib_Info.Add_Container("Folder", Data, 3);
                    return true;

                case "VIEWERS":
                case "VIEWER":
                    Package.Behaviors.Add_View(Data);
                    return true;

                case "VISIBILITY":
                    switch (Data.ToUpper())
                    {
                        case "DARK":
                            Package.Behaviors.Dark_Flag = true;
                            Package.Behaviors.IP_Restriction_Membership = -1;
                            return true;

                        case "PRIVATE":
                            Package.Behaviors.Dark_Flag = false;
                            Package.Behaviors.IP_Restriction_Membership = -1;
                            return true;

                        case "PUBLIC":
                            Package.Behaviors.Dark_Flag = false;
                            Package.Behaviors.IP_Restriction_Membership = 0;
                            return true;

                        case "RESTRICTED":
                            Package.Behaviors.Dark_Flag = false;
                            Package.Behaviors.IP_Restriction_Membership = 1;
                            return true;
                    }
                    return true;

                case "TICKLER":
                    Package.Behaviors.Add_Tickler(Data);
                    return true;

                case "TRACKINGBOX":
                    Package.Tracking.Tracking_Box = Data;
                    return true;

                case "BORNDIGITAL":
                    if (Data.ToUpper().Trim() == "TRUE")
                        Package.Tracking.Born_Digital = true;
                    return true;

                case "MATERIALRECEIVED":
                case "MATERIALRECEIVEDDATE":
                case "MATERIALRECDDATE":
                case "MATERIALRECD":
                    DateTime materialReceivedDate;
                    if (DateTime.TryParse(Data, out materialReceivedDate))
                        Package.Tracking.Material_Received_Date = materialReceivedDate;
                    return true;

                case "MATERIAL":
                case "MATERIALS":
                case "MATERIALMEDIUM":
                    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 "MATERIALSUPPORT":
                    VRACore_Info vraCoreInfo2b = Package.Get_Metadata_Module("VRACore") as VRACore_Info;
                    if (vraCoreInfo2b == null)
                    {
                        vraCoreInfo2b = new VRACore_Info();
                        Package.Add_Metadata_Module("VRACore", vraCoreInfo2b);
                    }
                    vraCoreInfo2b.Add_Material(Data, "support");
                    return true;

                case "MEASUREMENT":
                case "MEASUREMENTS":
                case "MEASUREMENTDIMENSIONS":
                case "MEASUREMENTSDIMENSIONS":
                case "DIMENSIONS":
                    VRACore_Info vraCoreInfo3 = Package.Get_Metadata_Module("VRACore") as VRACore_Info;
                    if (vraCoreInfo3 == null)
                    {
                        vraCoreInfo3 = new VRACore_Info();
                        Package.Add_Metadata_Module("VRACore", vraCoreInfo3);
                    }
                    if (vraCoreInfo3.Measurement_Count == 0)
                        vraCoreInfo3.Add_Measurement(Data, String.Empty);
                    else
                        vraCoreInfo3.Measurements[0].Measurements = Data;
                    return true;

                case "MEASUREMENTFORMAT":
                case "MEASUREMENTUNITS":
                case "MEASUREMENTSFORMAT":
                case "MEASUREMENTSUNITS":
                    VRACore_Info vraCoreInfo3b = Package.Get_Metadata_Module("VRACore") as VRACore_Info;
                    if (vraCoreInfo3b == null)
                    {
                        vraCoreInfo3b = new VRACore_Info();
                        Package.Add_Metadata_Module("VRACore", vraCoreInfo3b);
                    }
                    if (vraCoreInfo3b.Measurement_Count == 0)
                        vraCoreInfo3b.Add_Measurement(String.Empty, Data);
                    else
                        vraCoreInfo3b.Measurements[0].Units = Data;
                    return true;

                case "STATEEDITION":
                    VRACore_Info vraCoreInfo4 = Package.Get_Metadata_Module("VRACore") as VRACore_Info;
                    if (vraCoreInfo4 == null)
                    {
                        vraCoreInfo4 = new VRACore_Info();
                        Package.Add_Metadata_Module("VRACore", vraCoreInfo4);
                    }
                    vraCoreInfo4.Add_State_Edition(Data);
                    return true;

                case "STYLE":
                case "PERIOD":
                case "STYLEPERIOD":
                    VRACore_Info vraCoreInfo5 = Package.Get_Metadata_Module("VRACore") as VRACore_Info;
                    if (vraCoreInfo5 == null)
                    {
                        vraCoreInfo5 = new VRACore_Info();
                        Package.Add_Metadata_Module("VRACore", vraCoreInfo5);
                    }
                    vraCoreInfo5.Add_Style_Period(Data);
                    return true;

                case "TECHNIQUE":
                    VRACore_Info vraCoreInfo6 = Package.Get_Metadata_Module("VRACore") as VRACore_Info;
                    if (vraCoreInfo6 == null)
                    {
                        vraCoreInfo6 = new VRACore_Info();
                        Package.Add_Metadata_Module("VRACore", vraCoreInfo6);
                    }
                    vraCoreInfo6.Add_Technique(Data);
                    return true;

                case "TARGETAUDIENCE":
                case "AUDIENCE":
                    Package.Bib_Info.Add_Target_Audience(Data);
                    return true;

                default:
                    // No mapping exists and this is a non-known no-mapping
                    return false;
            }
        }