/// <summary> Validates this METS file against the XML Schema </summary> /// <param name="thisPackage">Package to validate</param> /// <returns>TRUE if succesful, otherwise FALSE </returns> public static bool Validate_Against_Schema(SobekCM_Item thisPackage) { // Build the METS validator object METS_Validator_Object validator = new METS_Validator_Object(false); // Get the METS file string[] files_xml = Directory.GetFiles(thisPackage.Source_Directory, "*.METS_Header.xml"); string[] files = Directory.GetFiles(thisPackage.Source_Directory, "*.mets"); // Check if there is one if ((files.Length <= 0) && (files_xml.Length <= 0)) { return false; } return validator.Validate_Against_Schema(files.Length > 0 ? files[0] : files_xml[0]); }
/// <summary> Validates this METS file against the XML Schema </summary> /// <returns>TRUE if succesful, otherwise FALSE </returns> /// <remarks> This sets the Validation_Errors property of this object </remarks> public bool Validate_Against_Schema() { // Build the METS validator object METS_Validator_Object validator = new METS_Validator_Object(false); // Get the METS file string[] files_xml = Directory.GetFiles(Source_Directory, "*.METS_Header.xml"); string[] files = Directory.GetFiles(Source_Directory, "*.mets"); // Check if there is one if ((files.Length > 0) || (files_xml.Length > 0)) { bool returnVal = validator.Validate_Against_Schema(files.Length > 0 ? files[0] : files_xml[0]); validationErrors = validator.Errors; return returnVal; } validationErrors = "METS File Does Not Exist"; return false; }