parseXMLTree: Read an XML file into an R object

View source: R/parseXMLTree.R

parseXMLTreeR Documentation

Read an XML file into an R object

Description

Read an XML file into an R object

Usage

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

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.

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).

See Also

XiMpLe_node, XiMpLe_doc

Examples

## Not run: 
sample.XML.object <- parseXMLTree("~/data/sample_file.xml")

## End(Not run)

XiMpLe documentation built on Aug. 22, 2023, 5:07 p.m.