diff options
| author | Carl Hetherington <cth@carlh.net> | 2023-04-06 22:32:14 +0200 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2023-04-19 12:59:37 +0200 |
| commit | 7a47f00a7ff3f95ef4013bf453340b94c8535e07 (patch) | |
| tree | 134b34a64892e470c66cc599435f28e6b8190a23 /src | |
| parent | c6387f885fd39e901189b6c73fca0a28cc9ec85b (diff) | |
Remove xmlns:xs namespace from subtitle XML (DoM #2498).
Diffstat (limited to 'src')
| -rw-r--r-- | src/smpte_subtitle_asset.cc | 2 | ||||
| -rw-r--r-- | src/subtitle_asset.cc | 14 | ||||
| -rw-r--r-- | src/subtitle_asset.h | 2 |
3 files changed, 9 insertions, 9 deletions
diff --git a/src/smpte_subtitle_asset.cc b/src/smpte_subtitle_asset.cc index 6db90b2e..3a58ba8e 100644 --- a/src/smpte_subtitle_asset.cc +++ b/src/smpte_subtitle_asset.cc @@ -381,7 +381,7 @@ SMPTESubtitleAsset::xml_as_string () const subtitles_as_xml (root->add_child("SubtitleList"), _time_code_rate, Standard::SMPTE); - return format_xml(doc, { {"", schema_namespace()}, {"xs", "http://www.w3.org/2001/XMLSchema"} }); + return format_xml(doc, std::make_pair(string{}, schema_namespace())); } diff --git a/src/subtitle_asset.cc b/src/subtitle_asset.cc index 4baa7b06..d6103a1d 100644 --- a/src/subtitle_asset.cc +++ b/src/subtitle_asset.cc @@ -893,23 +893,23 @@ format_xml_node (xmlpp::Node const* node, State& state) * to <Text> nodes. This is an attempt to avoid changing what is actually displayed as subtitles * while also formatting the XML in such a way as to avoid DoM bug 2205. * - * namespace is a list of namespaces for the root node; it would be nicer to set these up with - * set_namespace_declaration in the caller and then to extract them here but I couldn't find a way + * xml_namespace is an optional namespace for the root node; it would be nicer to set this up with + * set_namespace_declaration in the caller and then to extract it here but I couldn't find a way * to get all namespaces with the libxml++ API. */ string -SubtitleAsset::format_xml (xmlpp::Document const& document, vector<pair<string, string>> const& namespaces) +SubtitleAsset::format_xml(xmlpp::Document const& document, optional<pair<string, string>> xml_namespace) { auto root = document.get_root_node(); State state = {}; state.xml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<" + root->get_name(); - for (auto const& ns: namespaces) { - if (ns.first.empty()) { - state.xml += String::compose(" xmlns=\"%1\"", ns.second); + if (xml_namespace) { + if (xml_namespace->first.empty()) { + state.xml += String::compose(" xmlns=\"%1\"", xml_namespace->second); } else { - state.xml += String::compose(" xmlns:%1=\"%2\"", ns.first, ns.second); + state.xml += String::compose(" xmlns:%1=\"%2\"", xml_namespace->first, xml_namespace->second); } } diff --git a/src/subtitle_asset.h b/src/subtitle_asset.h index 012050b1..28db9574 100644 --- a/src/subtitle_asset.h +++ b/src/subtitle_asset.h @@ -135,7 +135,7 @@ public: virtual SubtitleStandard subtitle_standard() const = 0; - static std::string format_xml (xmlpp::Document const& document, std::vector<std::pair<std::string, std::string>> const& namespaces); + static std::string format_xml(xmlpp::Document const& document, boost::optional<std::pair<std::string, std::string>> xml_namespace); protected: friend struct ::interop_dcp_font_test; |
