xml2 icon indicating copy to clipboard operation
xml2 copied to clipboard

`xml_replace_contents()`

Open hadley opened this issue 2 years ago • 1 comments

I find I need something like this function fairly often:

xml_replace_contents <- function(node, new) {
   xml2::xml_remove(xml2::xml_contents(node))

   contents <- xml2::xml_contents(new)
   for (child in contents) {
     xml2::xml_add_child(node, child)
   }
 }

Maybe also suggests need for xml_add_children()?

hadley avatar Oct 13 '21 13:10 hadley

And xml_add_child() needs a better error message when pass it a nodeset.

hadley avatar Oct 03 '22 22:10 hadley