Learn R Programming

XML (version 3.99-0.16.1)

xmlSize: The number of sub-elements within an XML node.

Description

XML elements can contain other, nested sub-elements. This generic function determines the number of such elements within a specified node. It applies to an object of class XMLNode or XMLDocument.

Usage

xmlSize(obj)

Value

an integer which is the length

of the value from xmlChildren.

Arguments

obj

An an object of class XMLNode or XMLDocument.

Author

Duncan Temple Lang

References

https://www.w3.org/XML/, http://www.jclark.com/xml/, https://www.omegahat.net

See Also

xmlChildren, xmlAttrs, xmlName, xmlTreeParse

Examples

Run this code
  fileName <- system.file("exampleData", "mtcars.xml", package="XML") 
  doc <- xmlTreeParse(fileName)
  xmlSize(doc)
  xmlSize(doc$doc$children[["dataset"]][["variables"]])

Run the code above in your browser using DataLab