0
votes

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:

  • root
    • foo
      • bar
      • baz

modified tree:

  • root
    • blabla
      • bar
      • baz
2

2 Answers

1
votes

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

1
votes

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

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