Dependent on your goals, perhaps variations on the theme of a sorted list of
all data paths might be useful? For example: considering the paths of all
simple elements and attributes, including indexes, and representing text
content as an appended last "step" - à la /a[1]/b[2]/c[2]#my text value.
I use this in test cases, comparing expected and found instances of complex
structures; with any difference expressed in terms of (a) paths only in A, (b)
paths only in B, (c) paths in both but with different text value.
Graydon Saunders schrieb am 14:38 Mittwoch,
19.Oktober 2016:
Hi Christian --
I was after a better, or at least less convoluted, way to add the UID attribute
nodes. Your code snippet works in place, and faster; thank you!
If anyone happens to have a good general case structure-but-not-position
document compare algorithm lying around, I'd be delighted to hear about it.(It
can't be just XSD because there's a pile of WSDL documents, too. And who knows
what in the future.)
Thanks!Graydon
On Tue, Oct 18, 2016 at 3:28 PM, Christian Grün
wrote:
> Is there a better way to do this?
Your query could probably be shortened as follows:
let $new := db:open($newName) update {
.//* ! (insert node attribute UID { generate-id() } into .)
}
...
It does the same as your original query. But maybe you were asking for
a better solution to compare documents against each other?