get_idml_contents()
is a helper for extracting or converting xml_document
objects from the idml
list object.
Usage
get_idml_contents(
idml,
dir = NULL,
file = NULL,
format = "xml_document",
ns = character(),
parent_nm = NULL,
unique_nm = TRUE,
type = "attr",
...,
error_call = caller_env()
)
format_idml_content(
content,
format = "xml_document",
ns = character(),
parent_nm = NULL,
unique_nm = TRUE,
type = "attr",
names_to = zap(),
allow_list = TRUE,
...,
error_call = caller_env()
)
Arguments
- idml
A
idml
class object created withread_idml()
.- dir, file
Directory and file name from IDML contents to return. If
file
isNULL
,- format
"list", "xml_document", or "data.frame". If "list", contents are converted with
xml2::as_list()
using the suppliedns
parameter.- 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".
- ...
Needed for compatibility with generic. Unused.
- 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.