inst/examples/mexico.R

# An example posed by Herve Richard at INRIA.
variable = function(node) {
   # Get the values.
  vals = scan(textConnection(xmlValue(node)))
   # Need the name attribute
  structure(list(vals),
            names = xmlGetAttr(node, "name"))
}

handlers = list(variable = variable)
ans = xmlRoot(xmlTreeParse("mexico.xml", handlers = handlers, asTree = TRUE))
as.data.frame(xmlChildren(ans[["date"]]))

Try the XML package in your browser

Any scripts or data that you put into this service are public.

XML documentation built on Nov. 3, 2023, 1:14 a.m.