doc = xmlParse('
A
B
C
D
E
F
')
pages = getNodeSet(doc, "//page")
invisible(lapply(pages, replaceNodeWithChildren))
doc
Run the code above in your browser using DataLab