util_xml2list: 'XML'/'HTML' to List

Description Usage Arguments Author(s) Examples

View source: R/util_xml2list.R

Description

XML/HTML to List

Usage

1
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(s)

Ivan Jacob Agaloos Pesigan

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
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
)

jeksterslabds/jeksterslabRutils documentation built on Jan. 18, 2021, 11:41 p.m.