private void read_qc_profiles(XmlReader ReaderXml)
{
int unnamed_profile_counter = 1;
while (ReaderXml.Read())
{
if (ReaderXml.NodeType == XmlNodeType.Element)
{
switch (ReaderXml.Name.ToLower())
{
case "profile":
QualityControl_Profile profile = new QualityControl_Profile();
XmlReader child_readerXml = ReaderXml.ReadSubtree();
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++;
}
while (child_readerXml.Read())
{
if (child_readerXml.NodeType == XmlNodeType.Element && child_readerXml.Name.ToLower() == "divisiontype")
// while (readerXml.ReadToNextSibling("DivisionType"))
{
if (child_readerXml.Name.ToLower() == "divisiontype")
{
QualityControl_Division_Config thisConfig = new QualityControl_Division_Config();
if (child_readerXml.MoveToAttribute("type"))
{
thisConfig.TypeName = child_readerXml.Value;
}
if (child_readerXml.MoveToAttribute("isNameable"))
thisConfig.isNameable = Convert.ToBoolean(child_readerXml.Value);
profile.Add_Division_Type(thisConfig);
}
}
}
Add_Profile(profile);
// Add_METS_Writing_Profile(profile);
break;
case "package_scope":
break;
case "division_scope":
break;
case "file_scope":
break;
case "dmdsec":
break;
case "amdsec":
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;
}
}
}
}