File: names.XMLNode.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 (48 lines) | stat: -rw-r--r-- 1,205 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
\name{names.XMLNode}
\alias{names.XMLNode}
\title{Get the names of an XML nodes children.}
\description{
This is a convenient way to obtain the XML tag name
of each of the sub-nodes of a given 
\code{XMLNode} object.
}
\usage{
\method{names}{XMLNode}(x)
}
\arguments{
  \item{x}{the \code{XMLNode} whose sub-node tag names are being
  queried.}
}

\value{
 A character vector returning the
tag names of the sub-nodes of the given
\code{XMLNode} argument.
}
\references{\url{https://www.w3.org/XML/}, \url{http://www.jclark.com/xml/},
\url{https://www.omegahat.net}  }
\author{ Duncan Temple Lang }

\note{ This overrides the regular names method
which would display the names of the internal
fields of an \code{XMLNode} object.
Since these are intended to be invisible and
queried via the accessor methods (\code{\link{xmlName}},
\code{\link{xmlAttrs}}, etc.), this should not
be a problem. If you really need the names
of the fields, use \code{names(unclass(x))}.
}

\seealso{
 \code{\link{xmlApply}}
 \code{\link{xmlSApply}}
}

\examples{
 doc <- xmlTreeParse(system.file("exampleData", "mtcars.xml", package="XML"))
 names(xmlRoot(doc))

 r <- xmlRoot(doc)
 r[names(r) == "variables"]
}
\keyword{file}