xml_children returns only elements, xml_contents returns all nodes. xml_length returns the number of children. xml_parent returns the parent node, xml_parents returns all parents up to the root. xml_siblings returns all nodes at the same level. xml_child makes it easy to specify a specific child to return.
xml_replace
(Package: xml2) :
Modify a tree by inserting, replacing or removing nodes
xml_add_sbling() and xml_add_child() are used to insert a node as a sibling or a child. xml_replace() replaces an existing node with a new node. xml_remove() removes a node from the tree.
as_list
(Package: xml2) :
Coerce xml nodes to a list.
This turns an XML document (or node or nodeset) into the equivalent R list. Note that this is as_list(), not as.list(): lapply() automatically calls as.list() on its inputs, so we can't override the default.