Parse an XML file and return an R character vector

Sara

New Member
I've parsed an XML document with R, e.g:\[code\]library(XML)f = system.file("exampleData", "mtcars.xml", package="XML")doc = xmlParse(f)\[/code\]Using XPath expressions, I can select specific nodes in the document:\[code\]> getNodeSet(doc, "//record[@id='Mazda RX4']/text()")[[1]] 21.0 6 160.0 110 3.90 2.620 16.46 0 1 4 4 attr(,"class") [1] "XMLNodeSet"\[/code\]But I can't figure out how to turn the result into an R character vector:\[code\]> as.character(getNodeSet(doc, "//record[@id='Mazda RX4']/text()"))[1] "<pointer: 0x000000000e6a7fe0>"\[/code\]How do I get text from an internal pointer to a C object?
 
Back
Top