/// <summary> Add a new mapping from the METS file MDTYPE and OTHERMDTYPE attributes
 /// which this METS Section Reader/Writer supports </summary>
 /// <param name="New_Mapping"> New mapping </param>
 public void Add_Mapping(METS_Section_ReaderWriter_Mapping New_Mapping)
 {
     mappings.Add(New_Mapping);
     if (New_Mapping.isDefault)
     {
         defaultMapping = New_Mapping;
     }
 }
 /// <summary> Add a new mapping from the METS file MDTYPE and OTHERMDTYPE attributes 
 /// which this METS Section Reader/Writer supports </summary>
 /// <param name="New_Mapping"> New mapping </param>
 public void Add_Mapping(METS_Section_ReaderWriter_Mapping New_Mapping)
 {
     mappings.Add(New_Mapping);
     if (New_Mapping.isDefault)
         defaultMapping = New_Mapping;
 }
        private static METS_Section_ReaderWriter_Config read_mets_section_readerwriter_config(XmlReader readerXml)
        {
            METS_Section_ReaderWriter_Config returnValue = new METS_Section_ReaderWriter_Config();

            readerXml.Read();

            // Move to and save the basic attributes
            if (readerXml.MoveToAttribute("ID"))
                returnValue.ID = readerXml.Value;
            if (readerXml.MoveToAttribute("label"))
                returnValue.Label = readerXml.Value;
            if (readerXml.MoveToAttribute("namespace"))
                returnValue.Code_Namespace = readerXml.Value;
            if (readerXml.MoveToAttribute("class"))
                returnValue.Code_Class = readerXml.Value;
            if (readerXml.MoveToAttribute("assembly"))
                returnValue.Code_Assembly = readerXml.Value;
            if ((readerXml.MoveToAttribute("isActive")) && (readerXml.Value.ToLower() == "false"))
            {
                returnValue.isActive = false;
            }
            if (readerXml.MoveToAttribute("section"))
            {
                switch (readerXml.Value.ToLower())
                {
                    case "amdsec":
                        returnValue.METS_Section = METS_Section_Type_Enum.amdSec;
                        if (readerXml.MoveToAttribute("amdSecType"))
                        {
                            switch( readerXml.Value.ToLower())
                            {
                                case "techmd":
                                    returnValue.amdSecType = METS_amdSec_Type_Enum.techMD;
                                    break;

                                case "rightsmd":
                                    returnValue.amdSecType = METS_amdSec_Type_Enum.rightsMD;
                                    break;

                                case "digiprovmd":
                                    returnValue.amdSecType = METS_amdSec_Type_Enum.digiProvMD;
                                    break;

                                case "sourcemd":
                                    returnValue.amdSecType = METS_amdSec_Type_Enum.sourceMD;
                                    break;

                            }
                        }
                        break;

                    case "dmdsec":
                        returnValue.METS_Section = METS_Section_Type_Enum.dmdSec;
                        break;
                }
            }

            while (readerXml.Read())
            {
                if (readerXml.NodeType == XmlNodeType.Element)
                {
                    switch (readerXml.Name.ToLower())
                    {
                        case "mapping":
                            METS_Section_ReaderWriter_Mapping newMapping = new METS_Section_ReaderWriter_Mapping();
                            if (readerXml.MoveToAttribute("mdtype"))
                                newMapping.MD_Type = readerXml.Value;
                            if (readerXml.MoveToAttribute("othermdtype"))
                                newMapping.Other_MD_Type = readerXml.Value;
                            if (readerXml.MoveToAttribute("label"))
                                newMapping.Label = readerXml.Value;
                            if ((readerXml.MoveToAttribute("isDefault")) && (readerXml.Value.ToLower() == "true"))
                                newMapping.isDefault = true;
                            returnValue.Add_Mapping(newMapping);
                            break;

                        case "option":
                            string key = String.Empty;
                            string value = String.Empty;
                            if (readerXml.MoveToAttribute("key"))
                                key = readerXml.Value;
                            if (readerXml.MoveToAttribute("value"))
                                value = readerXml.Value;
                            if ((key.Length > 0) && (value.Length > 0))
                                returnValue.Add_Option(key, value);
                            break;
                    }
                }
            }

            return returnValue;
        }