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

On Fri, 11 Dec 1998, Fred L. Drake wrote:

> 
> 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
>   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.

Before you define equality generally for nodes, don't you have to define
equality for each element and even each attribute? This may be a trivial
task, but I suspect there are some issues (like if a Text node contains an
entity reference, which, after being evaluated, results in a text string
which is the same text string contained in another Text node without that
entity referene) that are not specified. 

Another issue would be order of children. Without a DTD, how do you tell
when order of child elements is significant? Perhaps this has to be an
parameter to the deep comparison operator. 

If you made a decision on these issues and defined a comparison operator,
I would say that it should be recursive because otherwise, the comparison
operator isn't all that useful. Of course, given all the vagaries in the
mapping of semantics of the word "equal" to the semantic meanings of
various subtrees of two DOM trees, I wonder whether a single generalized
equality operator will be useful to many people..

	-Gabe

-------------------------------------------------------------------
http://www.aimnet.com/~gwachob               http://www.findlaw.com
"A popular Government, without popular information, or the means of 
acquiring it, is but a Prologue to a Farce or a Tragedy; or perhaps 
both." -- James Madison 
                       import std.disclaimer

Received on Monday, 14 December 1998 08:39:08 UTC