Get spreads from an IDML object
get_idml_spreads()
extracts a list of xml documents for spreads or a data
frame from a idml
object.
Usage
get_idml_spreads(
idml,
format = "list",
names_to = "Spread",
...,
error_call = caller_env()
)
Arguments
- idml
A
idml
class object created withread_idml()
.- format
"list", "xml_document", or "data.frame". If "list", contents are converted with
xml2::as_list()
using the suppliedns
parameter.- names_to
By default,
names(x)
are lost. To keep them, supply a string tonames_to
and the names will be saved into a column with that name. Ifnames_to
is supplied andx
is not named, the position of the elements will be used instead of the names.- ...
Arguments passed on to
get_idml_contents
ns
Optionally, a named vector giving prefix-url pairs, as produced by
xml_ns()
. If provided, all names will be explicitly qualified with the ns prefix, i.e. if the elementbar
is defined in namespacefoo
, it will be calledfoo:bar
. (And similarly for attributes). Default namespaces must be given an explicit name. The ns is ignored when usingxml_name<-()
andxml_set_name()
.parent_nm
Name of top-level parent node. If parent_nm is a character vector,
extract_doc_df()
returns a data frame list.unique_nm
If
TRUE
, ensure that parent_node names are unique before using them to extract data from thexml_document
. Ignored ifnode_names
is supplied.type
Type of data to extract from chlildren nodes: "attr" (attributes) or "text".
- error_call
The execution environment of a currently running function, e.g.
caller_env()
. The function will be mentioned in error messages as the source of the error. See thecall
argument ofabort()
for more information.