Re: [XML-SIG] RE: Equality tests on DOM nodes

Paul Butkiewicz writes:
 > Not to sound facetious, but to put this question in context, I might well
 > ask how we implement < and > for nodes?  We generally don't use those

  This is a very real concern.  I think comparison if nodes is only
interesting for equality.  When Python finally implements the "rich
comparison" semantics that have been proposed, equality will be
testable indepently of ordering.

 > to specify that two things are equal when they do not refer to the same
 > thing and/or measurable differences exist between them.  It seems obvious
 >  perhaps only to me ) that attributes must be equal and the equality must be
 > true recursively, if you dare to define equality for nodes.  I think the

  Well said.

 > Does context make a difference in equality or equivalence?
 > 
 > I could easily say that this paragraph is identical to that paragraph when
 > we're talking about a printed page, but XML, in it's most commonly discussed
 > usage, is about document metadata, and context is a part of that metadata.
 > A node is, after all, part of a larger document.

  A good point.  I was particularly interested in equality *without
consideration for parent*.  So, I was ignoring context.
  Perhaps there is no fully general equality that isn't identity?  I
think the Python implementation would still require implementation of
a comparison method to achieve this since it uses proxy nodes, but
that's really just an implementation detail.  Python's native identity 
operator doesn't work in the presence of proxies that represent the
same node.


  -Fred

--
Fred L. Drake, Jr.	     <fdrake@acm.org>
Corporation for National Research Initiatives
1895 Preston White Dr.	    Reston, VA  20191

Received on Monday, 14 December 1998 08:38:55 UTC