[Libreoffice-commits] core.git: writerfilter/source
Miklos Vajna
vmiklos at collabora.co.uk
Fri Aug 29 14:30:01 PDT 2014
writerfilter/source/ooxml/modelpreprocess.py | 26 +-------------------------
1 file changed, 1 insertion(+), 25 deletions(-)
New commits:
commit 0da23c09222caecdf5944c1f2da17dddeb10f1c5
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date: Fri Aug 29 23:22:23 2014 +0200
Remove unused prefix attribute of namespace elements
Change-Id: I6fd33f9050eb3f7394315bbd0c617513767adce6
diff --git a/writerfilter/source/ooxml/modelpreprocess.py b/writerfilter/source/ooxml/modelpreprocess.py
index 1273b12..11112f5 100644
--- a/writerfilter/source/ooxml/modelpreprocess.py
+++ b/writerfilter/source/ooxml/modelpreprocess.py
@@ -23,7 +23,7 @@ def prefixFromUrl(url):
def prefixForGrammar(namespace):
- ns = nsForGrammar(namespace)
+ ns = namespace.getElementsByTagName("grammar")[0].getAttribute("ns")
if ns in list(ooxUrlAliases.keys()):
prefix = ooxUrlAliases[ns]
return prefix
@@ -31,10 +31,6 @@ def prefixForGrammar(namespace):
return prefixFromUrl(ns)
-def nsForGrammar(namespace):
- return namespace.getElementsByTagName("grammar")[0].getAttribute("ns")
-
-
def parseNamespaceAliases(node, ret):
for k, v in list(node.attributes.items()):
if k.startswith("xmlns:"):
@@ -70,14 +66,7 @@ def check(model):
def preprocess(model):
for i in model.getElementsByTagName("namespace"):
- ns = i.getElementsByTagName("grammar")[0].getAttribute("ns")
- if ns.startswith("http://schemas.openxmlformats.org/"):
- i.setAttribute("prefix", ns.replace('http://schemas.openxmlformats.org/', '').replace('/', '_').replace('-', '_'))
- else:
- i.setAttribute("prefix", "")
-
grammarprefix = prefixForGrammar(i)
- grammarns = nsForGrammar(i)
grammarNamespaceAliases = defaultNamespaceAliases()
grammar = i.getElementsByTagName("grammar")[0]
@@ -110,19 +99,6 @@ def preprocess(model):
else:
prefix = grammarprefix
- # ns
- ns = ""
- if ":" in j.getAttribute("name"):
- nameprefix = j.getAttribute("name").split(':')[0]
- if nameprefix in list(localNamespaceAliases.keys()):
- ns = localNamespaceAliases[nameprefix]
- elif j.localName == "attribute":
- # if parent node is resource, then we're outside the grammar element
- if grammar.getAttribute("attributeFormDefault") == "qualified" and not j.parentNode.localName == "resource":
- ns = grammarns
- else:
- ns = grammarns
-
# localname
if ":" in j.getAttribute("name"):
localname = j.getAttribute("name").split(':')[1]
More information about the Libreoffice-commits
mailing list