- From: Kay, Michael <Michael.Kay@softwareag.com>
- Date: Tue, 15 Apr 2003 14:07:41 +0200
- To: Tobias Reif <tobiasreif@pinkjuice.com>, public-qt-comments@w3.org
There will be some renaming and repackaging of these functions in the next draft. I think the response to your use case is that you can recurse down the tree using deep-equal at each level. In fact deep-equal might not help you much, you may well be better off programming the tree traversal yourself looking for the differences that matter to you. It's very hard to come up with a single definition of deep-equal that suits everyone, and there have been some suggestions that we should therefore scrap it and make people write their own. Michael Kay > -----Original Message----- > From: Tobias Reif [mailto:tobiasreif@pinkjuice.com] > Sent: 15 April 2003 12:34 > To: public-qt-comments@w3.org > Subject: node-equal(), node-identical() > > > > Hi > > If I want to compare two trees for equality (comparing actual test > output to the desired test output), I can use deep-equal() > http://www.w3.org/TR/xquery-operators/#func-> deep-equal . > > Now > if the two trees are not equal, I need to > find out where the first > difference occurs (for example if the fourth element in the actual > output is p, not span (... as specified in the desired > output)). I'd like to recurse through all the nodes (be it as > list or as tree), > compare them for equality, then stop as soon as a pair is not equal. > Then I can output something like "test 5 failed: the fourth > element is > p, not span". > > It's probably obvious, but how can I test two nodes for > equality? I'm sure there exists a very simple solution, but > the current draft is > inconsistent and confusing in this regard, IMHO: > http://www.w3.org/TR/xquery-operators/#func-node-equal "If the node identified by the value of $parameter1 is the same node as the node identified by the value of $parameter2 (that is, the two nodes have the same identity), then the function returns true; otherwise, the function returns false." Shouldn't the function named "node-equal" compare two (possibly different) nodes for equality, not for identity? (that's what I would use) Shouldn't the function which tests for identity be named "node-identical"? I'm not sure if a clarification or a change is required. TIA, Tobi -- http://www.pinkjuice.com/
Received on Tuesday, 15 April 2003 08:07:49 UTC