W3C home > Mailing lists > Public > www-dom@w3.org > October to December 1998

Re: Equality tests on DOM nodes

From: David Brownell <db@Eng.Sun.COM>
Date: Tue, 15 Dec 1998 12:47:13 -0500 (EST)
Message-ID: <36769F71.A90D8C2A@eng.sun.com>
To: www-dom@w3.org
CC: xml-sig@python.org
On the general topic of "equality", I hope that it's clear to everyone
that there are almost innumerable definitions of the notion based on
the particular task being performed ... don't go hoping for a single
universal "always useful" definition!!!

Ray Whitmer wrote:
> 	 it is not unreasonable to expect that the Java DOM binding
> might eventually specify some behavior here, which would not be the "=="
> comparison.

Though there's one thing to consider:  The behavior of Object.equals()
and Object.hashCode() is specified to make objects work as hashtable
keys in the natural manner.  For example, strings can be used as keys
since they're immutable and equals() is overridden ... were they mutable,
or did they not override equals(), that'd not be so.

If org.w3c.dom.Node.equals(Object) were defined to invoke the DOM
method equals(Node, true) then when a node was changed, it'd need
to get moved to a different location in any hashtable.

For the moment, I have a hard time seeing any better implementations
of Object.equals() and Object.hashCode() for DOM nodes than the default!

- Dave
Received on Wednesday, 16 December 1998 05:05:51 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 20 October 2015 10:46:05 UTC