Learn R Programming

XiMpLe (version 0.11-3)

parseXMLTree: Read an XML file into an R object

Description

Read an XML file into an R object

Usage

parseXMLTree(file, drop = NULL, object = FALSE)

Value

An object of class XiMpLe_doc with four slots:

file:

Full path to the parsed file, or "object" if object=TRUE.

xml:

XML declaration, if found.

dtd:

Doctype definition, if found.

children:

A list of objects of class XiMpLe_node, with the elements "name" (the node name), "attributes" (list of attributes, if found), "children" (list of XiMpLe_node object, if found) and "value" (text value between a pair of start/end tags, if found).

Arguments

file

Character string, valid path to the XML file which should be parsed.

drop

Character vector with the possible values "comments", "cdata" "declarations", and "doctype", defining element classes to be dropped from the resulting object, or "empty_attributes", in case you would like to omit empty attributes (as used in HTML).

object

Logical, if TRUE, file will not be treated as a path name but as a character vector to be parsed as XML directly.

See Also

XiMpLe_node, XiMpLe_doc

Examples

Run this code
if (FALSE) {
sample.XML.object <- parseXMLTree("~/data/sample_file.xml")
}

Run the code above in your browser using DataLab