This function is an early and simple approach to converting
an XML node or document into a more typical R list containing
the data values directly (rather than as XML nodes).
It is useful for dealing with data that is returned from
REST requests or other Web queries or generally when parsing
XML and wanting to be able to access the content
as elements in a list indexed by the name of the node.
For example, if given a node of the form
We would end up with a list with elements named "a", "b" and "c".
"a" would be the string "text", b would contain the named character
c(foo = "1") (i.e. the attributes) and "c" would
contain the list with two elements named "d" and ".attrs".
The element corresponding to "d" is a
character vector with the single element "a phrase".
The ".attrs" element of the list is the character vector of
attributes from the node
the XML node or document to be converted to an R list.
This can be an "internal" or C-level node (i.e.
a logical value which controls whether the attributes of an empty node are added to the
a logical value that controls whether we collapse
the list to a vector if the elements all have a common compatible
type. Basically, this controls whether we use
A list whose elements correspond to the children of the top-level nodes.
Duncan Temple Lang
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.