https://github.com/cran/XML
Tip revision: c5d145673d3feb15d9c872aea3be3647966d1a4f authored by ORPHANED on 19 June 2017, 11:43:32 UTC
version 3.98-1.9
version 3.98-1.9
Tip revision: c5d1456
xpath.R
xpathExprCollector =
function(targetAttributes = c("test", "select"))
{
# Collect a list of attributes for each element.
tags = list()
# frequency table for the element names
counts = integer()
start =
function(name, attrs, ...) {
attrs = attrs[ names(attrs) %in% targetAttributes ]
if(length(attrs) == 0)
return(TRUE)
tags[names(attrs)] <<-
lapply(names(attrs),
function(id)
c(tags[[id]] , attrs[id]))
}
list(.startElement = start,
.getEntity = function(x, ...) "xxx",
.getParameterEntity = function(x, ...) "xxx",
result = function() lapply(tags, function(x) sort(table(x), decreasing = TRUE)))
}