Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

xmlApply

Applies a function to each of the children of an XMLNode


Description

These methods are simple wrappers for the lapply and sapply functions. They operate on the sub-nodes of the XML node, and not on the fields of the node object itself.

Usage

xmlApply(X, FUN, ...)
## S3 method for class 'XMLNode'
xmlApply(X, FUN, ...)
## S3 method for class 'XMLDocument'
xmlApply(X, FUN, ...)
## S3 method for class 'XMLDocumentContent'
xmlApply(X, FUN, ...)
xmlSApply(X, FUN, ...)
## S3 method for class 'XMLNode'
xmlSApply(X, FUN, ...)
## S3 method for class 'XMLDocument'
xmlSApply(X, FUN, ...)

Arguments

X

the XMLNode on whose children the regular apply or sapply is to be performed

FUN

the function to apply to each child node. This is passed directly to the relevant apply function.

...

additional arguments to be given to each invocation of FUN. This is passed directly to the relevant apply function.

Value

The result is that obtained from calling the apply or sapply on xmlChildren(x).

Author(s)

Duncan Temple Lang

References

See Also

Examples

doc <- xmlTreeParse(system.file("exampleData", "mtcars.xml", package="XML"))
 r <- xmlRoot(doc)
 xmlSApply(r[[2]], xmlName)

 xmlApply(r[[2]], xmlAttrs)

 xmlSApply(r[[2]], xmlSize)

XML

Tools for Parsing and Generating XML Within R and S-Plus

v3.99-0.10
BSD_3_clause + file LICENSE
Authors
CRAN Team [ctb, cre] (de facto maintainer since 2013), Duncan Temple Lang [aut] (<https://orcid.org/0000-0003-0159-1546>), Tomas Kalibera [ctb]
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.