/// <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) && (subjectObject != null))
            {
                Bib.Bib_Info.Add_Subject(subjectObject);

                switch (subjectObject.Class_Type)
                {
                case Subject_Info_Type.Name:
                    if (((Subject_Info_Name)subjectObject).Genres.Count > 0)
                    {
                        foreach (string genre in ((Subject_Info_Name)subjectObject).Genres)
                        {
                            Genre_Info newGenre = new Genre_Info(genre, subjectObject.Authority);
                            if (!Bib.Bib_Info.Genres.Contains(newGenre))
                            {
                                Bib.Bib_Info.Add_Genre(newGenre);
                            }
                        }
                    }
                    break;

                case Subject_Info_Type.TitleInfo:
                    if (((Subject_Info_TitleInfo)subjectObject).Genres.Count > 0)
                    {
                        foreach (string genre in ((Subject_Info_TitleInfo)subjectObject).Genres)
                        {
                            Genre_Info newGenre = new Genre_Info(genre, subjectObject.Authority);
                            if (!Bib.Bib_Info.Genres.Contains(newGenre))
                            {
                                Bib.Bib_Info.Add_Genre(newGenre);
                            }
                        }
                    }
                    break;

                case Subject_Info_Type.Standard:
                    if (((Subject_Info_Standard)subjectObject).Genres.Count > 0)
                    {
                        foreach (string genre in ((Subject_Info_Standard)subjectObject).Genres)
                        {
                            Genre_Info newGenre = new Genre_Info(genre, subjectObject.Authority);
                            if (!Bib.Bib_Info.Genres.Contains(newGenre))
                            {
                                Bib.Bib_Info.Add_Genre(newGenre);
                            }
                        }
                    }
                    break;
                }
            }
        }
        /// <summary> Reads the MODS-compliant section of XML and stores the data in the provided digital resource </summary>
        /// <param name="r"> XmlTextReader from which to read the MODS data </param>
        /// <param name="package"> Digital resource object to save the data to </param>
        public static void Read_MODS_Info(XmlReader r, Bibliographic_Info thisBibInfo, SobekCM_Item Return_Item)
        {
            while (r.Read())
            {
                if ((r.NodeType == XmlNodeType.EndElement) && ((r.Name == "METS:mdWrap") || (r.Name == "mdWrap") || (r.Name == "mods")))
                    return;

                if (r.NodeType == XmlNodeType.Element)
                {
                    switch (r.Name)
                    {
                        case "mods:abstract":
                        case "abstract":
                            Abstract_Info thisAbstract = new Abstract_Info();
                            if (r.MoveToAttribute("ID"))
                                thisAbstract.ID = r.Value;
                            if (r.MoveToAttribute("type"))
                                thisAbstract.Type = r.Value;
                            if (r.MoveToAttribute("displayLabel"))
                                thisAbstract.Display_Label = r.Value;
                            if (r.MoveToAttribute("lang"))
                                thisAbstract.Language = r.Value;
                            r.Read();
                            if (r.NodeType == XmlNodeType.Text)
                            {
                                thisAbstract.Abstract_Text = r.Value;
                                thisBibInfo.Add_Abstract(thisAbstract);
                            }
                            break;

                        case "mods:accessCondition":
                        case "accessCondition":
                            if (r.MoveToAttribute("ID"))
                                thisBibInfo.Access_Condition.ID = r.Value;
                            if (r.MoveToAttribute("type"))
                                thisBibInfo.Access_Condition.Type = r.Value;
                            if (r.MoveToAttribute("displayLabel"))
                                thisBibInfo.Access_Condition.Display_Label = r.Value;
                            if (r.MoveToAttribute("lang"))
                                thisBibInfo.Access_Condition.Language = r.Value;
                            r.Read();
                            if (r.NodeType == XmlNodeType.Text)
                            {
                                thisBibInfo.Access_Condition.Text = r.Value;
                            }
                            break;

                        case "mods:classification":
                        case "classification":
                            Classification_Info thisClassification = new Classification_Info();
                            if (r.MoveToAttribute("edition"))
                                thisClassification.Edition = r.Value;
                            if (r.MoveToAttribute("authority"))
                                thisClassification.Authority = r.Value;
                            if (r.MoveToAttribute("displayLabel"))
                                thisClassification.Display_Label = r.Value;
                            r.Read();
                            if (r.NodeType == XmlNodeType.Text)
                            {
                                thisClassification.Classification = r.Value;
                                thisBibInfo.Add_Classification(thisClassification);
                            }
                            break;

                        case "mods:identifier":
                        case "identifier":
                            Identifier_Info thisIdentifier = new Identifier_Info();
                            if (r.MoveToAttribute("type"))
                                thisIdentifier.Type = r.Value;
                            if (r.MoveToAttribute("displayLabel"))
                                thisIdentifier.Display_Label = r.Value;
                            r.Read();
                            if (r.NodeType == XmlNodeType.Text)
                            {
                                thisIdentifier.Identifier = r.Value;
                                thisBibInfo.Add_Identifier(thisIdentifier);
                            }
                            break;

                        case "mods:genre":
                        case "genre":
                            Genre_Info thisGenre = new Genre_Info();
                            if (r.MoveToAttribute("ID"))
                                thisGenre.ID = r.Value;
                            if (r.MoveToAttribute("authority"))
                                thisGenre.Authority = r.Value;
                            if (r.MoveToAttribute("lang"))
                                thisGenre.Language = r.Value;
                            r.Read();
                            if (r.NodeType == XmlNodeType.Text)
                            {
                                thisGenre.Genre_Term = r.Value;
                                thisBibInfo.Add_Genre(thisGenre);
                            }
                            break;

                        case "mods:language":
                        case "language":
                            string language_text = String.Empty;
                            string language_rfc_code = String.Empty;
                            string language_iso_code = String.Empty;
                            string language_id = String.Empty;
                            if (r.MoveToAttribute("ID"))
                                language_id = r.Value;
                            while (r.Read())
                            {
                                if ((r.NodeType == XmlNodeType.Element) && ((r.Name == "mods:languageTerm") || (r.Name == "languageTerm")))
                                {
                                    if (r.MoveToAttribute("type"))
                                    {
                                        switch (r.Value)
                                        {
                                            case "code":
                                                if (r.MoveToAttribute("authority"))
                                                {
                                                    if (r.Value == "rfc3066")
                                                    {
                                                        r.Read();
                                                        if (r.NodeType == XmlNodeType.Text)
                                                        {
                                                            language_rfc_code = r.Value;
                                                        }
                                                    }
                                                    else if (r.Value == "iso639-2b")
                                                    {
                                                        r.Read();
                                                        if (r.NodeType == XmlNodeType.Text)
                                                        {
                                                            language_iso_code = r.Value;
                                                        }
                                                    }
                                                }
                                                break;

                                            case "text":
                                                r.Read();
                                                if (r.NodeType == XmlNodeType.Text)
                                                {
                                                    language_text = r.Value;
                                                }
                                                // Quick check for a change we started in 2010
                                                if (language_text == "governmental publication")
                                                    language_text = "government publication";
                                                break;

                                            default:
                                                r.Read();
                                                if (r.NodeType == XmlNodeType.Text)
                                                {
                                                    language_text = r.Value;
                                                }
                                                break;
                                        }
                                    }
                                    else
                                    {
                                        r.Read();
                                        if (r.NodeType == XmlNodeType.Text)
                                        {
                                            language_text = r.Value;
                                        }
                                    }
                                }

                                if ((r.NodeType == XmlNodeType.EndElement) && ((r.Name == "mods:language") || (r.Name == "language")))
                                {
                                    break;
                                }
                            }

                            if ((language_text.Length > 0) || (language_rfc_code.Length > 0) || (language_iso_code.Length > 0))
                            {
                                thisBibInfo.Add_Language(language_text, language_iso_code, language_rfc_code);
                            }
                            break;

                        case "mods:location":
                        case "location":
                            while (r.Read())
                            {
                                if ((r.NodeType == XmlNodeType.EndElement) && ((r.Name == "mods:location") || (r.Name == "location")))
                                    break;

                                if (r.NodeType == XmlNodeType.Element)
                                {
                                    if ((r.Name == "mods:physicalLocation") || (r.Name == "physicalLocation"))
                                    {
                                        if (r.MoveToAttribute("type"))
                                        {
                                            if (r.Value == "code")
                                            {
                                                r.Read();
                                                if (r.NodeType == XmlNodeType.Text)
                                                {
                                                    thisBibInfo.Location.Holding_Code = r.Value;
                                                }
                                            }
                                        }
                                        else
                                        {
                                            r.Read();
                                            if (r.NodeType == XmlNodeType.Text)
                                            {
                                                thisBibInfo.Location.Holding_Name = r.Value;
                                            }
                                        }
                                    }
                                    if ((r.Name == "mods:url") || (r.Name == "url"))
                                    {
                                        // TEST
                                        if (r.MoveToAttribute("access"))
                                        {
                                            if (r.Value == "object in context")
                                            {
                                                r.Read();
                                                if (r.NodeType == XmlNodeType.Text)
                                                {
                                                    thisBibInfo.Location.PURL = r.Value;
                                                }
                                            }
                                        }
                                        else
                                        {
                                            string url_displayLabel = r.GetAttribute("displayLabel");
                                            string url_note = r.GetAttribute("note");
                                            r.Read();
                                            if (r.NodeType == XmlNodeType.Text)
                                            {
                                                if ((url_displayLabel != null) && (url_displayLabel == "Finding Guide"))
                                                {
                                                    if (url_note != null)
                                                    {
                                                        thisBibInfo.Location.EAD_Name = url_note;
                                                    }
                                                    thisBibInfo.Location.EAD_URL = r.Value;
                                                }
                                                else
                                                {
                                                    if (url_displayLabel != null)
                                                    {
                                                        thisBibInfo.Location.Other_URL_Display_Label = url_displayLabel;
                                                    }

                                                    if (url_note != null)
                                                    {
                                                        thisBibInfo.Location.Other_URL_Note = url_note;
                                                    }
                                                    thisBibInfo.Location.Other_URL = r.Value;
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                            break;

                        case "mods:name":
                        case "name":
                            Name_Info tempNewName = read_name_object(r);
                            if (tempNewName.Main_Entity)
                                thisBibInfo.Main_Entity_Name = tempNewName;
                            else
                            {
                                bool donor = false;
                                foreach (Name_Info_Role role in tempNewName.Roles)
                                {
                                    if ((role.Role == "donor") || (role.Role == "honoree") || (role.Role == "endowment") || (role.Role == "collection"))
                                    {
                                        donor = true;
                                        break;
                                    }
                                }
                                if (donor)
                                {
                                    thisBibInfo.Donor = tempNewName;
                                }
                                else
                                {
                                    thisBibInfo.Add_Named_Entity(tempNewName);
                                }
                            }
                            break;

                        case "mods:note":
                        case "note":
                            Note_Info newNote = new Note_Info();
                            if (r.MoveToAttribute("ID"))
                                newNote.ID = r.Value;
                            if (r.MoveToAttribute("type"))
                                newNote.Note_Type_String = r.Value;
                            if (r.MoveToAttribute("displayLabel"))
                                newNote.Display_Label = r.Value;
                            r.Read();
                            if (r.NodeType == XmlNodeType.Text)
                            {
                                newNote.Note = r.Value;
                                thisBibInfo.Add_Note(newNote);
                            }
                            break;

                        case "mods:Origin_Info":
                        case "Origin_Info":
                        case "mods:originInfo":
                        case "originInfo":
                            while (r.Read())
                            {
                                if ((r.NodeType == XmlNodeType.EndElement) && ((r.Name == "mods:Origin_Info") || (r.Name == "Origin_Info") || (r.Name == "mods:originInfo") || (r.Name == "originInfo")))
                                    break;

                                if (r.NodeType == XmlNodeType.Element)
                                {
                                    switch (r.Name)
                                    {
                                        case "mods:publisher":
                                        case "publisher":
                                            r.Read();
                                            if (r.NodeType == XmlNodeType.Text)
                                            {
                                                thisBibInfo.Origin_Info.Add_Publisher(r.Value);
                                                thisBibInfo.Add_Publisher(r.Value);
                                            }
                                            break;

                                        case "mods:place":
                                        case "place":
                                            string place_text = String.Empty;
                                            string place_marc = String.Empty;
                                            string place_iso = String.Empty;
                                            while ((r.Read()) && (!(((r.Name == "mods:place") || (r.Name == "place")) && (r.NodeType == XmlNodeType.EndElement))))
                                            {
                                                if ((r.NodeType == XmlNodeType.Element) && ((r.Name == "mods:placeTerm") || (r.Name == "placeTerm")))
                                                {
                                                    if ((r.MoveToAttribute("type")) && (r.Value == "code"))
                                                    {
                                                        if (r.MoveToAttribute("authority"))
                                                        {
                                                            switch (r.Value)
                                                            {
                                                                case "marccountry":
                                                                    r.Read();
                                                                    if (r.NodeType == XmlNodeType.Text)
                                                                    {
                                                                        place_marc = r.Value;
                                                                    }
                                                                    break;

                                                                case "iso3166":
                                                                    r.Read();
                                                                    if (r.NodeType == XmlNodeType.Text)
                                                                    {
                                                                        place_iso = r.Value;
                                                                    }
                                                                    break;
                                                            }
                                                        }
                                                    }
                                                    else
                                                    {
                                                        r.Read();
                                                        if (r.NodeType == XmlNodeType.Text)
                                                        {
                                                            place_text = r.Value;
                                                        }
                                                    }
                                                }
                                            }
                                            if ((place_text.Length > 0) || (place_marc.Length > 0) || (place_iso.Length > 0))
                                            {
                                                thisBibInfo.Origin_Info.Add_Place(place_text, place_marc, place_iso);
                                            }
                                            break;

                                        case "mods:dateIssued":
                                        case "dateIssued":
                                            if ((r.MoveToAttribute("encoding")) && (r.Value == "marc"))
                                            {
                                                if (r.MoveToAttribute("point"))
                                                {
                                                    if (r.Value == "start")
                                                    {
                                                        r.Read();
                                                        if (r.NodeType == XmlNodeType.Text)
                                                        {
                                                            thisBibInfo.Origin_Info.MARC_DateIssued_Start = r.Value;
                                                        }
                                                    }
                                                    else if (r.Value == "end")
                                                    {
                                                        r.Read();
                                                        if (r.NodeType == XmlNodeType.Text)
                                                        {
                                                            thisBibInfo.Origin_Info.MARC_DateIssued_End = r.Value;
                                                        }
                                                    }
                                                }
                                                else
                                                {
                                                    r.Read();
                                                    if (r.NodeType == XmlNodeType.Text)
                                                    {
                                                        thisBibInfo.Origin_Info.MARC_DateIssued = r.Value;
                                                    }
                                                }
                                            }
                                            else
                                            {
                                                r.Read();
                                                if (r.NodeType == XmlNodeType.Text)
                                                {
                                                    thisBibInfo.Origin_Info.Date_Issued = r.Value;
                                                }
                                            }
                                            break;

                                        case "mods:dateCreated":
                                        case "dateCreated":
                                            r.Read();
                                            if (r.NodeType == XmlNodeType.Text)
                                            {
                                                thisBibInfo.Origin_Info.Date_Created = r.Value;
                                            }
                                            break;

                                        case "mods:copyrightDate":
                                        case "copyrightDate":
                                            r.Read();
                                            if (r.NodeType == XmlNodeType.Text)
                                            {
                                                thisBibInfo.Origin_Info.Date_Copyrighted = r.Value;
                                            }
                                            break;

                                        case "mods:dateOther":
                                        case "dateOther":
                                            if ((r.MoveToAttribute("type")) && (r.Value == "reprint"))
                                            {
                                                r.Read();
                                                if (r.NodeType == XmlNodeType.Text)
                                                {
                                                    thisBibInfo.Origin_Info.Date_Reprinted = r.Value;
                                                }
                                            }
                                            break;

                                        case "mods:edition":
                                        case "edition":
                                            r.Read();
                                            if (r.NodeType == XmlNodeType.Text)
                                            {
                                                thisBibInfo.Origin_Info.Edition = r.Value;
                                            }
                                            break;

                                        case "mods:frequency":
                                        case "frequency":
                                            string freq_authority = String.Empty;
                                            if (r.MoveToAttribute("authority"))
                                                freq_authority = r.Value;
                                            r.Read();
                                            if (r.NodeType == XmlNodeType.Text)
                                            {
                                                thisBibInfo.Origin_Info.Add_Frequency(r.Value, freq_authority);
                                            }
                                            break;

                                        case "mods:issuance":
                                        case "issuance":
                                            r.Read();
                                            if (r.NodeType == XmlNodeType.Text)
                                            {
                                                thisBibInfo.Origin_Info.Add_Issuance(r.Value);
                                            }
                                            break;
                                    }
                                }
                            }

                            break;

                        case "mods:physicalDescription":
                        case "physicalDescription":
                            read_physical_description(r, thisBibInfo.Original_Description);
                            break;

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

                                if (r.NodeType == XmlNodeType.Element)
                                {
                                    switch (r.Name)
                                    {
                                        case "mods:recordCreationDate":
                                        case "recordCreationDate":
                                            if ((r.MoveToAttribute("encoding")) && (r.Value == "marc"))
                                            {
                                                r.Read();
                                                thisBibInfo.Record.MARC_Creation_Date = r.Value;
                                            }
                                            break;

                                        case "mods:recordIdentifier":
                                        case "recordIdentifier":
                                            string source = String.Empty;
                                            if (r.MoveToAttribute("source"))
                                            {
                                                thisBibInfo.Record.Main_Record_Identifier.Type = r.Value;
                                            }
                                            r.Read();
                                            thisBibInfo.Record.Main_Record_Identifier.Identifier = r.Value;
                                            break;

                                        case "mods:recordOrigin":
                                        case "recordOrigin":
                                            r.Read();
                                            thisBibInfo.Record.Record_Origin = r.Value;
                                            break;

                                        case "mods:descriptionStandard":
                                        case "descriptionStandard":
                                            r.Read();
                                            thisBibInfo.Record.Description_Standard = r.Value;
                                            break;

                                        case "mods:recordContentSource":
                                        case "recordContentSource":
                                            if (r.MoveToAttribute("authority"))
                                            {
                                                if (r.Value == "marcorg")
                                                {
                                                    r.Read();
                                                    thisBibInfo.Record.Add_MARC_Record_Content_Sources(r.Value);
                                                }
                                            }
                                            else
                                            {
                                                r.Read();
                                                thisBibInfo.Source.Statement = r.Value;
                                            }
                                            break;

                                        case "mods:languageOfCataloging":
                                        case "languageOfCataloging":
                                            string cat_language_text = String.Empty;
                                            string cat_language_rfc_code = String.Empty;
                                            string cat_language_iso_code = String.Empty;
                                            string cat_language_id = String.Empty;
                                            while (r.Read())
                                            {
                                                if ((r.NodeType == XmlNodeType.Element) && ((r.Name == "mods:languageTerm") || (r.Name == "languageTerm")))
                                                {
                                                    if (r.MoveToAttribute("ID"))
                                                        cat_language_id = r.Value;

                                                    if (r.MoveToAttribute("type"))
                                                    {
                                                        switch (r.Value)
                                                        {
                                                            case "code":
                                                                if (r.MoveToAttribute("authority"))
                                                                {
                                                                    if (r.Value == "rfc3066")
                                                                    {
                                                                        r.Read();
                                                                        if (r.NodeType == XmlNodeType.Text)
                                                                        {
                                                                            cat_language_rfc_code = r.Value;
                                                                        }
                                                                    }
                                                                    else if (r.Value == "iso639-2b")
                                                                    {
                                                                        r.Read();
                                                                        if (r.NodeType == XmlNodeType.Text)
                                                                        {
                                                                            cat_language_iso_code = r.Value;
                                                                        }
                                                                    }
                                                                }
                                                                break;

                                                            case "text":
                                                                r.Read();
                                                                if (r.NodeType == XmlNodeType.Text)
                                                                {
                                                                    cat_language_text = r.Value;
                                                                }
                                                                break;

                                                            default:
                                                                r.Read();
                                                                if (r.NodeType == XmlNodeType.Text)
                                                                {
                                                                    cat_language_text = r.Value;
                                                                }
                                                                break;
                                                        }
                                                    }
                                                    else
                                                    {
                                                        r.Read();
                                                        if (r.NodeType == XmlNodeType.Text)
                                                        {
                                                            cat_language_text = r.Value;
                                                        }
                                                    }
                                                }

                                                if ((r.NodeType == XmlNodeType.EndElement) && ((r.Name == "mods:languageOfCataloging") || (r.Name == "languageOfCataloging")))
                                                {
                                                    break;
                                                }
                                            }

                                            if ((cat_language_text.Length > 0) || (cat_language_rfc_code.Length > 0) || (cat_language_iso_code.Length > 0))
                                            {
                                                Language_Info newCatLanguage = new Language_Info(cat_language_text, cat_language_iso_code, cat_language_rfc_code);
                                                thisBibInfo.Record.Add_Catalog_Language(newCatLanguage);
                                            }
                                            break;
                                    }
                                }
                            }
                            break;

                        case "mods:relatedItem":
                        case "relatedItem":
                            string relatedItemType = String.Empty;
                            if (r.MoveToAttribute("type"))
                                relatedItemType = r.Value.ToLower();

                            switch (relatedItemType)
                            {
                                case "original":
                                    while (r.Read())
                                    {
                                        if ((r.NodeType == XmlNodeType.EndElement) && ((r.Name == "mods:relatedItem") || (r.Name == "relatedItem")))
                                            break;

                                        if (r.NodeType == XmlNodeType.Element)
                                        {
                                            if ((r.Name == "mods:physicalDescription") || (r.Name == "physicalDescription"))
                                            {
                                                read_physical_description(r, thisBibInfo.Original_Description);
                                            }
                                        }
                                    }
                                    break;

                                case "series":
                                    string part_type = String.Empty;
                                    string part_caption = String.Empty;
                                    string part_number = String.Empty;

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

                                        if ((r.NodeType == XmlNodeType.EndElement) && ((r.Name == "mods:detail") || (r.Name == "detail")))
                                        {
                                            try
                                            {
                                                switch (part_type)
                                                {
                                                    case "Enum1":
                                                        thisBibInfo.Series_Part_Info.Enum1 = part_caption;
                                                        thisBibInfo.Series_Part_Info.Enum1_Index = Convert.ToInt32(part_number);
                                                        break;

                                                    case "Enum2":
                                                        thisBibInfo.Series_Part_Info.Enum2 = part_caption;
                                                        thisBibInfo.Series_Part_Info.Enum2_Index = Convert.ToInt32(part_number);
                                                        break;

                                                    case "Enum3":
                                                        thisBibInfo.Series_Part_Info.Enum3 = part_caption;
                                                        thisBibInfo.Series_Part_Info.Enum3_Index = Convert.ToInt32(part_number);
                                                        break;

                                                    case "Enum4":
                                                        thisBibInfo.Series_Part_Info.Enum4 = part_caption;
                                                        thisBibInfo.Series_Part_Info.Enum4_Index = Convert.ToInt32(part_number);
                                                        break;

                                                    case "Year":
                                                        thisBibInfo.Series_Part_Info.Year = part_caption;
                                                        thisBibInfo.Series_Part_Info.Year_Index = Convert.ToInt32(part_number);
                                                        break;

                                                    case "Month":
                                                        thisBibInfo.Series_Part_Info.Month = part_caption;
                                                        thisBibInfo.Series_Part_Info.Month_Index = Convert.ToInt32(part_number);
                                                        break;

                                                    case "Day":
                                                        thisBibInfo.Series_Part_Info.Day = part_caption;
                                                        thisBibInfo.Series_Part_Info.Day_Index = Convert.ToInt32(part_number);
                                                        break;
                                                }
                                            }
                                            catch
                                            {
                                            }

                                            part_type = String.Empty;
                                            part_caption = String.Empty;
                                            part_number = String.Empty;
                                        }

                                        if (r.NodeType == XmlNodeType.Element)
                                        {
                                            switch (r.Name)
                                            {
                                                case "mods:titleInfo":
                                                case "titleInfo":
                                                    thisBibInfo.SeriesTitle = read_title_object(r);
                                                    break;

                                                case "mods:detail":
                                                case "detail":
                                                    if (r.MoveToAttribute("type"))
                                                    {
                                                        part_type = r.Value;
                                                    }
                                                    break;

                                                case "mods:caption":
                                                case "caption":
                                                    r.Read();
                                                    if (r.NodeType == XmlNodeType.Text)
                                                    {
                                                        part_caption = r.Value;
                                                    }
                                                    break;

                                                case "mods:number":
                                                case "number":
                                                    r.Read();
                                                    if (r.NodeType == XmlNodeType.Text)
                                                    {
                                                        part_number = r.Value;
                                                    }
                                                    break;
                                            }
                                        }
                                    }
                                    break;

                                default:
                                    Related_Item_Info newRelated = new Related_Item_Info();
                                    thisBibInfo.Add_Related_Item(newRelated);
                                    switch (relatedItemType)
                                    {
                                        case "preceding":
                                            newRelated.Relationship = Related_Item_Type_Enum.preceding;
                                            break;

                                        case "succeeding":
                                            newRelated.Relationship = Related_Item_Type_Enum.succeeding;
                                            break;

                                        case "otherVersion":
                                            newRelated.Relationship = Related_Item_Type_Enum.otherVersion;
                                            break;

                                        case "otherFormat":
                                            newRelated.Relationship = Related_Item_Type_Enum.otherFormat;
                                            break;

                                        case "host":
                                            newRelated.Relationship = Related_Item_Type_Enum.host;
                                            break;
                                    }
                                    if (r.MoveToAttribute("ID"))
                                        newRelated.ID = r.Value;

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

                                        if (r.NodeType == XmlNodeType.Element)
                                        {
                                            switch (r.Name)
                                            {
                                                case "mods:titleInfo":
                                                case "titleInfo":
                                                    newRelated.Set_Main_Title(read_title_object(r));
                                                    break;

                                                case "mods:identifier":
                                                case "identifier":
                                                    Identifier_Info thisRIdentifier = new Identifier_Info();
                                                    if (r.MoveToAttribute("type"))
                                                        thisRIdentifier.Type = r.Value;
                                                    if (r.MoveToAttribute("displayLabel"))
                                                        thisRIdentifier.Display_Label = r.Value;
                                                    r.Read();
                                                    if (r.NodeType == XmlNodeType.Text)
                                                    {
                                                        thisRIdentifier.Identifier = r.Value;
                                                        newRelated.Add_Identifier(thisRIdentifier);
                                                    }
                                                    break;

                                                case "mods:name":
                                                case "name":
                                                    newRelated.Add_Name(read_name_object(r));
                                                    break;

                                                case "mods:note":
                                                case "note":
                                                    Note_Info newRNote = new Note_Info();
                                                    if (r.MoveToAttribute("ID"))
                                                        newRNote.ID = r.Value;
                                                    if (r.MoveToAttribute("type"))
                                                        newRNote.Note_Type_String = r.Value;
                                                    if (r.MoveToAttribute("displayLabel"))
                                                        newRNote.Display_Label = r.Value;
                                                    r.Read();
                                                    if (r.NodeType == XmlNodeType.Text)
                                                    {
                                                        newRNote.Note = r.Value;
                                                        newRelated.Add_Note(newRNote);
                                                    }
                                                    break;

                                                case "mods:url":
                                                case "url":
                                                    if (r.MoveToAttribute("displayLabel"))
                                                        newRelated.URL_Display_Label = r.Value;
                                                    r.Read();
                                                    if (r.NodeType == XmlNodeType.Text)
                                                    {
                                                        newRelated.URL = r.Value;
                                                    }
                                                    break;

                                                case "mods:publisher":
                                                case "publisher":
                                                    r.Read();
                                                    if (r.NodeType == XmlNodeType.Text)
                                                    {
                                                        newRelated.Publisher = r.Value;
                                                    }
                                                    break;

                                                case "mods:recordIdentifier":
                                                case "recordIdentifier":
                                                    if (r.MoveToAttribute("source"))
                                                    {
                                                        if ((r.Value == "ufdc") || (r.Value == "dloc") || (r.Value.ToLower() == "sobekcm"))
                                                        {
                                                            r.Read();
                                                            if (r.NodeType == XmlNodeType.Text)
                                                            {
                                                                newRelated.SobekCM_ID = r.Value;
                                                            }
                                                        }
                                                    }
                                                    break;

                                                case "mods:dateIssued":
                                                case "dateIssued":
                                                    if (r.MoveToAttribute("point"))
                                                    {
                                                        if (r.Value == "start")
                                                        {
                                                            r.Read();
                                                            if (r.NodeType == XmlNodeType.Text)
                                                            {
                                                                newRelated.Start_Date = r.Value;
                                                            }
                                                        }
                                                        else if (r.Value == "end")
                                                        {
                                                            r.Read();
                                                            if (r.NodeType == XmlNodeType.Text)
                                                            {
                                                                newRelated.End_Date = r.Value;
                                                            }
                                                        }
                                                    }
                                                    break;
                                            }
                                        }
                                    }
                                    break;
                            }
                            break;

                        case "mods:subject":
                        case "subject":
                            read_subject_object(r, thisBibInfo);
                            break;

                        case "mods:targetAudience":
                        case "targetAudience":
                            TargetAudience_Info newTarget = new TargetAudience_Info();
                            if (r.MoveToAttribute("ID"))
                                newTarget.ID = r.Value;
                            if (r.MoveToAttribute("authority"))
                                newTarget.Authority = r.Value;
                            r.Read();
                            if (r.NodeType == XmlNodeType.Text)
                            {
                                newTarget.Audience = r.Value;
                                thisBibInfo.Add_Target_Audience(newTarget);
                            }
                            break;

                        case "mods:tableOfContents":
                        case "tableOfContents":
                            r.Read();
                            if (r.NodeType == XmlNodeType.Text)
                            {
                                thisBibInfo.TableOfContents = r.Value;
                            }
                            break;

                        case "mods:titleInfo":
                        case "titleInfo":
                            Title_Info thisTitle = read_title_object(r);
                            if (thisTitle.Title_Type == Title_Type_Enum.UNSPECIFIED)
                                thisBibInfo.Main_Title = thisTitle;
                            else
                                thisBibInfo.Add_Other_Title(thisTitle);
                            break;

                        case "mods:typeOfResource":
                        case "typeOfResource":
                            r.Read();
                            if (r.NodeType == XmlNodeType.Text)
                            {
                                thisBibInfo.Type.Add_Uncontrolled_Type(r.Value);
                            }
                            break;

                        case "mods:extension":
                        case "extension":
                            string schema = String.Empty;
                            string alias = String.Empty;
                            if (r.HasAttributes)
                            {
                                for (int i = 0; i < r.AttributeCount; i++)
                                {
                                    r.MoveToAttribute(i);
                                    if (r.Name.IndexOf("xmlns") == 0)
                                    {
                                        alias = r.Name.Replace("xmlns:", "");
                                        schema = r.Value;
                                        break;
                                    }
                                }
                            }
                            if (schema.IndexOf("vra.xsd") > 0)
                            {
                                read_vra_core_extensions(r, thisBibInfo, alias, Return_Item);
                            }
                            break;
                    }
                }
            }
        }
        /// <summary> Add a new genre term to this item </summary>
        /// <param name="Genre_Term">Genre term for this item</param>
        /// <param name="Authority">Authority for this genre term</param>
        /// <returns>Newly built and added genre object </returns>
        public Genre_Info Add_Genre(string Genre_Term, string Authority)
        {
            if (genres == null)
                genres = new List<Genre_Info>();

            // Create the new genre object
            Genre_Info newGenre = new Genre_Info(Genre_Term, Authority);

            // If this is unique, add to the collection
            if (!genres.Contains(newGenre))
            {
                genres.Add(newGenre);
                return newGenre;
            }
            else
            {
                Genre_Info returnGenre = genres.Find(newGenre.Equals);
                if (String.Compare(Authority, returnGenre.Authority, true) != 0)
                {
                    genres.Add(newGenre);
                    return newGenre;
                }
                return returnGenre;
            }
        }
        /// <summary> Add a new genre to this item </summary>
        /// <param name="Genre">Genre for this item</param>
        public void Add_Genre(Genre_Info Genre)
        {
            if (genres == null)
                genres = new List<Genre_Info>();

            genres.Add(Genre);
        }
 /// <summary> Removes a single genre from the list of genre terms associated with this item </summary>
 /// <param name="Genre"> Genre term to remove </param>
 public void Remove_Genre(Genre_Info Genre)
 {
     if ((genres != null) && (genres.Contains(Genre)))
         genres.Remove(Genre);
 }
        private void saveButton_Button_Pressed(object sender, EventArgs e)
        {
            saved = true;

            extent          = extentTextBox.Text.Trim();
            marc_date_start = date1TextBox.Text.Trim();
            marc_date_end   = date2TextBox.Text.Trim();
            place_code      = placeCodeTextBox.Text.Trim();
            language_code   = languageCodeTextBox.Text.Trim();


            frequencies.Clear();
            genres.Clear();

            if (frequencyComboBox.Text.Trim().Length > 0)
            {
                frequencies.Add(new Origin_Info_Frequency(frequencyComboBox.Text.Trim(), "marcfrequency"));
            }

            if (regularityComboBox.Text.Trim().Length > 0)
            {
                frequencies.Add(new Origin_Info_Frequency(regularityComboBox.Text.Trim(), "marcfrequency"));
            }

            Genre_Info newGenre;

            if (nature1ComboBox.Text.Trim().Length > 0)
            {
                newGenre = new Genre_Info(nature1ComboBox.Text.Trim(), "marcgt");
                if (!genres.Contains(newGenre))
                {
                    genres.Add(newGenre);
                }
            }
            if (nature2ComboBox.Text.Trim().Length > 0)
            {
                newGenre = new Genre_Info(nature2ComboBox.Text.Trim(), "marcgt");
                if (!genres.Contains(newGenre))
                {
                    genres.Add(newGenre);
                }
            }
            if (nature3ComboBox.Text.Trim().Length > 0)
            {
                newGenre = new Genre_Info(nature3ComboBox.Text.Trim(), "marcgt");
                if (!genres.Contains(newGenre))
                {
                    genres.Add(newGenre);
                }
            }
            if (nature4ComboBox.Text.Trim().Length > 0)
            {
                newGenre = new Genre_Info(nature4ComboBox.Text.Trim(), "marcgt");
                if (!genres.Contains(newGenre))
                {
                    genres.Add(newGenre);
                }
            }
            if (govtComboBox.Text.Trim().Length > 0)
            {
                newGenre = new Genre_Info(govtComboBox.Text.Trim(), "marcgt");
                if (!genres.Contains(newGenre))
                {
                    genres.Add(newGenre);
                }
            }
            if (subTypeComboBox.Text.Trim().Length > 0)
            {
                newGenre = new Genre_Info(subTypeComboBox.Text.Trim(), "marcgt");
                if (!genres.Contains(newGenre))
                {
                    genres.Add(newGenre);
                }
            }
            if (conferenceCheckBox.Checked)
            {
                newGenre = new Genre_Info("conference publication", "marcgt");
                if (!genres.Contains(newGenre))
                {
                    genres.Add(newGenre);
                }
            }

            Close();
        }
Beispiel #7
0
        private void saveButton_Button_Pressed(object sender, EventArgs e)
        {
            if (!read_only)
            {
                saved = true;

                extent          = extentTextBox.Text.Trim();
                marc_date_start = date1TextBox.Text.Trim();
                marc_date_end   = date2TextBox.Text.Trim();
                place_code      = placeCodeTextBox.Text.Trim();
                language_code   = languageCodeTextBox.Text.Trim();

                audiences.Clear();
                genres.Clear();

                if (audienceComboBox.Text.Trim().Length > 0)
                {
                    audiences.Add(new TargetAudience_Info(audienceComboBox.Text.Trim(), "marctarget"));
                }

                Genre_Info newGenre;
                if (nature1ComboBox.Text.Trim().Length > 0)
                {
                    newGenre = new Genre_Info(nature1ComboBox.Text.Trim(), "marcgt");
                    if (!genres.Contains(newGenre))
                    {
                        genres.Add(newGenre);
                    }
                }
                if (nature2ComboBox.Text.Trim().Length > 0)
                {
                    newGenre = new Genre_Info(nature2ComboBox.Text.Trim(), "marcgt");
                    if (!genres.Contains(newGenre))
                    {
                        genres.Add(newGenre);
                    }
                }
                if (nature3ComboBox.Text.Trim().Length > 0)
                {
                    newGenre = new Genre_Info(nature3ComboBox.Text.Trim(), "marcgt");
                    if (!genres.Contains(newGenre))
                    {
                        genres.Add(newGenre);
                    }
                }
                if (nature4ComboBox.Text.Trim().Length > 0)
                {
                    newGenre = new Genre_Info(nature4ComboBox.Text.Trim(), "marcgt");
                    if (!genres.Contains(newGenre))
                    {
                        genres.Add(newGenre);
                    }
                }
                if (govtComboBox.Text.Trim().Length > 0)
                {
                    newGenre = new Genre_Info(govtComboBox.Text.Trim(), "marcgt");
                    if (!genres.Contains(newGenre))
                    {
                        genres.Add(newGenre);
                    }
                }
                if (form1ComboBox.Text.Trim().Length > 0)
                {
                    newGenre = new Genre_Info(form1ComboBox.Text.Trim(), "marcgt");
                    if (!genres.Contains(newGenre))
                    {
                        genres.Add(newGenre);
                    }
                }
                if (form2ComboBox.Text.Trim().Length > 0)
                {
                    newGenre = new Genre_Info(form2ComboBox.Text.Trim(), "marcgt");
                    if (!genres.Contains(newGenre))
                    {
                        genres.Add(newGenre);
                    }
                }
                if (biographyComboBox.Text.Trim().Length > 0)
                {
                    newGenre = new Genre_Info(biographyComboBox.Text.Trim(), "marcgt");
                    if (!genres.Contains(newGenre))
                    {
                        genres.Add(newGenre);
                    }
                }
                if (conferenceCheckBox.Checked)
                {
                    newGenre = new Genre_Info("conference publication", "marcgt");
                    if (!genres.Contains(newGenre))
                    {
                        genres.Add(newGenre);
                    }
                }
                if (festschriftCheckBox.Checked)
                {
                    newGenre = new Genre_Info("festschrift", "marcgt");
                    if (!genres.Contains(newGenre))
                    {
                        genres.Add(newGenre);
                    }
                }
                if (indexCheckBox.Checked)
                {
                    newGenre = new Genre_Info("indexed", "marcgt");
                    if (!genres.Contains(newGenre))
                    {
                        genres.Add(newGenre);
                    }
                }
            }

            Close();
        }