W3C home > Mailing lists > Public > public-qt-comments@w3.org > May 2003

RE: node equality: fn:node-equal()

From: Kay, Michael <Michael.Kay@softwareag.com>
Date: Thu, 15 May 2003 05:23:41 +0200
Message-ID: <DFF2AC9E3583D511A21F0008C7E62106073DCE34@daemsg02.software-ag.de>
To: Tobias Reif <tobiasreif@pinkjuice.com>, "Kay, Michael" <Michael.Kay@softwareag.com>
Cc: public-qt-comments@w3.org

> Kay, Michael wrote:
> >>I'd like to compare two nodes for equality. I could do it by testing
> >>various aspects of the pair, thus writing my:node-equal(), but I'd 
> >>prefer to have it available in the language.
> >>
> > You'll have to explain exactly what you mean by node equality.
> Sorry for quoting myself, but I wrote 
> http://lists.w3.org/Archives/Public/public-qt-comments/2003May
> /0171.html
> "It would test for  equality (not identity), and simply 
> return true or 
> false. I think that would be like fn:deep-equal(), but would 
> not recurse 
> down the tree; it would only test the single node, or the 
> root note of 
> the tree if the arg is a tree."
> I think that's as much as I can provide.

Since you don't seem able to give a precise definition, perhaps I can give
you a multiple choice question. Here are some elements. Which pairs of
elements do you regard as being "equal"?

1: <a/>
2: <a> </a>
3: <a xsi:nil="true"/>
4: <a att="2"> </a>
5: <a><!-comment--> </a>
6: <a><b/> </a>
7: <b> </b>

I'm sure that if you asked ten people this question, they would come up with
ten different answers. Certainly, from the information you have given, I
have no way of knowing which of these elements you regard as being equal to
each other.

We have provided access to most of the interesting properties of an element
using basic functions: the string value, the name, the typed value, the base
URI, the set of in-scope namespaces, the attributes. You can combine these
properties in any way you like to create a definition of node equality that
suits your own view of what it means for two nodes to be equal.

Michael Kay
Received on Wednesday, 14 May 2003 23:24:37 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 7 January 2015 15:45:12 UTC