summaryrefslogtreecommitdiffstats
path: root/Lib/xmllib.py
diff options
context:
space:
mode:
authorSjoerd Mullender <sjoerd@acm.org>2000-08-31 10:27:00 (GMT)
committerSjoerd Mullender <sjoerd@acm.org>2000-08-31 10:27:00 (GMT)
commit1c8feae411a8afda43e903e5c202ea0e1dbcacbf (patch)
treec43d84416826d8c08bb56f6291ad0f4992a9ccde /Lib/xmllib.py
parentf730fc3e4e4cfe6a5e81ea4c4ff59a7d7c9daab2 (diff)
downloadcpython-1c8feae411a8afda43e903e5c202ea0e1dbcacbf.zip
cpython-1c8feae411a8afda43e903e5c202ea0e1dbcacbf.tar.gz
cpython-1c8feae411a8afda43e903e5c202ea0e1dbcacbf.tar.bz2
New method getnamespace.
Since the application never gets to see the namespace abbreviation used in the XML document, but some applications may need to know them, we provide this method.
Diffstat (limited to 'Lib/xmllib.py')
-rw-r--r--Lib/xmllib.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/Lib/xmllib.py b/Lib/xmllib.py
index 06b599f..b8422cb 100644
--- a/Lib/xmllib.py
+++ b/Lib/xmllib.py
@@ -222,6 +222,13 @@ class XMLParser:
else:
i = s + len(str)
+ # Interface - return a dictionary of all namespaces currently valid
+ def getnamespace(self):
+ nsdict = {}
+ for t, d, nst in self.stack:
+ nsdict.update(d)
+ return nsdict
+
# Internal -- handle data as far as reasonable. May leave state
# and data to be processed by a subsequent call. If 'end' is
# true, force handling all data as if followed by EOF marker.