diff options
author | Fred Drake <fdrake@acm.org> | 2000-09-23 04:49:30 (GMT) |
---|---|---|
committer | Fred Drake <fdrake@acm.org> | 2000-09-23 04:49:30 (GMT) |
commit | 96ea196ea895ff9922338663a2967ae747fd205a (patch) | |
tree | d3b8746c07660f40c6d52eeabd11ae581b74669c /Lib | |
parent | 7fbc85c5c541323f78730b051aae8af07a0a25a6 (diff) | |
download | cpython-96ea196ea895ff9922338663a2967ae747fd205a.zip cpython-96ea196ea895ff9922338663a2967ae747fd205a.tar.gz cpython-96ea196ea895ff9922338663a2967ae747fd205a.tar.bz2 |
Use the public name for the Expat parser; "pyexpat" is deprecated.
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/xml/sax/expatreader.py | 18 |
1 files changed, 7 insertions, 11 deletions
diff --git a/Lib/xml/sax/expatreader.py b/Lib/xml/sax/expatreader.py index bd3a467..f0b6164 100644 --- a/Lib/xml/sax/expatreader.py +++ b/Lib/xml/sax/expatreader.py @@ -1,8 +1,6 @@ """ SAX driver for the Pyexpat C module. This driver works with pyexpat.__version__ == '1.5'. - -$Id$ """ # Todo on driver: @@ -18,10 +16,8 @@ $Id$ version = "0.20" -from string import split - +from xml.parsers import expat from xml.sax import xmlreader -import pyexpat import xml.sax # --- ExpatParser @@ -49,9 +45,9 @@ class ExpatParser( xmlreader.IncrementalParser, xmlreader.Locator ): self._cont_handler.setDocumentLocator(self) try: xmlreader.IncrementalParser.parse(self, stream) - except pyexpat.error: + except expat.error: error_code = self._parser.ErrorCode - raise xml.sax.SAXParseException(pyexpat.ErrorString(error_code), + raise xml.sax.SAXParseException(expat.ErrorString(error_code), None, self) self._cont_handler.endDocument() @@ -96,11 +92,11 @@ class ExpatParser( xmlreader.IncrementalParser, xmlreader.Locator ): def reset(self): if self._namespaces: - self._parser = pyexpat.ParserCreate(None, " ") + self._parser = expat.ParserCreate(None, " ") self._parser.StartElementHandler = self.start_element_ns self._parser.EndElementHandler = self.end_element_ns else: - self._parser = pyexpat.ParserCreate() + self._parser = expat.ParserCreate() self._parser.StartElementHandler = self.start_element self._parser.EndElementHandler = self.end_element @@ -142,7 +138,7 @@ class ExpatParser( xmlreader.IncrementalParser, xmlreader.Locator ): self._cont_handler.endElement( name, name ) def start_element_ns(self, name, attrs): - pair = split(name) + pair = name.split() if len(pair) == 1: tup = (None, name ) else: @@ -152,7 +148,7 @@ class ExpatParser( xmlreader.IncrementalParser, xmlreader.Locator ): xmlreader.AttributesImpl(attrs, None)) def end_element_ns(self, name): - pair = split(name) + pair = name.split() if len(pair) == 1: name = (None, name, None) else: |