fromXMLtoCSV: XML to CSV conversion function

Description Usage Arguments Value Examples

View source: R/fromXMLtoCSV.R

Description

The package helps to convert the EAD XML data into the table using XPath expressions. Define item nodes (i.e. files, items etc.) and collection nodes (information about collection) to extract the data.

Usage

1
2
3
4
5
6
7
fromXMLtoCSV(
  filename = NULL,
  item_nodes = NULL,
  collection_nodes = NULL,
  excludeFiles = NULL,
  ...
)

Arguments

filename

name of XML file or vector of XML filenames.

item_nodes

list of item nodes defining path, vector of nodes and node types (text/attrs).

collection_nodes

list of collection nodes defining path, vector of nodes and vector of node types (text/attrs).

excludeFiles

vector of filenames excluded from XML to CSV conversion.

...

auxiliary parameters.

Value

Returns the dataframe object with rows (observations matching item/collection nodes) and columns (item nodes).

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
library(HooverArchives)

item_nodes = list(path = "(//c)|(//c01)|(//c02)|(//c03)",
                  nodes = c("primarynode", ".//unittitle", "./did//unitdate"),
                  types = c("attrs", "text", "text"))
# "primarynode" extracts the data from the root nodes.

collection_nodes <- list(path="archdesc[@level='collection']",
                        nodes=c(".//unittitle", "./did//unitdate"),
                        types=c("text", "text"))

filedata <- fromXMLtoCSV(system.file("rusdata.xml", package="HooverArchives"),
                         item_nodes, collection_nodes)

kkalininMI/HooverArchives documentation built on Oct. 28, 2020, 10:16 a.m.