diff options
author | Paul Prescod <prescod@prescod.net> | 2000-07-04 03:39:33 (GMT) |
---|---|---|
committer | Paul Prescod <prescod@prescod.net> | 2000-07-04 03:39:33 (GMT) |
commit | 6c4753f925467e5908a43d2fec6d15b76e878d42 (patch) | |
tree | 6aeddeb00540c35075a55fc46c2398461cc66aef /Lib/xml/sax | |
parent | 99b84bdaad28f6deba1462974cbe02ead36cbf75 (diff) | |
download | cpython-6c4753f925467e5908a43d2fec6d15b76e878d42.zip cpython-6c4753f925467e5908a43d2fec6d15b76e878d42.tar.gz cpython-6c4753f925467e5908a43d2fec6d15b76e878d42.tar.bz2 |
Used original SAX handling form.
Diffstat (limited to 'Lib/xml/sax')
-rw-r--r-- | Lib/xml/sax/expatreader.py | 21 |
1 files changed, 10 insertions, 11 deletions
diff --git a/Lib/xml/sax/expatreader.py b/Lib/xml/sax/expatreader.py index b6816a4..f7517b1 100644 --- a/Lib/xml/sax/expatreader.py +++ b/Lib/xml/sax/expatreader.py @@ -101,8 +101,8 @@ class ExpatParser( xmlreader.IncrementalParser, xmlreader.Locator ): self._parser.EndElementHandler = self.end_element_ns else: self._parser = pyexpat.ParserCreate() - self._parser.StartElementHandler = self._cont_handler.startElement - self._parser.EndElementHandler = self._cont_handler.endElement + self._parser.StartElementHandler = self.start_element + self._parser.EndElementHandler = self.end_element self._parser.ProcessingInstructionHandler = \ self._cont_handler.processingInstruction @@ -133,25 +133,22 @@ class ExpatParser( xmlreader.IncrementalParser, xmlreader.Locator ): def getSystemId(self): return self._parser.GetBase() - # internal methods - # event handlers - def start_element(self, name, attrs): - self._cont_handler.startElement(name, + self._cont_handler.startElement(name, name, xmlreader.AttributesImpl(attrs, attrs)) def end_element(self, name): - self._cont_handler.endElement(name) + self._cont_handler.endElement( name, name ) def start_element_ns(self, name, attrs): pair = split(name) if len(pair) == 1: - tup = (None, name, None) + tup = (None, name ) else: - tup = pair+[None] # prefix is not implemented yet! + tup = pair - self._cont_handler.startElement(tup, + self._cont_handler.startElement(tup, None, xmlreader.AttributesImpl(attrs, None)) def end_element_ns(self, name): @@ -161,11 +158,13 @@ class ExpatParser( xmlreader.IncrementalParser, xmlreader.Locator ): else: name = pair+[None] # prefix is not implemented yet! - self._cont_handler.endElement(name) + self._cont_handler.endElement(name, None) + # this is not used def processing_instruction(self, target, data): self._cont_handler.processingInstruction(target, data) + # this is not used def character_data(self, data): self._cont_handler.characters(data) |