Returns summary information on an XML element.

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

Examples

# 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)
#> $value #> [1] "Afghanistan" #> #> $path #> [1] "ROOT" "data" "record" "field" #> #> $depth.level #> [1] 4 #> #> $attributes #> name #> "Country or Area" #> #> $parent #> [1] 3 #> #> $children #> NULL #> #> $siblings #> [1] 5 6 7 8 #>