This set of functions can be used to construct parsing functions adhering to the Request$parse() requirements.
parse_json(
simplifyVector = TRUE,
simplifyDataFrame = simplifyVector,
simplifyMatrix = simplifyVector,
flatten = FALSE
)
parse_plain(sep = "\n")
parse_xml(encoding = "", options = "NOBLANKS", base_url = "")
parse_html(
encoding = "",
options = c("RECOVER", "NOERROR", "NOBLANKS"),
base_url = ""
)
parse_multiform()
parse_queryform()
parse_table(...)
coerce JSON arrays containing only primitives into an atomic vector
coerce JSON arrays containing only records (JSON objects) into a data frame
coerce JSON arrays containing vectors of equal mode and dimension into matrix or array
automatically flatten()
nested data frames into a single non-nested data frame
The line separator. Plain text will be split into multiple strings based on this.
Specify a default encoding for the document. Unless otherwise specified XML documents are assumed to be in UTF-8 or UTF-16. If the document is not UTF-8/16, and lacks an explicit encoding directive, this allows you to supply a default.
Set parsing options for the libxml2 parser. Zero or more of
recover on errors
substitute entities
load the external subset
default DTD attributes
validate with the DTD
suppress error reports
suppress warning reports
pedantic error reporting
remove blank nodes
use the SAX1 interface internally
Implement XInclude substitition
Forbid network access
Do not reuse the context dictionary
remove redundant namespaces declarations
merge CDATA as text nodes
do not generate XINCLUDE START/END nodes
compact small text nodes; no modification of the tree allowed afterwards (will possibly crash if you try to modify the tree)
parse using XML-1.0 before update 5
do not fixup XINCLUDE xml:base uris
relax any hardcoded limit from the parser
parse using SAX2 interface before 2.7.0
ignore internal document encoding hint
Store big lines numbers in text PSVI field
When loading from a connection, raw vector or literal html/xml, this allows you to specify a base url for the document. Base urls are used to turn relative urls into absolute urls.
parameters passed on to read.table()
A function accepting a raw vector and a named list of directives
formatters for converting Response
bodies into compatible types
default_parsers for a list that maps the most common mime types to their respective parsers
fake_rook <- fiery::fake_request(
'http://example.com/test',
content = '[1, 2, 3, 4]',
headers = list(
Content_Type = 'application/json'
)
)
req <- Request$new(fake_rook)
req$parse(json = parse_json())
#> [1] TRUE
req$body
#> [1] 1 2 3 4
# Cleaning up connections
rm(fake_rook, req)
gc()
#> used (Mb) gc trigger (Mb) max used (Mb)
#> Ncells 984805 52.6 1934632 103.4 1934632 103.4
#> Vcells 1840617 14.1 8388608 64.0 2565683 19.6