Re: Node identity comparisons

Arnold, Curt writes:
 > Those of you who are steeped in the arcania of the DOM spec may be
 > able to answer this for me.  It seems that a developer would expect
 > (but that expectation may not be justified by the DOM spec), that
 > accessing the same underlying node would result in objects that
 > would pass an identity comparison.

  Then that developer hasn't had sufficiently varied experiance!  The
DOM certainly isn't the only place this will bite them.

 > They probably are for most processors, however I'm pretty sure that
 > they would fail for Xerces-COM since it allocates a new COM wrapper
 > for the underlying node on each request, so that multiple
 > independent objects access the same underlying node.

  They would have also failed for the old PyDOM implementation
(obsolete), and will also fail for my ParsedXML.DOM implementation
for use in the Zope application server.  Both use wrapper objects
around internal node data structures (eerily, they do so for the same
reason!  Bad Python 1.5.2, bad! ;).

 > So, are there any statements in the DOM specs about object identity
 > comparisons?  If object identity comparisons are covered by the
 > spec, then there need to be tests added to check to see if they
 > work as expected.

  I don't recall seeing any statements about equality tests; the
definition of the semantics of a particular language's
equality-testing operator are defined by the language.  Java's "==" is
different from Python's "==" is different from Perl's "==".
  If anything, the DOM specifications should specifically state that
the relation of a language's native equality test to DOM object/node
identity is defined only by the bindings for the individual languages.


  -Fred

-- 
Fred L. Drake, Jr.  <fdrake at acm.org>
PythonLabs at Digital Creations

Received on Friday, 20 April 2001 13:24:27 UTC