Learn R Programming

XML (version 3.99-0.17)

length.XMLNode: Determine the number of children in an XMLNode object.

Description

This function is a simple way to compute the number of sub-nodes (or children) an XMLNode object possesses. It is provided as a convenient form of calling the xmlSize function.

Usage

# S3 method for XMLNode
length(x)

Value

An integer giving the number of sub-nodes of this node.

Arguments

x

the XMLNode object whose length is to be queried.

Author

Duncan Temple Lang

References

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

See Also

xmlSize xmlChildren

Examples

Run this code
  doc <- xmlTreeParse(system.file("exampleData", "mtcars.xml", package="XML"))
  r <- xmlRoot(doc, skip=TRUE)
  length(r)
    # get the last entry
  r[[length(r)]]

Run the code above in your browser using DataLab