}
auto eml = node->optional_node_child ("ExtensionMetadataList");
- if (eml) {
+
+ auto extension_metadata = [eml](string scope, string name, string property) -> boost::optional<std::string> {
+ if (!eml) {
+ return {};
+ }
+
for (auto i: eml->node_children("ExtensionMetadata")) {
- auto name = i->optional_string_child("Name");
- if (name && *name == "Sign Language Video") {
+ auto xml_scope = i->optional_string_attribute("scope");
+ auto xml_name = i->optional_string_child("Name");
+ if (xml_scope && *xml_scope == scope && xml_name && *xml_name == name) {
auto property_list = i->node_child("PropertyList");
for (auto j: property_list->node_children("Property")) {
- auto name = j->optional_string_child("Name");
- auto value = j->optional_string_child("Value");
- if (name && value && *name == "Language Tag") {
- _sign_language_video_language = *value;
+ auto property_name = j->optional_string_child("Name");
+ auto property_value = j->optional_string_child("Value");
+ if (property_name && property_value && *property_name == property) {
+ return property_value;
}
}
}
}
- }
+
+ return {};
+ };
+
+ _sign_language_video_language = extension_metadata("http://isdcf.com/2017/10/SignLanguageVideo", "Sign Language Video", "Language Tag");
}