[Python-Dev] Re: [4suite] ReleaseNode interface in 4XSLT (original) (raw)
Mike Olson Mike.Olson@fourthought.com
Sun, 13 May 2001 12:15:46 -0600
- Previous message: [Python-Dev] ReleaseNode interface in 4XSLT
- Next message: [Python-Dev] Re: [4suite] ReleaseNode interface in 4XSLT
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
"Martin v. Loewis" wrote:
In PyXML, I currently use # Define ReleaseNode in a DOM-independent way import xml.dom.ext import xml.dom.minidom def releasenode(n): if isinstance(n, xml.dom.minidom.Node): n.unlink() else: xml.dom.ext.ReleaseNode(n) try: from Ft.Lib import pDomlette def ReleaseNode(n): if isinstance(n, pDomlette.Node): pDomlette.ReleaseNode(n) else: releasenode(n) XsltElementBase = pDomlette.Element except ImportError: ReleaseNode = releasenode from minisupport import XsltElementBase This code knows how to release minidom, 4DOM, and pDomlette nodes, and supports installations without 4Suite (i.e. without pDomlette). I've put this into xslt/init.py, so that all callers of Ft.Lib.pDomlette.ReleaseNode now need to call xml.xslt.ReleaseNode. If desired, I could produce a patch against the public Ft CVS.
What if we put these on the implementation, that or came up with a standard interface on the node. Then, every DOM imp that wants to be compatible with xpath/xslt needs to support this interface?
node.ownerDocument.implementation.releaseNode(node)
or
node.py_unlink()
As a slightly independent question, such a function also ought to support DOM implementations not known to it; I'm thinking in particular of the Zope DOMs. I'd like to hear proposals on how such an interface should work; I see three options:
See above
a) it is an operation on the document node (or any node), as in minidom. b) it is an operation on the DOM implementation (almost as in 4Suite; you'd need to navigate from the node to the implementation, then you'd need a well-known operation on the implementation) c) the code assumes that no release activity is necessary for unknown DOMs, effectively believing in reference counting, garbage collection, acquisition, and other black art.
I like either a or b
Mike
Any comments appreciated, in particular 1. from the Ft maintainers on introducing xml.xslt.ReleaseNode, and 2. from authors of other DOMs on a general memory management API for Python DOM. Regards, Martin
4suite mailing list 4suite@lists.fourthought.com http://lists.fourthought.com/mailman/listinfo/4suite
-- Mike Olson Principal Consultant mike.olson@fourthought.com (303)583-9900 x 102 Fourthought, Inc. http://Fourthought.com Software-engineering, knowledge-management, XML, CORBA, Linux, Python
- Previous message: [Python-Dev] ReleaseNode interface in 4XSLT
- Next message: [Python-Dev] Re: [4suite] ReleaseNode interface in 4XSLT
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]