summaryrefslogtreecommitdiffstats
path: root/Lib/xmllib.py
diff options
context:
space:
mode:
authorMartin v. Löwis <martin@v.loewis.de>2004-05-02 20:37:13 (GMT)
committerMartin v. Löwis <martin@v.loewis.de>2004-05-02 20:37:13 (GMT)
commit9f1340b9f231f920fcf70ce2f8ea0c0e3a322dd9 (patch)
treeceaa9e3720453edc03e9a8414b304e3f0ef7b6b7 /Lib/xmllib.py
parentd7911a33173fa4a51428b90e42dc1a0cff2cf5f4 (diff)
downloadcpython-9f1340b9f231f920fcf70ce2f8ea0c0e3a322dd9.zip
cpython-9f1340b9f231f920fcf70ce2f8ea0c0e3a322dd9.tar.gz
cpython-9f1340b9f231f920fcf70ce2f8ea0c0e3a322dd9.tar.bz2
Do not use the default namespace for attributes.
Fixes http://bugs.debian.org/229885 Will backport to 2.3.
Diffstat (limited to 'Lib/xmllib.py')
-rw-r--r--Lib/xmllib.py28
1 files changed, 12 insertions, 16 deletions
diff --git a/Lib/xmllib.py b/Lib/xmllib.py
index f1cd2e4..2a189cd 100644
--- a/Lib/xmllib.py
+++ b/Lib/xmllib.py
@@ -6,8 +6,7 @@ import re
import string
import warnings
-warnings.warn("The xmllib module is obsolete. Use xml.sax instead.",
- DeprecationWarning)
+warnings.warn("The xmllib module is obsolete. Use xml.sax instead.", DeprecationWarning)
del warnings
version = '0.3'
@@ -641,20 +640,17 @@ class XMLParser:
aprefix, key = res.group('prefix', 'local')
if self.__map_case:
key = key.lower()
- if aprefix is None:
- aprefix = ''
- ans = None
- for t, d, nst in self.stack:
- if aprefix in d:
- ans = d[aprefix]
- if ans is None and aprefix != '':
- ans = self.__namespaces.get(aprefix)
- if ans is not None:
- key = ans + ' ' + key
- elif aprefix != '':
- key = aprefix + ':' + key
- elif ns is not None:
- key = ns + ' ' + key
+ if aprefix is not None:
+ ans = None
+ for t, d, nst in self.stack:
+ if aprefix in d:
+ ans = d[aprefix]
+ if ans is None:
+ ans = self.__namespaces.get(aprefix)
+ if ans is not None:
+ key = ans + ' ' + key
+ else:
+ key = aprefix + ':' + key
nattrdict[key] = val
attrnamemap[key] = okey
attrdict = nattrdict