diff options
author | Miklos Vajna <vmiklos@collabora.co.uk> | 2014-08-19 14:26:28 +0200 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.co.uk> | 2014-08-19 18:19:03 +0200 |
commit | 1c06dc14a1f4cf6bf6121aa9a7b62e8890256161 (patch) | |
tree | 0c85af2ef21abbc1c8da639fffc8da08daef9916 | |
parent | 69d673b1ae8731c088aab7a9e67f5861e056f8f2 (diff) |
writerfilter: stop reading namespace-alias elements in factoryimpl
Change-Id: I52c2298c9583617481069040e118520cf8935c6d
-rw-r--r-- | writerfilter/CustomTarget_source.mk | 4 | ||||
-rw-r--r-- | writerfilter/source/ooxml/factoryimpl.py | 23 |
2 files changed, 18 insertions, 9 deletions
diff --git a/writerfilter/CustomTarget_source.mk b/writerfilter/CustomTarget_source.mk index b3bc00cc648e..2061780322f1 100644 --- a/writerfilter/CustomTarget_source.mk +++ b/writerfilter/CustomTarget_source.mk @@ -69,9 +69,9 @@ writerfilter_SRC_ooxml_Preprocess_py=$(writerfilter_SRC)/ooxml/modelpreprocess.p writerfilter_SRC_ooxml_QNameToStr_py=$(writerfilter_SRC)/ooxml/qnametostr.py writerfilter_SRC_ooxml_ResourceIds_py=$(writerfilter_SRC)/ooxml/resourceids.py -$(writerfilter_GEN_ooxml_Factory_cxx) : $(writerfilter_SRC)/ooxml/factoryimpl.py $(writerfilter_GEN_ooxml_Model_processed) +$(writerfilter_GEN_ooxml_Factory_cxx) : $(writerfilter_SRC)/ooxml/factoryimpl.py $(writerfilter_DEP_ooxml_Namespaces_txt) $(writerfilter_GEN_ooxml_Model_processed) $(call gb_Output_announce,$(subst $(WORKDIR)/,,$@),build,PY ,1) - $(call gb_Helper_abbreviate_dirs, $(writerfilter_PYTHONCOMMAND) $< $(writerfilter_GEN_ooxml_Model_processed)) > $@ + $(call gb_Helper_abbreviate_dirs, $(writerfilter_PYTHONCOMMAND) $< $(writerfilter_DEP_ooxml_Namespaces_txt) $(writerfilter_GEN_ooxml_Model_processed)) > $@ $(writerfilter_GEN_ooxml_Factory_hxx) : $(writerfilter_SRC)/ooxml/factoryinc.py $(writerfilter_GEN_ooxml_Model_processed) $(call gb_Output_announce,$(subst $(WORKDIR)/,,$@),build,PY ,1) diff --git a/writerfilter/source/ooxml/factoryimpl.py b/writerfilter/source/ooxml/factoryimpl.py index a2af9c8e13b1..475620e0f28d 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 sorted([a.getAttribute("alias") for a in model.getElementsByTagName("namespace-alias")]): + for alias in sorted(ooxUrlAliases.values()): if not alias in aliases: aliases.append(alias) print(""" case oox::NMSP_%s: @@ -160,11 +160,8 @@ def getFastParser(model): { mxFastParser = css::xml::sax::FastParser::create(mxContext); """) - aliases = {} - for alias in model.getElementsByTagName("namespace-alias"): - aliases[alias.getAttribute("name")] = alias.getAttribute("alias") - for name in sorted(aliases.keys()): - print(""" mxFastParser->registerNamespace("%s", oox::NMSP_%s);""" % (name, aliases[name])) + for url in sorted(ooxUrlAliases.keys()): + print(""" mxFastParser->registerNamespace("%s", oox::NMSP_%s);""" % (url, ooxUrlAliases[url])) print(""" } return mxFastParser; @@ -200,7 +197,19 @@ using namespace com::sun::star; getFastParser(model) -modelPath = sys.argv[1] +def parseNamespaces(fro): + sock = open(fro) + for i in sock.readlines(): + line = i.strip() + id, alias, url = line.split(' ') + ooxUrlAliases[url] = alias + sock.close() + + +namespacesPath = sys.argv[1] +ooxUrlAliases = {} +parseNamespaces(namespacesPath) +modelPath = sys.argv[2] model = minidom.parse(modelPath) createImpl(model) |