
faassen at vet
Oct 27, 2001, 6:31 AM
Post #3 of 4
(1163 views)
Permalink
|
Dethe Elza wrote: > >Another way is to give each node that is created a unique id. For that > >we'd need to change the DOM in some places and we'll have to carry the > >unique id around, but that'd certainly be possible. > > This would be my choice, it also requires a check to make sure the node > is still *there* before you use it. Right, although such a reverse mapping isn't part of my requirements just yet (that brings back the whole stuff about keeping references to nodes, the dictionary that maps id to nodes would need to do something like that). What I think is enough for my purposes so far is to store the id only, and then when I encounter a node, I ask it what its id is, and compare the two. That way I know I've seen it before. Resolving the ids to nodes in an efficient way seems harder. Of course you can hunt the entire DOM tree for it, but that's not efficient. You can keep a potentially huge mapping of all ids to all nodes, but then we want that to be a mapping of weak references, and that doesn't seem to work with the acquisition base classes.. Hmm...what *would* work is the original url mapping thing, though. You can now make a stable url into the document, using the ids. It's also reasonably efficient to look up such a node by URL. It's also easy to verify whether a node doesn't exist anymore in that location. Of course this is slightly different from finding out whether a node exists at all anymore (it may have moved somewhere else), but would that be important? > >(should I move this kind of discussion in general to the zope-xml list? > >Sometimes I don't know where I should be posting my stuff) > > I can't speak for anyone else, but I'm certainly willing to see > ParsedXML discussed in zope-xml. In fact, I'd like to see all the > various XML projects within zope discussed in zope-xml: We can work > towards a common vision and all that. Individual lists would still be > OK for specific bug reports, CVS checkin reports, etc., but direction > and strategy would seem to be right at home on this list. Okay, then I'll be posting more often to this list when stuff like this comes up. Regards, Martijn
|