Kaydet (Commit) a3a5d4fc authored tarafından Miklos Vajna's avatar Miklos Vajna

writerfilter: sort namespaces in OOXMLStreamImpl::getFastParser()

The motivation is that <namespace-alias> elements in model.xml are
redundant, as the same info is available from oox as well. But without
sorting, it's impossible to generate the same output, as the (not
interesting) order isn't the same there.

Change-Id: I634c62e43d1b54100bfa623c6f43dddd34279fb1
üst 6ef56dac
......@@ -126,7 +126,7 @@ std::string fastTokenToId(sal_uInt32 nToken)
{""")
aliases = []
for alias in [a.getAttribute("alias") for a in model.getElementsByTagName("namespace-alias")]:
for alias in sorted([a.getAttribute("alias") for a in model.getElementsByTagName("namespace-alias")]):
if not alias in aliases:
aliases.append(alias)
print(""" case oox::NMSP_%s:
......@@ -160,8 +160,11 @@ def getFastParser(model):
{
mxFastParser = css::xml::sax::FastParser::create(mxContext);
""")
aliases = {}
for alias in model.getElementsByTagName("namespace-alias"):
print(""" mxFastParser->registerNamespace("%s", oox::NMSP_%s);""" % (alias.getAttribute("name"), alias.getAttribute("alias")))
aliases[alias.getAttribute("name")] = alias.getAttribute("alias")
for name in sorted(aliases.keys()):
print(""" mxFastParser->registerNamespace("%s", oox::NMSP_%s);""" % (name, aliases[name]))
print(""" }
return mxFastParser;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment