File: xmlApply.Rd

package info (click to toggle)
r-cran-xml 3.99-0.19-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 3,688 kB
  • sloc: ansic: 6,659; xml: 2,890; asm: 486; sh: 12; makefile: 2
file content (69 lines) | stat: -rw-r--r-- 1,841 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
\name{xmlApply}
\alias{xmlApply}
\alias{xmlApply.XMLNode}
\alias{xmlApply.XMLDocument}
\alias{xmlApply.XMLDocumentContent}
\alias{xmlSApply}
\alias{xmlSApply.XMLNode}
\alias{xmlSApply.XMLDocument}
\alias{xmlSApply.XMLDocumentContent}
\title{Applies a function to each of the children of an XMLNode}
\description{
 These methods are simple wrappers for the 
 \code{\link{lapply}} and \code{\link{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, ...)
\method{xmlApply}{XMLNode}(X, FUN, ...)
\method{xmlApply}{XMLDocument}(X, FUN, ...)
\method{xmlApply}{XMLDocumentContent}(X, FUN, ...)
xmlSApply(X, FUN, ...)
\method{xmlSApply}{XMLNode}(X, FUN, ...)
\method{xmlSApply}{XMLDocument}(X, FUN, ...)
}

\arguments{
  \item{X}{the \code{XMLNode} on whose children the regular
   \code{\link{apply}} or \code{\link{sapply}} is to be performed}
  \item{FUN}{the function to apply to each child node. This is passed
   directly to the relevant \code{\link{apply}} function.}
  \item{\dots}{additional arguments to be given to each invocation of
    \code{FUN}. This is passed directly to the relevant \code{\link{apply}} function.}
}
\value{
 The result is that obtained from calling 
the \code{\link{apply}} or \code{\link{sapply}}
on \code{xmlChildren(x)}.
}

\references{
  \url{https://www.w3.org/XML/},
  \url{http://www.jclark.com/xml/},
  \url{https://www.omegahat.net}
}

\author{Duncan Temple Lang}


\seealso{
 \code{\link{xmlChildren}}
 \code{\link{xmlRoot}}
 \code{\link{[.XMLNode}}
 \code{\link{sapply}}
 \code{\link{lapply}}
}

\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)

}
\keyword{file}