[4suite] Releasing a document
Mike Olson
Mike.Olson at fourthought.com
Wed Sep 6 10:50:17 MDT 2000
Alexandre Fayolle wrote:
>
> Hi there,
>
> The product I'm currently working on (and that'll be released in 2-3
> weeks) requires us to be able to release a document completely. By this I
> mean releasing every node, even those that do not have a parent, but
> are still attached to the document, like any well behaved Node.
>
> To achieve this, we made a few changes to 4Dom, mainly adding a
> dictionnary of nodes in Document and changing the constructor of Node so
> that it adds the node to the dictionnary (we used a dictionnary because
> lookup is much faster than in a list, but we basically use it as a
> list). Then we added a ReleaseDocument function in xml.dom.ext that
> Releases each Node in the dictionnary. It works fine... hmm, good enough
> for now :o)
I guess I don't see where the circular references come into play. If a
document creates a Node, and the node is never added as a child to the
document, then there are no circles. the Node will have a pointer to
the its owner doc, but no cycle because the node does not have a parent
or children. Now, if there is more then a single node in the
disconnected branch (ie it has children) then there is a cycle. Is this
the case? Are you calling replaceNode on a branch?
>
> However, we are now facing a problem because our version of 4Dom is
> getting different from 4Thought's. We considered changing the way we do
> things by subclassing Node and Document to match our needs but in many
> parts of 4Dom, there are direct calls to the constructor of a class
> instead of a call to node.ownerDocument.createXXX(), and this is not
> something we can deal with easily (it would mean rewriting these parts in
> our subclasses...).
Do you have a list of places where we do this? I just did a very simple
search and was unable to come up with any cases (though there very well
could be). We should be calling createXXX in all spots. I know there
was one in Sax2, but that is fixed.
>
> Hence the following questions :
> * Would 4Thought integrate a ReleaseDocument patch in the official
> release?
I don't think this is necessary. How are you using 4DOM where this is
needed? One other note python 2.0 is in beta with _much_ better memory
mangement so this could all be a mute point.
> * Would 4Thought use a little bit of help to do some cleanup in order to
> respect the DOM interface internally with regard to Node creation ?
Help is always appreciated. :)
> * Are those things fixed already and about to be released ?
Some. If you have a list all of the places you found I'll compare with
CVS.
One note, we are working out all of the details, but within a week we
should have public CVS access...
Mike
>
> --
> Alexandre Fayolle
> Logilab
>
> _______________________________________________
> 4suite mailing list
> 4suite at lists.fourthought.com
> http://lists.fourthought.com/mailman/listinfo/4suite
--
Mike Olson Principal Consultant
mike.olson at fourthought.com (303)583-9900 x 102
Fourthought, Inc. http://Fourthought.com
Software-engineering, knowledge-management, XML, CORBA, Linux, Python
More information about the 4suite
mailing list