| as_list {xml2} | R Documentation |
This turns an XML document (or node or nodeset) into the equivalent R
list. Note that this is as_list(), not as.list():
lapply() automatically calls as.list() on its inputs, so
we can't override the default.
as_list(x, ns = character(), ...)
x |
A document, node, or node set. |
ns |
Optionally, a named vector giving prefix-url pairs, as produced
by |
... |
Needed for compatability with generic. Unused. |
as_list currently only handles the four most common types of
children that an element might have:
Other elements, converted to lists.
Attributes, stored as R attributes.
Text, stored as a character vector.
as_list(read_xml("<foo> a <b /><c><![CDATA[<d></d>]]></c></foo>"))
as_list(read_xml("<foo> <bar><baz /></bar> </foo>"))
as_list(read_xml("<foo id = 'a'></foo>"))
as_list(read_xml("<foo><bar id='a'/><bar id='b'/></foo>"))