[XML-SIG] minidom/pulldom connection
Fred L. Drake, Jr.
fdrake@acm.org
Wed, 22 Nov 2000 15:40:07 -0500 (EST)
--32TdKUcSAf
Content-Type: text/plain; charset=us-ascii
Content-Description: message body and .signature
Content-Transfer-Encoding: 7bit
Fred L. Drake, Jr. writes:
> I'm proposing the attached patch to pulldom.
Which I'm actually attaching this time...
-Fred
--
Fred L. Drake, Jr. <fdrake at acm.org>
PythonLabs at Digital Creations
--32TdKUcSAf
Content-Type: text/plain
Content-Description: patch to xml.dom.pulldom
Content-Disposition: inline;
filename="pulldom.diff"
Content-Transfer-Encoding: 7bit
Index: pulldom.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/xml/dom/pulldom.py,v
retrieving revision 1.11
diff -c -r1.11 pulldom.py
*** pulldom.py 2000/10/23 18:09:50 1.11
--- pulldom.py 2000/11/22 20:38:20
***************
*** 1,4 ****
- import minidom
import xml.sax,xml.sax.handler
START_ELEMENT = "START_ELEMENT"
--- 1,3 ----
***************
*** 11,17 ****
CHARACTERS = "CHARACTERS"
class PullDOM(xml.sax.ContentHandler):
! def __init__(self):
self.firstEvent = [None, None]
self.lastEvent = self.firstEvent
self._ns_contexts = [{}] # contains uri -> prefix dicts
--- 10,17 ----
CHARACTERS = "CHARACTERS"
class PullDOM(xml.sax.ContentHandler):
! def __init__(self, document=None):
! self.document = document
self.firstEvent = [None, None]
self.lastEvent = self.firstEvent
self._ns_contexts = [{}] # contains uri -> prefix dicts
***************
*** 121,127 ****
self.lastEvent = self.lastEvent[1]
def startDocument(self):
! node = self.curNode = self.document = minidom.Document()
node.parentNode = None
self.lastEvent[1] = [(START_DOCUMENT, node), None]
self.lastEvent = self.lastEvent[1]
--- 121,130 ----
self.lastEvent = self.lastEvent[1]
def startDocument(self):
! if self.document is None:
! import xml.dom.minidom
! self.document = xml.dom.minidom.Document()
! node = self.curNode = self.document
node.parentNode = None
self.lastEvent[1] = [(START_DOCUMENT, node), None]
self.lastEvent = self.lastEvent[1]
--32TdKUcSAf--