tt =
'
text
a phrase
'
a = xmlParse(tt, asText = TRUE)
b = xmlParse(tt, asText = TRUE)
d = getNodeSet(b, "//d")[[1]]
xmlName(d) = "bob"
addSibling(xmlParent(d), newXMLNode("c"))
compareXMLDocs(a, b)
Run the code above in your browser using DataLab