XML/HTML to List

util_xml2list(tags, con, par = TRUE, ncores = NULL)

Arguments

tags

Character vector. XML or HTML tags.

con

Connection. Path or connection to XML/HTML file.

par

Logical. If TRUE, use multiple cores.

ncores

Integer. Number of cores to use if par = TRUE. If unspecified, defaults to detectCores() - 1.

Author

Ivan Jacob Agaloos Pesigan

Examples

xml <- paste0( "<TITLE>", "Romanza", "</TITLE>", "<ARTIST>", "Andrea Bocelli", "</ARTIST>", "<COUNTRY>", "EU", "</COUNTRY>", "<COMPANY>", "Polydor", "</COMPANY>", "<PRICE>", "10.80", "</PRICE>", "<YEAR>", "1996", "</YEAR>" ) tmp <- tempfile() writeLines( text = xml, con = tmp ) tags <- c( "TITLE", "ARTIST", "COUNTRY", "COMPANY", "PRICE", "YEAR" ) util_xml2list( tags = tags, con = tmp, par = FALSE )
#> TITLE ARTIST COUNTRY COMPANY PRICE YEAR #> [1,] "Romanza" "Andrea Bocelli" "EU" "Polydor" "10.80" "1996"