[xquery-talk] Sequence of Nodes Comparison
Michael Kay
mike at saxonica.com
Tue Dec 4 07:37:24 PST 2012
let $i := (<item id="2">ABC</item>, <item id="2">DEF</item>, <item2
id="3">XYZ</item2>) let $j := (<item id="2">DEF</item>, <item2
id="3">XYZ</item2>, <item id="1">ABC</item>) return every $x in $i
satisfies some $y in $j satisfies deep-equal($x, $y) : )
(a) that's O(n^2)
(b) it will return true if the first list is empty and the second
contains anything at all (or nothing). At the very least you need to
check the lengths are equal; but even then, there's a potential problem
with duplicates.
Michael Kay
Saxonica
More information about the talk
mailing list