summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlex Martelli <aleaxit@gmail.com>2006-08-21 23:45:19 (GMT)
committerAlex Martelli <aleaxit@gmail.com>2006-08-21 23:45:19 (GMT)
commit6cefeb0e8156406ac3f99248f6a3d3cd1536ca23 (patch)
treef014f8d1968613ffc10b2caca4ccb532c0db9e64
parent0008602188da017f877216fbfc89c7fac8952add (diff)
downloadcpython-6cefeb0e8156406ac3f99248f6a3d3cd1536ca23.zip
cpython-6cefeb0e8156406ac3f99248f6a3d3cd1536ca23.tar.gz
cpython-6cefeb0e8156406ac3f99248f6a3d3cd1536ca23.tar.bz2
Jacques Frechet's and John Reese's simplification of ElementTree: give up
attempts at backwards compatibility which can't work anyway on Py3k (and aren't needed for Python 2.5 and later).
-rw-r--r--Lib/xml/etree/ElementTree.py28
1 files changed, 1 insertions, 27 deletions
diff --git a/Lib/xml/etree/ElementTree.py b/Lib/xml/etree/ElementTree.py
index deaed7d..e03e297 100644
--- a/Lib/xml/etree/ElementTree.py
+++ b/Lib/xml/etree/ElementTree.py
@@ -111,33 +111,7 @@ __all__ = [
import string, sys, re
-class _SimpleElementPath:
- # emulate pre-1.2 find/findtext/findall behaviour
- def find(self, element, tag):
- for elem in element:
- if elem.tag == tag:
- return elem
- return None
- def findtext(self, element, tag, default=None):
- for elem in element:
- if elem.tag == tag:
- return elem.text or ""
- return default
- def findall(self, element, tag):
- if tag[:3] == ".//":
- return element.getiterator(tag[3:])
- result = []
- for elem in element:
- if elem.tag == tag:
- result.append(elem)
- return result
-
-try:
- from . import ElementPath
-except ImportError:
- # FIXME: issue warning in this case?
- # TODO: DEFINITELY issue warning here!!!
- ElementPath = _SimpleElementPath()
+from . import ElementPath
# TODO: add support for custom namespace resolvers/default namespaces
# TODO: add improved support for incremental parsing