Learn R Programming

flatxml (version 0.1.1)

fxml_getElementInfo: Handling flat XML files

Description

Returns summary information on an XML element.

Usage

fxml_getElementInfo(xmlflat.df, elemid)

Arguments

xmlflat.df

A flat XML dataframe created with fxml_importXMLFlat.

elemid

The ID of the XML element. The ID is the value of the elemid. field in the flat XML dataframe.

Value

A list with the following elements:

  • value: The value of the XML element; return value of the fxml_getValue function.

  • path: A vector representing the path from the root element of the XML element document to the current element. Each XML element on the path is represented by a element of the vector. The vector elements are the names of the XML elements on the path.

  • depth.level: The depth level (hierarchy level) of the XML element; return value of the fxml_getDepthLevel function.

  • attributes: A named vector with the attributes of the XML element (vector elements are the attributes' values, names of the vector elements are the attributes' names; return value of the fxml_getAttributesAll function.

  • parent: The parent of the XML element; return value of the fxml_getParent function.

  • children: The children of the XML element; return value of the fxml_getChildren function.

  • siblings: The siblings of the XML element; return value of the fxml_getSiblings function.

See Also

fxml_getElement, fxml_getValue, fxml_getDepthLevel, fxml_getAttribute, fxml_getChildren, fxml_getParent, fxml_getSiblings

Examples

Run this code
# NOT RUN {
# Load example file with population data from United Nations Statistics Division
# and create flat dataframe
example <- system.file("worldpopulation.xml", package="flatxml")
xml.dataframe <- fxml_importXMLFlat(example)

# Get all relevant information on the XML element with ID 4 (xml.dataframe$elemid. ==  4)
fxml_getElementInfo(xml.dataframe, 4)
# }

Run the code above in your browser using DataLab