doc =
xmlParse(paste0('Duncan',
'Temple Lang'))
au = xmlRoot(doc)[[1]]
# make a copy
other = xmlClone(au)
# change it slightly
xmlAttrs(other) = c(id = "dtl2")
# add it to the children
addChildren(xmlRoot(doc), other)
Run the code above in your browser using DataLab