z = newXMLNode("foo")
f = system.file("exampleData", "tides.xml", package = "XML")
doc = xmlParse(f)
hdoc = as(doc, "XMLHashTree")
nodes = getNodeSet(doc, "//pred")
ff <- file.path(tempdir(), "tmp.rda")
saveRDS(list(a = 1:10, z = z, doc = doc, hdoc = hdoc, nodes = nodes), ff,
refhook = xmlSerializeHook)
v = readRDS(ff, refhook = xmlDeserializeHook)
unlink(ff)
Run the code above in your browser using DataLab