/// <summary> Clears the current metadata configuration and restores all the values
        /// to the default reader/writers and profiles </summary>
        public void Set_Default_Values()
        {
            Clear();
            isDefault = true;

            // Add the dublin core file reader/writer
            Metadata_File_ReaderWriter_Config dcFile = new Metadata_File_ReaderWriter_Config {MD_Type = Metadata_File_Type_Enum.DC, Label = "Dublin Core File", canRead = true, canWrite = true, Code_Assembly = String.Empty, Code_Namespace = "SobekCM.Resource_Object.Metadata_File_ReaderWriters", Code_Class = "DC_File_ReaderWriter"};
            dcFile.Add_Option("RDF_Style", "false");
            Add_Metadata_File_ReaderWriter(dcFile);

            // Add the dublin core file reader/writer
            Metadata_File_ReaderWriter_Config dcFile2 = new Metadata_File_ReaderWriter_Config {MD_Type = Metadata_File_Type_Enum.DC, Label = "Dublin Core File (RDF Style)", canRead = false, canWrite = true, Code_Assembly = String.Empty, Code_Namespace = "SobekCM.Resource_Object.Metadata_File_ReaderWriters", Code_Class = "DC_File_ReaderWriter"};
            dcFile2.Add_Option("RDF_Style", "true");
            Add_Metadata_File_ReaderWriter(dcFile2);

            // Add the EAD file reader/writer
            Metadata_File_ReaderWriter_Config eadFile = new Metadata_File_ReaderWriter_Config {MD_Type = Metadata_File_Type_Enum.EAD, Label = "Encoded Archival Descriptor (EAD)", canRead = true, canWrite = false, Code_Assembly = String.Empty, Code_Namespace = "SobekCM.Resource_Object.Metadata_File_ReaderWriters", Code_Class = "EAD_File_ReaderWriter"};
            eadFile.Add_Option("Analyze_Description", "true");
            Add_Metadata_File_ReaderWriter(eadFile);

            // Add the MARC21 file reader/writer
            Metadata_File_ReaderWriter_Config marc21File = new Metadata_File_ReaderWriter_Config {MD_Type = Metadata_File_Type_Enum.MARC21, Label = "MARC21 Single Record File", canRead = true, canWrite = true, Code_Assembly = String.Empty, Code_Namespace = "SobekCM.Resource_Object.Metadata_File_ReaderWriters", Code_Class = "Marc21_File_ReaderWriter"};
            Add_Metadata_File_ReaderWriter(marc21File);

            // Add the MarcXML file reader/writer
            Metadata_File_ReaderWriter_Config marcxmlFile = new Metadata_File_ReaderWriter_Config {MD_Type = Metadata_File_Type_Enum.MARCXML, Label = "MarcXML Single Record File", canRead = true, canWrite = true, Code_Assembly = String.Empty, Code_Namespace = "SobekCM.Resource_Object.Metadata_File_ReaderWriters", Code_Class = "MarcXML_File_ReaderWriter"};
            Add_Metadata_File_ReaderWriter(marcxmlFile);

            // Add the METS file reader/writer
            Metadata_File_ReaderWriter_Config metsFile = new Metadata_File_ReaderWriter_Config {MD_Type = Metadata_File_Type_Enum.METS, Label = "Metadata Encoding and Transmission Standard (METS)", canRead = true, canWrite = true, Code_Assembly = String.Empty, Code_Namespace = "SobekCM.Resource_Object.Metadata_File_ReaderWriters", Code_Class = "METS_File_ReaderWriter"};
            metsFile.Add_Option("Minimize_File_Info", "false");
            metsFile.Add_Option("Support_Divisional_dmdSec_amdSec", "true");
            Add_Metadata_File_ReaderWriter(metsFile);

            // Add the MODS file reader/writer
            Metadata_File_ReaderWriter_Config modsFile = new Metadata_File_ReaderWriter_Config {MD_Type = Metadata_File_Type_Enum.MODS, Label = "Metadata Object Description Standard (MODS)", canRead = true, canWrite = true, Code_Assembly = String.Empty, Code_Namespace = "SobekCM.Resource_Object.Metadata_File_ReaderWriters", Code_Class = "MODS_File_ReaderWriter"};
            Add_Metadata_File_ReaderWriter(modsFile);

            // Add the INFO file reader/writer
            Metadata_File_ReaderWriter_Config infoFile = new Metadata_File_ReaderWriter_Config {MD_Type = Metadata_File_Type_Enum.OTHER, Other_MD_Type = "INFO", Label = "Legacy UF INFO Files", canRead = true, canWrite = false, Code_Assembly = String.Empty, Code_Namespace = "SobekCM.Resource_Object.Metadata_File_ReaderWriters", Code_Class = "INFO_File_ReaderWriter"};
            Add_Metadata_File_ReaderWriter(infoFile);

            // Add the MXF file reader/writer
            Metadata_File_ReaderWriter_Config mxfFile = new Metadata_File_ReaderWriter_Config {MD_Type = Metadata_File_Type_Enum.OTHER, Other_MD_Type = "MXF", Label = "MXF File", canRead = true, canWrite = false, Code_Assembly = String.Empty, Code_Namespace = "SobekCM.Resource_Object.Metadata_File_ReaderWriters", Code_Class = "MXF_File_ReaderWriter"};
            Add_Metadata_File_ReaderWriter(mxfFile);

            // Add the OAI-PMH file reader/writer
            Metadata_File_ReaderWriter_Config oaiFile = new Metadata_File_ReaderWriter_Config {MD_Type = Metadata_File_Type_Enum.OTHER, Other_MD_Type = "OAI", Label = "OAI-PMH File", canRead = false, canWrite = true, Code_Assembly = String.Empty, Code_Namespace = "SobekCM.Resource_Object.Metadata_File_ReaderWriters", Code_Class = "OAI_File_ReaderWriter"};
            Add_Metadata_File_ReaderWriter(oaiFile);

            // Add the MODS section reader/writer
            METS_Section_ReaderWriter_Config modsSection = new METS_Section_ReaderWriter_Config {ID = "MODS", Label = "MODS", Code_Assembly = String.Empty, Code_Namespace = "SobekCM.Resource_Object.METS_Sec_ReaderWriters", Code_Class = "MODS_METS_dmdSec_ReaderWriter", isActive = true, METS_Section = METS_Section_Type_Enum.DmdSec};
            modsSection.Add_Mapping(new METS_Section_ReaderWriter_Mapping("MODS", "MODS Metadata", true));
            modsSection.Add_Mapping(new METS_Section_ReaderWriter_Mapping("Metadata Object Description Standard", false ));
            Add_METS_Section_ReaderWriter(modsSection);

            // Add the dublin core section reader/writer
            METS_Section_ReaderWriter_Config dcSection = new METS_Section_ReaderWriter_Config {ID = "DC", Label = "Dublin Core", Code_Assembly = String.Empty, Code_Namespace = "SobekCM.Resource_Object.METS_Sec_ReaderWriters", Code_Class = "DC_METS_dmdSec_ReaderWriter", isActive = true, METS_Section = METS_Section_Type_Enum.DmdSec};
            dcSection.Add_Mapping(new METS_Section_ReaderWriter_Mapping("DC", "Dublin Core Metadata", true));
            dcSection.Add_Mapping(new METS_Section_ReaderWriter_Mapping("DUBLIN CORE", false));
            Add_METS_Section_ReaderWriter(dcSection);

            // Add the MarcXML section reader/writer
            METS_Section_ReaderWriter_Config marcXMLSection = new METS_Section_ReaderWriter_Config {ID = "MARCXML", Label = "MARCXML", Code_Assembly = String.Empty, Code_Namespace = "SobekCM.Resource_Object.METS_Sec_ReaderWriters", Code_Class = "MarcXML_METS_dmdSec_ReaderWriter", isActive = true, METS_Section = METS_Section_Type_Enum.DmdSec};
            marcXMLSection.Add_Mapping(new METS_Section_ReaderWriter_Mapping("MARCXML", "MarcXML Metadata", true));
            Add_METS_Section_ReaderWriter(marcXMLSection);

            // Add the DarwinCore section reader/writer
            METS_Section_ReaderWriter_Config darwinSection = new METS_Section_ReaderWriter_Config {ID = "DARWIN", Label = "DarwinCore", Code_Assembly = String.Empty, Code_Namespace = "SobekCM.Resource_Object.METS_Sec_ReaderWriters", Code_Class = "DarwinCore_METS_dmdSec_ReaderWriter", isActive = true, METS_Section = METS_Section_Type_Enum.DmdSec};
            darwinSection.Add_Mapping(new METS_Section_ReaderWriter_Mapping("OTHER", "DARWINCORE", "DarwinCore Zoological Taxonomic Information", true));
            Add_METS_Section_ReaderWriter(darwinSection);

            // Add the ETD section reader/writer
            METS_Section_ReaderWriter_Config etdSection = new METS_Section_ReaderWriter_Config {ID = "ETD", Label = "ETD", Code_Assembly = String.Empty, Code_Namespace = "SobekCM.Resource_Object.METS_Sec_ReaderWriters", Code_Class = "ETD_SobekCM_METS_dmdSec_ReaderWriter", isActive = true, METS_Section = METS_Section_Type_Enum.DmdSec};
            etdSection.Add_Mapping(new METS_Section_ReaderWriter_Mapping("OTHER", "SOBEK_ETD", "SobekCM ETD Extension", true));
            Add_METS_Section_ReaderWriter(etdSection);

            // Add the ETD section reader/writer
            METS_Section_ReaderWriter_Config etd2Section = new METS_Section_ReaderWriter_Config {ID = "ETD2", Label = "ETD2", Code_Assembly = String.Empty, Code_Namespace = "SobekCM.Resource_Object.METS_Sec_ReaderWriters", Code_Class = "ETD_PALMM_METS_dmdSec_ReaderWriter", isActive = true, METS_Section = METS_Section_Type_Enum.DmdSec};
            etd2Section.Add_Mapping(new METS_Section_ReaderWriter_Mapping("OTHER", "PALMM", "PALMM ETD Extension", true));
            etd2Section.Add_Mapping(new METS_Section_ReaderWriter_Mapping("OTHER", "PALMM Extensions", "PALMM ETD Extension", false));
            Add_METS_Section_ReaderWriter(etd2Section);

            // Add the SobekCM section reader/writer
            METS_Section_ReaderWriter_Config sobekCMSection = new METS_Section_ReaderWriter_Config {ID = "SOBEK1", Label = "SobekCM", Code_Assembly = String.Empty, Code_Namespace = "SobekCM.Resource_Object.METS_Sec_ReaderWriters", Code_Class = "SobekCM_METS_dmdSec_ReaderWriter", isActive = true, METS_Section = METS_Section_Type_Enum.DmdSec};
            sobekCMSection.Add_Mapping(new METS_Section_ReaderWriter_Mapping("OTHER", "SOBEKCM", "SobekCM Custom Metadata", true));
            sobekCMSection.Add_Mapping(new METS_Section_ReaderWriter_Mapping("OTHER", "UFDC", "SobekCM Custom Metadata", false));
            sobekCMSection.Add_Mapping(new METS_Section_ReaderWriter_Mapping("OTHER", "DLOC", "SobekCM Custom Metadata", false));
            Add_METS_Section_ReaderWriter(sobekCMSection);

            // Add the SobekCM Map section reader/writer
            METS_Section_ReaderWriter_Config sobekCMMapSection = new METS_Section_ReaderWriter_Config {ID = "SOBEK2", Label = "SobekCM Map", Code_Assembly = String.Empty, Code_Namespace = "SobekCM.Resource_Object.METS_Sec_ReaderWriters", Code_Class = "SobekCM_Map_METS_dmdSec_ReaderWriter", isActive = true, METS_Section = METS_Section_Type_Enum.DmdSec};
            sobekCMMapSection.Add_Mapping(new METS_Section_ReaderWriter_Mapping("OTHER", "SOBEK_MAP", "SobekCM Custom Map Authority Metadata", true));
            sobekCMMapSection.Add_Mapping(new METS_Section_ReaderWriter_Mapping("OTHER", "UFDC_MAP", "SobekCM Custom Map Authority Metadata", false));
            Add_METS_Section_ReaderWriter(sobekCMMapSection);

            // Add the DAITSS section reader/writer
            METS_Section_ReaderWriter_Config daitssSection = new METS_Section_ReaderWriter_Config {ID = "DAITSS", Label = "DAITSS", Code_Assembly = String.Empty, Code_Namespace = "SobekCM.Resource_Object.METS_Sec_ReaderWriters", Code_Class = "DAITSS_METS_amdSec_ReaderWriter", isActive = true, METS_Section = METS_Section_Type_Enum.AmdSec, AmdSecType = METS_amdSec_Type_Enum.DigiProvMD};
            daitssSection.Add_Mapping(new METS_Section_ReaderWriter_Mapping("OTHER", "DAITSS", "DAITSS Archiving Information", true));
            Add_METS_Section_ReaderWriter(daitssSection);

            // Add the RightsMD section reader/writer
            METS_Section_ReaderWriter_Config rightsSection = new METS_Section_ReaderWriter_Config {ID = "RIGHTS", Label = "RightsMD", Code_Assembly = String.Empty, Code_Namespace = "SobekCM.Resource_Object.METS_Sec_ReaderWriters", Code_Class = "RightsMD_METS_amdSec_ReaderWriter", isActive = true, METS_Section = METS_Section_Type_Enum.AmdSec, AmdSecType = METS_amdSec_Type_Enum.RightsMD};
            rightsSection.Add_Mapping(new METS_Section_ReaderWriter_Mapping("OTHER", "RIGHTSMD", "Rights Information", true));
            Add_METS_Section_ReaderWriter(rightsSection);

            // Add the SobekCM fileinfo section reader/writer
            METS_Section_ReaderWriter_Config sobekCMFileSection = new METS_Section_ReaderWriter_Config {ID = "SOBEK3", Label = "SobekCM FileInfo", Code_Assembly = String.Empty, Code_Namespace = "SobekCM.Resource_Object.METS_Sec_ReaderWriters", Code_Class = "SobekCM_FileInfo_METS_amdSec_ReaderWriter", isActive = true, METS_Section = METS_Section_Type_Enum.AmdSec, AmdSecType = METS_amdSec_Type_Enum.TechMD};
            sobekCMFileSection.Add_Mapping(new METS_Section_ReaderWriter_Mapping("OTHER", "SOBEKCM", "SobekCM File Technical Details", true));
            Add_METS_Section_ReaderWriter(sobekCMFileSection);

            // Add the GML section reader/writer
            METS_Section_ReaderWriter_Config gmlSection = new METS_Section_ReaderWriter_Config {ID = "GML", Label = "GML Coordinate", Code_Assembly = String.Empty, Code_Namespace = "SobekCM.Resource_Object.METS_Sec_ReaderWriters", Code_Class = "GML_METS_dmdSec_ReaderWriter", isActive = true, METS_Section = METS_Section_Type_Enum.DmdSec};
            gmlSection.Add_Mapping(new METS_Section_ReaderWriter_Mapping("OTHER", "GML", "Geographic Markup Language", true));
            Add_METS_Section_ReaderWriter(gmlSection);

            // Add the IEEE-LOM section reader/writer
            METS_Section_ReaderWriter_Config lomSection = new METS_Section_ReaderWriter_Config {ID = "IEEE-LOM", Label = "IEEE-LOM: Learning Object Metadata", Code_Assembly = String.Empty, Code_Namespace = "SobekCM.Resource_Object.METS_Sec_ReaderWriters", Code_Class = "LOM_IEEE_METS_dmdSec_ReaderWriter", isActive = true, METS_Section = METS_Section_Type_Enum.DmdSec};
            lomSection.Add_Mapping(new METS_Section_ReaderWriter_Mapping("OTHER", "IEEE-LOM", "Learning Object Metadata", true));
            Add_METS_Section_ReaderWriter(lomSection);

            // Add the VRACore section reader/writer
            METS_Section_ReaderWriter_Config vraSection = new METS_Section_ReaderWriter_Config {ID = "VRACORE", Label = "VRACore Visual Resource Metadata", Code_Assembly = String.Empty, Code_Namespace = "SobekCM.Resource_Object.METS_Sec_ReaderWriters", Code_Class = "VRACore_METS_dmdSec_ReaderWriter", isActive = true, METS_Section = METS_Section_Type_Enum.DmdSec};
            vraSection.Add_Mapping(new METS_Section_ReaderWriter_Mapping("OTHER", "VRACore", "VRACore Visual Resource Metadata", true));
            Add_METS_Section_ReaderWriter(vraSection);

            // Add the default METS writig profile
            METS_Writing_Profile defaultProfile = new METS_Writing_Profile {Default_Profile = true, Profile_Name = "Complete MODS Writer", Profile_Description = "This profile includes almost all of the possible sub-writers but the main bibliographic data is stored in MODS"};
            defaultProfile.Add_Package_Level_DmdSec_Writer_Config(modsSection);
            defaultProfile.Add_Package_Level_DmdSec_Writer_Config(sobekCMSection);
            defaultProfile.Add_Package_Level_DmdSec_Writer_Config(sobekCMMapSection);
            defaultProfile.Add_Package_Level_DmdSec_Writer_Config(darwinSection);
            defaultProfile.Add_Package_Level_DmdSec_Writer_Config(etdSection);
            defaultProfile.Add_Package_Level_DmdSec_Writer_Config(gmlSection);
            defaultProfile.Add_Package_Level_DmdSec_Writer_Config(lomSection);
            defaultProfile.Add_Package_Level_DmdSec_Writer_Config(vraSection);
            defaultProfile.Add_Package_Level_AmdSec_Writer_Config(daitssSection);
            defaultProfile.Add_Package_Level_AmdSec_Writer_Config(rightsSection);
            defaultProfile.Add_Package_Level_AmdSec_Writer_Config(sobekCMFileSection);
             //   defaultProfile.Add_Division_Level_DmdSec_Writer_Config(MODS_Section);
            defaultProfile.Add_Division_Level_DmdSec_Writer_Config(gmlSection);
            Add_METS_Writing_Profile(defaultProfile);

            // Add the default METS writig profile
            METS_Writing_Profile dcProfile = new METS_Writing_Profile {Default_Profile = false, Profile_Name = "Simple Dublin Core Writer", Profile_Description = "This is a simplified profile which uses Dublin Core to describe all levels of the METS"};
            dcProfile.Add_Package_Level_DmdSec_Writer_Config(dcSection);
            dcProfile.Add_Package_Level_AmdSec_Writer_Config(daitssSection);
            dcProfile.Add_Package_Level_AmdSec_Writer_Config(rightsSection);
            dcProfile.Add_Package_Level_AmdSec_Writer_Config(sobekCMFileSection);
            dcProfile.Add_Division_Level_DmdSec_Writer_Config(dcSection);
            dcProfile.Add_File_Level_DmdSec_Writer_Config(dcSection);
            Add_METS_Writing_Profile(dcProfile);

            // Add the standard metadata mapper
            Mapping_Configs.Add(new Metadata_Mapping_Config("Standard Mapper", "SobekCM.Resource_Object.Mapping", "Standard_Bibliographic_Mapper", null ));
        }
        private void add_single_metadata_writing_profile(TextWriter Output, METS_Writing_Profile Profile )
        {
            if (!String.IsNullOrEmpty(Profile.Profile_Description))
                Output.WriteLine("  <p>" + Profile.Profile_Description + "</p>");

            Output.WriteLine("  <table class=\"sbkSeav_BaseTable sbkSeav_MetsProfileTable\">");
            Output.WriteLine("    <tr>");
            Output.WriteLine("      <th class=\"sbkSeav_MetsProfileTable_ActiveCol\">Is Active?</th>");
            Output.WriteLine("      <th class=\"sbkSeav_MetsProfileTable_LabelCol\">Label</th>");
            Output.WriteLine("      <th class=\"sbkSeav_MetsProfileTable_LabelCol\">MD Type</th>");
            Output.WriteLine("      <th class=\"sbkSeav_MetsProfileTable_SectionCol\">METS Section</th>");
            Output.WriteLine("      <th class=\"sbkSeav_MetsProfileTable_Codeol\">Code Class</th>");
             //   Output.WriteLine("      <th class=\"sbkSeav_MetsProfileTable_OptionsCol\">Options</th>");
            Output.WriteLine("    </tr>");

            if ((Profile.Package_Level_AmdSec_Writer_Configs.Count > 0) || (Profile.Package_Level_DmdSec_Writer_Configs.Count > 0))
            {
                // Add a row for this
                Output.WriteLine("    <tr class=\"sbkSeav_MetsProfileTable_LevelRow\">");
                Output.WriteLine("      <td colspan=\"5\">Package Level Writers</td>");
                Output.WriteLine("    </tr>");

                foreach (METS_Section_ReaderWriter_Config config in Profile.Package_Level_DmdSec_Writer_Configs)
                {
                    add_metadata_single_config(Output, config, true);
                }

                foreach (METS_Section_ReaderWriter_Config config in Profile.Package_Level_AmdSec_Writer_Configs)
                {
                    add_metadata_single_config(Output, config, true);
                }
            }

            if ((Profile.Division_Level_DmdSec_Writer_Configs.Count > 0) || (Profile.Division_Level_AmdSec_Writer_Configs.Count > 0))
            {
                // Add a row for this
                Output.WriteLine("    <tr class=\"sbkSeav_MetsProfileTable_LevelRow\">");
                Output.WriteLine("      <td colspan=\"5\">Division Level Writers</td>");
                Output.WriteLine("    </tr>");

                foreach (METS_Section_ReaderWriter_Config config in Profile.Division_Level_DmdSec_Writer_Configs)
                {
                    add_metadata_single_config(Output, config, true);
                }

                foreach (METS_Section_ReaderWriter_Config config in Profile.Division_Level_AmdSec_Writer_Configs)
                {
                    add_metadata_single_config(Output, config, true);
                }
            }

            if ((Profile.File_Level_DmdSec_Writer_Configs.Count > 0) || (Profile.File_Level_AmdSec_Writer_Configs.Count > 0))
            {
                // Add a row for this
                Output.WriteLine("    <tr class=\"sbkSeav_MetsProfileTable_LevelRow\">");
                Output.WriteLine("      <td colspan=\"5\">File Level Writers</td>");
                Output.WriteLine("    </tr>");

                foreach (METS_Section_ReaderWriter_Config config in Profile.File_Level_DmdSec_Writer_Configs)
                {
                    add_metadata_single_config(Output, config, true);
                }

                foreach (METS_Section_ReaderWriter_Config config in Profile.File_Level_AmdSec_Writer_Configs)
                {
                    add_metadata_single_config(Output, config, true);
                }
            }
            Output.WriteLine("  </table>");
        }
 /// <summary> Clear all the METS writing profiles from this configuration </summary>
 public void Clear_METS_Writing_Profiles()
 {
     MetsWritingProfiles.Clear();
     metsWritingProfilesDictionary.Clear();
     defaultWritingProfile = null;
 }
        /// <summary> Gets an individual METS writing profile, by profile name </summary>
        /// <param name="ProfileName"> Name of the profile to get </param>
        /// <returns> Either the requested profile, if it exists, or NULL </returns>
        public METS_Writing_Profile Get_Writing_Profile(string ProfileName)
        {
            // Check the dictionary
            if (metsWritingProfilesDictionary == null)
                metsWritingProfilesDictionary = new Dictionary<string, METS_Writing_Profile>( StringComparer.OrdinalIgnoreCase);

            // Are they the same count. i.e., is the dictionary good?
            if (metsWritingProfilesDictionary.Count != MetsWritingProfiles.Count)
            {
                metsWritingProfilesDictionary.Clear();
                foreach (METS_Writing_Profile profile in MetsWritingProfiles)
                {
                    if ((defaultWritingProfile == null) && (profile.Default_Profile))
                        defaultWritingProfile = profile;

                    metsWritingProfilesDictionary[profile.Profile_Name] = profile;
                }
            }

            // Now, return the profile, if it exists
            if (metsWritingProfilesDictionary.ContainsKey(ProfileName))
                return metsWritingProfilesDictionary[ProfileName];

            return null;
        }
 /// <summary> Adds a new METS writing profile to this metadata configuration </summary>
 /// <param name="NewProfile"> New metadata profile to add </param>
 public void Add_METS_Writing_Profile( METS_Writing_Profile NewProfile )
 {
     MetsWritingProfiles.Add(NewProfile);
     metsWritingProfilesDictionary[NewProfile.Profile_Name] = NewProfile;
     if (NewProfile.Default_Profile)
         defaultWritingProfile = NewProfile;
 }
        /// <summary> Clear all the current metadata configuration information </summary>
        public void Clear()
        {
            Metadata_File_ReaderWriter_Configs.Clear();
            METS_Section_File_ReaderWriter_Configs.Clear();
            Metadata_Modules_To_Include.Clear();
            MetsWritingProfiles.Clear();
            defaultWritingProfile = null;
            metsWritingProfilesDictionary.Clear();

            packageAmdSecDictionary.Clear();
            packageDmdSecDictionary.Clear();
            divisionDmdSecDictionary.Clear();
            divisionAmdSecDictionary.Clear();
            fileDmdSecDictionary.Clear();
            fileAmdSecDictionary.Clear();

            errorsEncountered.Clear();

            Mapping_Configs.Clear();

            isDefault = false;
        }
 /// <summary> Clear all the current metadata configuration information </summary>
 private static void Clear()
 {
     metadataFileReaderWriterConfigs.Clear();
     metsSectionReaderWriterConfigs.Clear();
     packageAmdSecDictionary.Clear();
     packageDmdSecDictionary.Clear();
     divisionDmdSecDictionary.Clear();
     divisionAmdSecDictionary.Clear();
     fileDmdSecDictionary.Clear();
     fileAmdSecDictionary.Clear();
     defaultWritingProfile = null;
     metsWritingProfiles.Clear();
     metadataModules.Clear();
     errorsEncountered.Clear();
 }
        /// <summary> Clears the current metadata configuration and restores all the values
        /// to the default reader/writers and profiles </summary>
        public static void Set_Default_Values()
        {
            Clear();

            // Add the dublin core file reader/writer
            Metadata_File_ReaderWriter_Config DC_File = new Metadata_File_ReaderWriter_Config();
            DC_File.MD_Type = Metadata_File_Type_Enum.DC;
            DC_File.Label = "Dublin Core File";
            DC_File.canRead = true;
            DC_File.canWrite = true;
            DC_File.Code_Assembly = String.Empty;
            DC_File.Code_Namespace = "SobekCM.Resource_Object.Metadata_File_ReaderWriters";
            DC_File.Code_Class = "DC_File_ReaderWriter";
            DC_File.Add_Option("RDF_Style", "false");
            Add_Metadata_File_ReaderWriter(DC_File);

            // Add the dublin core file reader/writer
            Metadata_File_ReaderWriter_Config DC_File2 = new Metadata_File_ReaderWriter_Config();
            DC_File2.MD_Type = Metadata_File_Type_Enum.DC;
            DC_File2.Label = "Dublin Core File (RDF Style)";
            DC_File2.canRead = false;
            DC_File2.canWrite = true;
            DC_File2.Code_Assembly = String.Empty;
            DC_File2.Code_Namespace = "SobekCM.Resource_Object.Metadata_File_ReaderWriters";
            DC_File2.Code_Class = "DC_File_ReaderWriter";
            DC_File2.Add_Option("RDF_Style", "true");
            Add_Metadata_File_ReaderWriter(DC_File2);

            // Add the EAD file reader/writer
            Metadata_File_ReaderWriter_Config EAD_File = new Metadata_File_ReaderWriter_Config();
            EAD_File.MD_Type = Metadata_File_Type_Enum.EAD;
            EAD_File.Label = "Encoded Archival Descriptor (EAD)";
            EAD_File.canRead = true;
            EAD_File.canWrite = false;
            EAD_File.Code_Assembly = String.Empty;
            EAD_File.Code_Namespace = "SobekCM.Resource_Object.Metadata_File_ReaderWriters";
            EAD_File.Code_Class = "EAD_File_ReaderWriter";
            EAD_File.Add_Option("Analyze_Description", "true");
            Add_Metadata_File_ReaderWriter(EAD_File);

            // Add the MARC21 file reader/writer
            Metadata_File_ReaderWriter_Config MARC21_File = new Metadata_File_ReaderWriter_Config();
            MARC21_File.MD_Type = Metadata_File_Type_Enum.MARC21;
            MARC21_File.Label = "MARC21 Single Record File";
            MARC21_File.canRead = true;
            MARC21_File.canWrite = true;
            MARC21_File.Code_Assembly = String.Empty;
            MARC21_File.Code_Namespace = "SobekCM.Resource_Object.Metadata_File_ReaderWriters";
            MARC21_File.Code_Class = "Marc21_File_ReaderWriter";
            Add_Metadata_File_ReaderWriter(MARC21_File);

            // Add the MarcXML file reader/writer
            Metadata_File_ReaderWriter_Config MARCXML_File = new Metadata_File_ReaderWriter_Config();
            MARCXML_File.MD_Type = Metadata_File_Type_Enum.MARCXML;
            MARCXML_File.Label = "MarcXML Single Record File";
            MARCXML_File.canRead = true;
            MARCXML_File.canWrite = true;
            MARCXML_File.Code_Assembly = String.Empty;
            MARCXML_File.Code_Namespace = "SobekCM.Resource_Object.Metadata_File_ReaderWriters";
            MARCXML_File.Code_Class = "MarcXML_File_ReaderWriter";
            Add_Metadata_File_ReaderWriter(MARCXML_File);

            // Add the METS file reader/writer
            Metadata_File_ReaderWriter_Config METS_File = new Metadata_File_ReaderWriter_Config();
            METS_File.MD_Type = Metadata_File_Type_Enum.METS;
            METS_File.Label = "Metadata Encoding and Transmission Standard (METS)";
            METS_File.canRead = true;
            METS_File.canWrite = true;
            METS_File.Code_Assembly = String.Empty;
            METS_File.Code_Namespace = "SobekCM.Resource_Object.Metadata_File_ReaderWriters";
            METS_File.Code_Class = "METS_File_ReaderWriter";
            METS_File.Add_Option("Minimize_File_Info", "false");
            METS_File.Add_Option("Support_Divisional_dmdSec_amdSec", "true");
            Add_Metadata_File_ReaderWriter(METS_File);

            // Add the MODS file reader/writer
            Metadata_File_ReaderWriter_Config MODS_File = new Metadata_File_ReaderWriter_Config();
            MODS_File.MD_Type = Metadata_File_Type_Enum.MODS;
            MODS_File.Label = "Metadata Object Description Standard (MODS)";
            MODS_File.canRead = true;
            MODS_File.canWrite = true;
            MODS_File.Code_Assembly = String.Empty;
            MODS_File.Code_Namespace = "SobekCM.Resource_Object.Metadata_File_ReaderWriters";
            MODS_File.Code_Class = "MODS_File_ReaderWriter";
            Add_Metadata_File_ReaderWriter(MODS_File);

            // Add the INFO file reader/writer
            Metadata_File_ReaderWriter_Config INFO_File = new Metadata_File_ReaderWriter_Config();
            INFO_File.MD_Type = Metadata_File_Type_Enum.OTHER;
            INFO_File.Other_MD_Type = "INFO";
            INFO_File.Label = "Legacy UF INFO Files";
            INFO_File.canRead = true;
            INFO_File.canWrite = false;
            INFO_File.Code_Assembly = String.Empty;
            INFO_File.Code_Namespace = "SobekCM.Resource_Object.Metadata_File_ReaderWriters";
            INFO_File.Code_Class = "INFO_File_ReaderWriter";
            Add_Metadata_File_ReaderWriter(INFO_File);

            // Add the MXF file reader/writer
            Metadata_File_ReaderWriter_Config MXF_File = new Metadata_File_ReaderWriter_Config();
            MXF_File.MD_Type = Metadata_File_Type_Enum.OTHER;
            MXF_File.Other_MD_Type = "MXF";
            MXF_File.Label = "MXF File";
            MXF_File.canRead = true;
            MXF_File.canWrite = false;
            MXF_File.Code_Assembly = String.Empty;
            MXF_File.Code_Namespace = "SobekCM.Resource_Object.Metadata_File_ReaderWriters";
            MXF_File.Code_Class = "MXF_File_ReaderWriter";
            Add_Metadata_File_ReaderWriter(MXF_File);

            // Add the OAI-PMH file reader/writer
            Metadata_File_ReaderWriter_Config OAI_File = new Metadata_File_ReaderWriter_Config();
            OAI_File.MD_Type = Metadata_File_Type_Enum.OTHER;
            OAI_File.Other_MD_Type = "OAI";
            OAI_File.Label = "OAI-PMH File";
            OAI_File.canRead = false;
            OAI_File.canWrite = true;
            OAI_File.Code_Assembly = String.Empty;
            OAI_File.Code_Namespace = "SobekCM.Resource_Object.Metadata_File_ReaderWriters";
            OAI_File.Code_Class = "OAI_File_ReaderWriter";
            Add_Metadata_File_ReaderWriter(OAI_File);

            // Add the MODS section reader/writer
            METS_Section_ReaderWriter_Config MODS_Section = new METS_Section_ReaderWriter_Config();
            MODS_Section.ID = "MODS";
            MODS_Section.Label = "MODS";
            MODS_Section.Code_Assembly = String.Empty;
            MODS_Section.Code_Namespace = "SobekCM.Resource_Object.METS_Sec_ReaderWriters";
            MODS_Section.Code_Class = "MODS_METS_dmdSec_ReaderWriter";
            MODS_Section.isActive = true;
            MODS_Section.METS_Section = METS_Section_Type_Enum.dmdSec;
            MODS_Section.Add_Mapping(new METS_Section_ReaderWriter_Mapping("MODS", "MODS Metadata", true));
            MODS_Section.Add_Mapping(new METS_Section_ReaderWriter_Mapping("Metadata Object Description Standard", false ));
            Add_METS_Section_ReaderWriter(MODS_Section);

            // Add the dublin core section reader/writer
            METS_Section_ReaderWriter_Config DC_Section = new METS_Section_ReaderWriter_Config();
            DC_Section.ID = "DC";
            DC_Section.Label = "Dublin Core";
            DC_Section.Code_Assembly = String.Empty;
            DC_Section.Code_Namespace = "SobekCM.Resource_Object.METS_Sec_ReaderWriters";
            DC_Section.Code_Class = "DC_METS_dmdSec_ReaderWriter";
            DC_Section.isActive = true;
            DC_Section.METS_Section = METS_Section_Type_Enum.dmdSec;
            DC_Section.Add_Mapping(new METS_Section_ReaderWriter_Mapping("DC", "Dublin Core Metadata", true));
            DC_Section.Add_Mapping(new METS_Section_ReaderWriter_Mapping("DUBLIN CORE", false));
            Add_METS_Section_ReaderWriter(DC_Section);

            // Add the MarcXML section reader/writer
            METS_Section_ReaderWriter_Config MarcXML_Section = new METS_Section_ReaderWriter_Config();
            MarcXML_Section.ID = "MarcXML";
            MarcXML_Section.Label = "MarcXML";
            MarcXML_Section.Code_Assembly = String.Empty;
            MarcXML_Section.Code_Namespace = "SobekCM.Resource_Object.METS_Sec_ReaderWriters";
            MarcXML_Section.Code_Class = "MarcXML_METS_dmdSec_ReaderWriter";
            MarcXML_Section.isActive = true;
            MarcXML_Section.METS_Section = METS_Section_Type_Enum.dmdSec;
            MarcXML_Section.Add_Mapping(new METS_Section_ReaderWriter_Mapping("MARCXML", "MarcXML Metadata", true));
            Add_METS_Section_ReaderWriter(MarcXML_Section);

            // Add the DarwinCore section reader/writer
            METS_Section_ReaderWriter_Config Darwin_Section = new METS_Section_ReaderWriter_Config();
            Darwin_Section.ID = "DARWIN";
            Darwin_Section.Label = "DarwinCore";
            Darwin_Section.Code_Assembly = String.Empty;
            Darwin_Section.Code_Namespace = "SobekCM.Resource_Object.METS_Sec_ReaderWriters";
            Darwin_Section.Code_Class = "DarwinCore_METS_dmdSec_ReaderWriter";
            Darwin_Section.isActive = true;
            Darwin_Section.METS_Section = METS_Section_Type_Enum.dmdSec;
            Darwin_Section.Add_Mapping(new METS_Section_ReaderWriter_Mapping("OTHER", "DARWINCORE", "DarwinCore Zoological Taxonomic Information", true));
            Add_METS_Section_ReaderWriter(Darwin_Section);

            // Add the ETD section reader/writer
            METS_Section_ReaderWriter_Config ETD_Section = new METS_Section_ReaderWriter_Config();
            ETD_Section.ID = "ETD";
            ETD_Section.Label = "ETD";
            ETD_Section.Code_Assembly = String.Empty;
            ETD_Section.Code_Namespace = "SobekCM.Resource_Object.METS_Sec_ReaderWriters";
            ETD_Section.Code_Class = "ETD_METS_dmdSec_ReaderWriter";
            ETD_Section.isActive = true;
            ETD_Section.METS_Section = METS_Section_Type_Enum.dmdSec;
            ETD_Section.Add_Mapping(new METS_Section_ReaderWriter_Mapping("OTHER", "PALMM", "PALMM ETD Extension", true));
            ETD_Section.Add_Mapping(new METS_Section_ReaderWriter_Mapping("OTHER", "PALMM Extensions", "PALMM ETD Extension", false));
            Add_METS_Section_ReaderWriter(ETD_Section);

            // Add the SobekCM section reader/writer
            METS_Section_ReaderWriter_Config SobekCM_Section = new METS_Section_ReaderWriter_Config();
            SobekCM_Section.ID = "SOBEK1";
            SobekCM_Section.Label = "SobekCM";
            SobekCM_Section.Code_Assembly = String.Empty;
            SobekCM_Section.Code_Namespace = "SobekCM.Resource_Object.METS_Sec_ReaderWriters";
            SobekCM_Section.Code_Class = "SobekCM_METS_dmdSec_ReaderWriter";
            SobekCM_Section.isActive = true;
            SobekCM_Section.METS_Section = METS_Section_Type_Enum.dmdSec;
            SobekCM_Section.Add_Mapping(new METS_Section_ReaderWriter_Mapping("OTHER", "SOBEKCM", "SobekCM Custom Metadata", true));
            SobekCM_Section.Add_Mapping(new METS_Section_ReaderWriter_Mapping("OTHER", "UFDC", "SobekCM Custom Metadata", false));
            SobekCM_Section.Add_Mapping(new METS_Section_ReaderWriter_Mapping("OTHER", "DLOC", "SobekCM Custom Metadata", false));
            Add_METS_Section_ReaderWriter(SobekCM_Section);

            // Add the SobekCM Map section reader/writer
            METS_Section_ReaderWriter_Config SobekCM_Map_Section = new METS_Section_ReaderWriter_Config();
            SobekCM_Map_Section.ID = "SOBEK2";
            SobekCM_Map_Section.Label = "SobekCM Map";
            SobekCM_Map_Section.Code_Assembly = String.Empty;
            SobekCM_Map_Section.Code_Namespace = "SobekCM.Resource_Object.METS_Sec_ReaderWriters";
            SobekCM_Map_Section.Code_Class = "SobekCM_Map_METS_dmdSec_ReaderWriter";
            SobekCM_Map_Section.isActive = true;
            SobekCM_Map_Section.METS_Section = METS_Section_Type_Enum.dmdSec;
            SobekCM_Map_Section.Add_Mapping(new METS_Section_ReaderWriter_Mapping("OTHER", "SOBEK_MAP", "SobekCM Custom Map Authority Metadata", true));
            SobekCM_Map_Section.Add_Mapping(new METS_Section_ReaderWriter_Mapping("OTHER", "UFDC_MAP", "SobekCM Custom Map Authority Metadata", false));
            Add_METS_Section_ReaderWriter(SobekCM_Map_Section);

            // Add the DAITSS section reader/writer
            METS_Section_ReaderWriter_Config DAITSS_Section = new METS_Section_ReaderWriter_Config();
            DAITSS_Section.ID = "DAITSS";
            DAITSS_Section.Label = "DAITSS";
            DAITSS_Section.Code_Assembly = String.Empty;
            DAITSS_Section.Code_Namespace = "SobekCM.Resource_Object.METS_Sec_ReaderWriters";
            DAITSS_Section.Code_Class = "DAITSS_METS_amdSec_ReaderWriter";
            DAITSS_Section.isActive = true;
            DAITSS_Section.METS_Section = METS_Section_Type_Enum.amdSec;
            DAITSS_Section.amdSecType = METS_amdSec_Type_Enum.digiProvMD;
            DAITSS_Section.Add_Mapping(new METS_Section_ReaderWriter_Mapping("OTHER", "DAITSS", "DAITSS Archiving Information", true));
            Add_METS_Section_ReaderWriter(DAITSS_Section);

            // Add the RightsMD section reader/writer
            METS_Section_ReaderWriter_Config Rights_Section = new METS_Section_ReaderWriter_Config();
            Rights_Section.ID = "RIGHTS";
            Rights_Section.Label = "RightsMD";
            Rights_Section.Code_Assembly = String.Empty;
            Rights_Section.Code_Namespace = "SobekCM.Resource_Object.METS_Sec_ReaderWriters";
            Rights_Section.Code_Class = "RightsMD_METS_amdSec_ReaderWriter";
            Rights_Section.isActive = true;
            Rights_Section.METS_Section = METS_Section_Type_Enum.amdSec;
            Rights_Section.amdSecType = METS_amdSec_Type_Enum.rightsMD;
            Rights_Section.Add_Mapping(new METS_Section_ReaderWriter_Mapping("OTHER", "RIGHTSMD", "Rights Information", true));
            Add_METS_Section_ReaderWriter(Rights_Section);

            // Add the SobekCM fileinfo section reader/writer
            METS_Section_ReaderWriter_Config SobekCM_File_Section = new METS_Section_ReaderWriter_Config();
            SobekCM_File_Section.ID = "SOBEK3";
            SobekCM_File_Section.Label = "SobekCM FileInfo";
            SobekCM_File_Section.Code_Assembly = String.Empty;
            SobekCM_File_Section.Code_Namespace = "SobekCM.Resource_Object.METS_Sec_ReaderWriters";
            SobekCM_File_Section.Code_Class = "SobekCM_FileInfo_METS_amdSec_ReaderWriter";
            SobekCM_File_Section.isActive = true;
            SobekCM_File_Section.METS_Section = METS_Section_Type_Enum.amdSec;
            SobekCM_File_Section.amdSecType = METS_amdSec_Type_Enum.techMD;
            SobekCM_File_Section.Add_Mapping(new METS_Section_ReaderWriter_Mapping("OTHER", "SOBEKCM", "SobekCM File Technical Details", true));
            Add_METS_Section_ReaderWriter(SobekCM_File_Section);

            // Add the GML section reader/writer
            METS_Section_ReaderWriter_Config GML_Section = new METS_Section_ReaderWriter_Config();
            GML_Section.ID = "GML";
            GML_Section.Label = "GML Coordinate";
            GML_Section.Code_Assembly = String.Empty;
            GML_Section.Code_Namespace = "SobekCM.Resource_Object.METS_Sec_ReaderWriters";
            GML_Section.Code_Class = "GML_METS_dmdSec_ReaderWriter";
            GML_Section.isActive = true;
            GML_Section.METS_Section = METS_Section_Type_Enum.dmdSec;
            GML_Section.Add_Mapping(new METS_Section_ReaderWriter_Mapping("OTHER", "GML", "Geographic Markup Language", true));
            Add_METS_Section_ReaderWriter(GML_Section);

            // Add the IEEE-LOM section reader/writer
            METS_Section_ReaderWriter_Config LOM_Section = new METS_Section_ReaderWriter_Config();
            LOM_Section.ID = "IEEE-LOM";
            LOM_Section.Label = "IEEE-LOM: Learning Object Metadata";
            LOM_Section.Code_Assembly = String.Empty;
            LOM_Section.Code_Namespace = "SobekCM.Resource_Object.METS_Sec_ReaderWriters";
            LOM_Section.Code_Class = "LOM_IEEE_METS_dmdSec_ReaderWriter";
            LOM_Section.isActive = true;
            LOM_Section.METS_Section = METS_Section_Type_Enum.dmdSec;
            LOM_Section.Add_Mapping(new METS_Section_ReaderWriter_Mapping("OTHER", "IEEE-LOM", "Learning Object Metadata", true));
            Add_METS_Section_ReaderWriter(LOM_Section);

            // Add the VRACore section reader/writer
            METS_Section_ReaderWriter_Config VRA_Section = new METS_Section_ReaderWriter_Config();
            VRA_Section.ID = "VRACORE";
            VRA_Section.Label = "VRACore Visual Resource Metadata";
            VRA_Section.Code_Assembly = String.Empty;
            VRA_Section.Code_Namespace = "SobekCM.Resource_Object.METS_Sec_ReaderWriters";
            VRA_Section.Code_Class = "VRACore_METS_dmdSec_ReaderWriter";
            VRA_Section.isActive = true;
            VRA_Section.METS_Section = METS_Section_Type_Enum.dmdSec;
            VRA_Section.Add_Mapping(new METS_Section_ReaderWriter_Mapping("OTHER", "VRACore", "VRACore Visual Resource Metadata", true));
            Add_METS_Section_ReaderWriter(VRA_Section);

            // Add the default METS writig profile
            METS_Writing_Profile defaultProfile = new METS_Writing_Profile();
            defaultProfile.Default_Profile = true;
            defaultProfile.Profile_Name = "Complete MODS Writer";
            defaultProfile.Profile_Description = "This profile includes almost all of the possible sub-writers but the main bibliographic data is stored in MODS";
            defaultProfile.Add_Package_Level_DmdSec_Writer_Config(MODS_Section);
            defaultProfile.Add_Package_Level_DmdSec_Writer_Config(SobekCM_Section);
            defaultProfile.Add_Package_Level_DmdSec_Writer_Config(SobekCM_Map_Section);
            defaultProfile.Add_Package_Level_DmdSec_Writer_Config(Darwin_Section);
            defaultProfile.Add_Package_Level_DmdSec_Writer_Config(ETD_Section);
            defaultProfile.Add_Package_Level_DmdSec_Writer_Config(GML_Section);
            defaultProfile.Add_Package_Level_DmdSec_Writer_Config(LOM_Section);
            defaultProfile.Add_Package_Level_DmdSec_Writer_Config(VRA_Section);
            defaultProfile.Add_Package_Level_AmdSec_Writer_Config(DAITSS_Section);
            defaultProfile.Add_Package_Level_AmdSec_Writer_Config(Rights_Section);
            defaultProfile.Add_Package_Level_AmdSec_Writer_Config(SobekCM_File_Section);
             //   defaultProfile.Add_Division_Level_DmdSec_Writer_Config(MODS_Section);
            defaultProfile.Add_Division_Level_DmdSec_Writer_Config(GML_Section);
            Add_METS_Writing_Profile(defaultProfile);

            // Add the default METS writig profile
            METS_Writing_Profile dcProfile = new METS_Writing_Profile();
            dcProfile.Default_Profile = false;
            dcProfile.Profile_Name = "Simple Dublin Core Writer";
            dcProfile.Profile_Description = "This is a simplified profile which uses Dublin Core to describe all levels of the METS";
            dcProfile.Add_Package_Level_DmdSec_Writer_Config(DC_Section);
            dcProfile.Add_Package_Level_AmdSec_Writer_Config(DAITSS_Section);
            dcProfile.Add_Package_Level_AmdSec_Writer_Config(Rights_Section);
            dcProfile.Add_Package_Level_AmdSec_Writer_Config(SobekCM_File_Section);
            dcProfile.Add_Division_Level_DmdSec_Writer_Config(DC_Section);
            dcProfile.Add_File_Level_DmdSec_Writer_Config(DC_Section);
            Add_METS_Writing_Profile(dcProfile);
        }
 /// <summary> Adds a new METS writing profile to this metadata configuration </summary>
 /// <param name="NewProfile"> New metadata profile to add </param>
 public static void Add_METS_Writing_Profile( METS_Writing_Profile NewProfile )
 {
     metsWritingProfiles[NewProfile.Profile_Name] = NewProfile;
     if (NewProfile.Default_Profile)
         defaultWritingProfile = NewProfile;
 }
        private static void read_mets_writing_config(XmlReader readerXml, Dictionary<string, METS_Section_ReaderWriter_Config> readerWriters)
        {
            bool inPackage = false;
            bool inDivision = false;
            bool inFile = false;
            bool inDmdSec = true;
            METS_Writing_Profile profile = null;
            int unnamed_profile_counter = 1;

            while (readerXml.Read())
            {
                if (readerXml.NodeType == XmlNodeType.Element)
                {
                    switch (readerXml.Name.ToLower())
                    {
                        case "profile":
                            profile = new METS_Writing_Profile();
                            if (readerXml.MoveToAttribute("name"))
                                profile.Profile_Name = readerXml.Value.Trim();
                            if (readerXml.MoveToAttribute("description"))
                                profile.Profile_Description = readerXml.Value;
                            if (readerXml.MoveToAttribute("isDefault"))
                            {
                                bool tempValue;
                                if (bool.TryParse(readerXml.Value, out tempValue))
                                {
                                    profile.Default_Profile = tempValue;
                                }
                            }
                            // Enforce a name for this profile (should have one according to XSD)
                            if (profile.Profile_Name.Length == 0)
                            {
                                profile.Profile_Name = "Unnamed" + unnamed_profile_counter;
                                unnamed_profile_counter++;
                            }
                            Add_METS_Writing_Profile(profile);
                            break;

                        case "package_scope":
                            inPackage = true;
                            inDivision = false;
                            inFile = false;
                            break;

                        case "division_scope":
                            inPackage = false;
                            inDivision = true;
                            inFile = false;
                            break;

                        case "file_scope":
                            inPackage = false;
                            inDivision = false;
                            inFile = true;
                            break;

                        case "dmdsec":
                            inDmdSec = true;
                            break;

                        case "amdsec":
                            inDmdSec = false;
                            break;

                        case "readerwriterref":
                            if (readerXml.MoveToAttribute("ID"))
                            {
                                string id = readerXml.Value.ToUpper();
                                if (( readerWriters.ContainsKey(id)) && ( profile != null ))
                                {
                                    METS_Section_ReaderWriter_Config readerWriter = readerWriters[id];
                                    if (inPackage)
                                    {
                                        if (inDmdSec)
                                            profile.Add_Package_Level_DmdSec_Writer_Config(readerWriter);
                                        else
                                            profile.Add_Package_Level_AmdSec_Writer_Config(readerWriter);
                                    }
                                    else if ( inDivision )
                                    {
                                        if (inDmdSec)
                                            profile.Add_Division_Level_DmdSec_Writer_Config(readerWriter);
                                        else
                                            profile.Add_Division_Level_AmdSec_Writer_Config(readerWriter);
                                    }
                                    else if (inFile)
                                    {
                                        if (inDmdSec)
                                            profile.Add_File_Level_DmdSec_Writer_Config(readerWriter);
                                        else
                                            profile.Add_File_Level_AmdSec_Writer_Config(readerWriter);
                                    }
                                }
                            }
                            break;
                    }
                }
            }
        }
 /// <summary> Clear all the METS writing profiles from this configuration </summary>
 public static void Clear_METS_Writing_Profiles()
 {
     metsWritingProfiles.Clear();
     defaultWritingProfile = null;
 }