From 7a47f00a7ff3f95ef4013bf453340b94c8535e07 Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Thu, 6 Apr 2023 22:32:14 +0200 Subject: Remove xmlns:xs namespace from subtitle XML (DoM #2498). --- src/subtitle_asset.cc | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'src/subtitle_asset.cc') 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 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> const& namespaces) +SubtitleAsset::format_xml(xmlpp::Document const& document, optional> xml_namespace) { auto root = document.get_root_node(); State state = {}; state.xml = "\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); } } -- cgit v1.2.3