Johannes
Johannes

Reputation: 2121

XQuery Update Facility / Replace node

Is a "replace node..." statement anytime equal to an atomic removal of a node (with it's subtree) and an insertion of the content to replace with at the same place?

That is considering we have a DOM-Implementation, in order to support replace-operations is it save to assume the above statement or is something like this also possible (in case of replacing the "foo"-element with a "blabla"-element):

original tree:

modified tree:

Upvotes: 0

Views: 379

Answers (2)

Christian Grün
Christian Grün

Reputation: 6229

You may as well use rename node to preserve the descendant node structure.

Upvotes: 1

Jens Erat
Jens Erat

Reputation: 38682

Just construct a node <blabla> which contains <foo>'s contents:

replace node /foo with <blabla>{/foo/*}</blabla>

Upvotes: 1

Related Questions