summaryrefslogtreecommitdiff
path: root/src/verify.cc
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2019-12-09 00:44:07 +0100
committerCarl Hetherington <cth@carlh.net>2019-12-22 01:21:00 +0100
commit66bd89f87412736ba2488f5b3ca4aec9dea8ef94 (patch)
tree05e961c0b4ca0f90f376e63f5adf6d8b03a1985b /src/verify.cc
parent84d01dde2fb2520572d122d53e1ffebefed48157 (diff)
Check ASSETMAP; add a PKL test; tidy up calls to validate_xml().
Diffstat (limited to 'src/verify.cc')
-rw-r--r--src/verify.cc49
1 files changed, 20 insertions, 29 deletions
diff --git a/src/verify.cc b/src/verify.cc
index 9a2b0f70..cb2b1287 100644
--- a/src/verify.cc
+++ b/src/verify.cc
@@ -229,8 +229,8 @@ private:
};
static
-list<XMLValidationError>
-validate_xml (boost::filesystem::path xml_file, boost::filesystem::path xsd_dtd_directory)
+void
+validate_xml (boost::filesystem::path xml_file, boost::filesystem::path xsd_dtd_directory, list<VerificationNote>& notes)
{
try {
XMLPlatformUtils::Initialize ();
@@ -252,6 +252,7 @@ validate_xml (boost::filesystem::path xml_file, boost::filesystem::path xsd_dtd_
schema["http://www.w3.org/TR/2002/REC-xmldsig-core-20020212/xmldsig-core-schema.xsd"] = "xmldsig-core-schema.xsd";
schema["http://www.smpte-ra.org/schemas/429-7/2006/CPL"] = "SMPTE-429-7-2006-CPL.xsd";
schema["http://www.smpte-ra.org/schemas/429-8/2006/PKL"] = "SMPTE-429-8-2006-PKL.xsd";
+ schema["http://www.smpte-ra.org/schemas/429-9/2007/AM"] = "SMPTE-429-9-2007-AM.xsd";
schema["http://www.w3.org/2001/03/xml.xsd"] = "xml.xsd";
string locations;
@@ -283,7 +284,17 @@ validate_xml (boost::filesystem::path xml_file, boost::filesystem::path xsd_dtd_
XMLPlatformUtils::Terminate ();
- return error_handler.errors ();
+ BOOST_FOREACH (XMLValidationError i, error_handler.errors()) {
+ notes.push_back (
+ VerificationNote(
+ VerificationNote::VERIFY_ERROR,
+ VerificationNote::Code::XML_VALIDATION_ERROR,
+ i.message(),
+ xml_file,
+ i.line()
+ )
+ );
+ }
}
static Result
@@ -349,19 +360,7 @@ dcp::verify (
BOOST_FOREACH (shared_ptr<CPL> cpl, dcp->cpls()) {
stage ("Checking CPL", cpl->file());
-
- list<XMLValidationError> errors = validate_xml (cpl->file().get(), xsd_dtd_directory);
- BOOST_FOREACH (XMLValidationError i, errors) {
- notes.push_back (
- VerificationNote(
- VerificationNote::VERIFY_ERROR,
- VerificationNote::Code::XML_VALIDATION_ERROR,
- i.message(),
- cpl->file().get(),
- i.line()
- )
- );
- }
+ validate_xml (cpl->file().get(), xsd_dtd_directory, notes);
/* Check that the CPL's hash corresponds to the PKL */
BOOST_FOREACH (shared_ptr<PKL> i, dcp->pkls()) {
@@ -437,20 +436,12 @@ dcp::verify (
BOOST_FOREACH (shared_ptr<PKL> pkl, dcp->pkls()) {
stage ("Checking PKL", pkl->file());
-
- list<XMLValidationError> errors = validate_xml (pkl->file().get(), xsd_dtd_directory);
- BOOST_FOREACH (XMLValidationError i, errors) {
- notes.push_back (
- VerificationNote(
- VerificationNote::VERIFY_ERROR,
- VerificationNote::Code::XML_VALIDATION_ERROR,
- i.message(),
- pkl->file().get(),
- i.line()
- )
- );
- }
+ validate_xml (pkl->file().get(), xsd_dtd_directory, notes);
}
+
+ stage ("Checking ASSETMAP", dcp->asset_map_path().get());
+ validate_xml (dcp->asset_map_path().get(), xsd_dtd_directory, notes);
+
}
return notes;