- From: Stephen R. Savitzky <steve@rsv.ricoh.com>
- Date: 11 Dec 1998 11:07:19 -0800
- To: www-dom@w3.org
"Andrew M. Kuchling" <akuchlin@cnri.reston.va.us> writes: > With reference to the Python DOM implementation, someone has raised > the question of testing the equality of nodes. I don't think there's > anything in the DOM Recommendation that discusses this question, > possibly because the issue doesn't raise its head in Java. There are actually six equivalance relations that are useful for DOM nodes; the first four apply to objects in general: identity two objects are identical if they have the same object ID. Java, C++ ==; LISP eq equality two objects are equal if they have the same class and the values of all attributes and content are recursively equal. LISP equal equivalence two objects are equivalent if they are either identical or both equal and immutable. Equivalence is permanent; if two objects are equivalent, nothing the program does can make them unequal. Java equal (Java require that equal objects have the same hash code) lexical equality two objects are lexically equal if they have the same external (string) representation. It is also useful to make lexical comparisons for greater and less as well. similarity two nodes are similar if they are equal, or if they have the same node type and their names and contents are recursively similar. In DOM terms, they have the same structure, but they may differ in their attributes. This is useful for, e.g., comparing the text of two pages from different servers. textual equality two nodes are textually equal if they are lexically equal after removing all markup and expanding all (defined) entities. -- Stephen R. Savitzky Chief Software Scientist, Ricoh Silicon Valley, Inc., <steve@rsv.ricoh.com> California Research Center voice: 650.496.5710 fax: 650.854.8740 URL: http://rsv.ricoh.com/~steve/ home: <steve@starport.com> URL: http://www.starport.com/people/steve/
Received on Friday, 11 December 1998 14:03:00 UTC