f = system.file("exampleData", "size.xml", package = "XML")
xmlToDataFrame(f, c("integer", "integer", "numeric"))
# Drop the middle variable.
z = xmlToDataFrame(f, colClasses = list("integer", NULL, "numeric"))
# This illustrates how we can get a subset of nodes and process
# those as the "data nodes", ignoring the others.
f = system.file("exampleData", "tides.xml", package = "XML")
doc = xmlParse(f)
xmlToDataFrame(nodes = xmlChildren(xmlRoot(doc)[["data"]]))
# or, alternatively
xmlToDataFrame(nodes = getNodeSet(doc, "//data/item"))
f = system.file("exampleData", "kiva_lender.xml", package = "XML")
doc = xmlParse(f)
dd = xmlToDataFrame(getNodeSet(doc, "//lender"))
Run the code above in your browser using DataLab