R/utils-xml.R
xml_duplicate.Rd
Since XML documents and nodes are almost always handled 'by-reference' if you want to keep an original untouched when adding nodes etc, you need to make an unlinked copy of it.
xml_duplicate(x)
xml document
new, unlinked xml document