Copy xml elements before appending to tree.  This prevents modified entries from being added
(cherry picked from commit 6b0b45842b138a928f7d5e395f7a21f9ad932f2a)