diff options
author | Miklos Vajna <vmiklos@collabora.co.uk> | 2014-08-18 21:36:46 +0200 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.co.uk> | 2014-08-18 22:17:37 +0200 |
commit | a3a5d4fcdc66e20e0aa1addb12cbd5e0f133012e (patch) | |
tree | 7147f29bea587b4dbbe117ee3eca66484a2f0ccf | |
parent | 6ef56dacbab92fac1e2fb79492cbd8b2dd6d92ed (diff) |
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
-rw-r--r-- | writerfilter/source/ooxml/factoryimpl.py | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/writerfilter/source/ooxml/factoryimpl.py b/writerfilter/source/ooxml/factoryimpl.py index 33c7623dd665..a2af9c8e13b1 100644 --- a/writerfilter/source/ooxml/factoryimpl.py +++ b/writerfilter/source/ooxml/factoryimpl.py @@ -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; |