[Libreoffice-commits] core.git: writerfilter/source
Miklos Vajna
vmiklos at collabora.co.uk
Mon Aug 18 13:18:00 PDT 2014
writerfilter/source/ooxml/factoryimpl.py | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
New commits:
commit a3a5d4fcdc66e20e0aa1addb12cbd5e0f133012e
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date: Mon Aug 18 21:36:46 2014 +0200
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
diff --git a/writerfilter/source/ooxml/factoryimpl.py b/writerfilter/source/ooxml/factoryimpl.py
index 33c7623..a2af9c8e1 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;
More information about the Libreoffice-commits
mailing list