comparison emeraldtree/ElementTree.py @ 47:e647f30cc08e

remove backwards compat code for python < 2.4
author Thomas Waldmann <tw AT waldmann-edv DOT de>
date Sun, 03 Aug 2008 20:59:44 +0200
parents c228aba7258c
children 547347034e65
comparison
equal deleted inserted replaced
46:c228aba7258c 47:e647f30cc08e
1284 1284
1285 def __init__(self, html=0, target=None, encoding=None): 1285 def __init__(self, html=0, target=None, encoding=None):
1286 try: 1286 try:
1287 from xml.parsers import expat 1287 from xml.parsers import expat
1288 except ImportError: 1288 except ImportError:
1289 try: 1289 raise ImportError(
1290 import pyexpat 1290 "No module named expat; use SimpleXMLTreeBuilder instead"
1291 expat = pyexpat 1291 )
1292 except ImportError:
1293 raise ImportError(
1294 "No module named expat; use SimpleXMLTreeBuilder instead"
1295 )
1296 parser = expat.ParserCreate(encoding, "}") 1292 parser = expat.ParserCreate(encoding, "}")
1297 if target is None: 1293 if target is None:
1298 target = TreeBuilder() 1294 target = TreeBuilder()
1299 # underscored names are provided for compatibility only 1295 # underscored names are provided for compatibility only
1300 self.parser = self._parser = parser 1296 self.parser = self._parser = parser