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
|
\name{xmlName}
\alias{xmlName}
\alias{xmlName<-}
\alias{xmlName.XMLComment}
\alias{xmlName.XMLNode}
\alias{xmlName.XMLInternalNode}
\title{ Extraces the tag name of an XMLNode object.}
\description{
Each XMLNode object has an element or tag name introduced
in the \code{<name ...>} entry in an XML document.
This function returns that name.
We can also set that name using \code{xmlName(node) <- "name"}
and the value can have an XML name space prefix, e.g.
\code{"r:name"}.
}
\usage{
xmlName(node, full = FALSE)
}
\arguments{
\item{node}{The XMLNode object whose tag name is being requested.}
\item{full}{a logical value indicating whether to prepend the
namespace prefix, if there is one, or return just the
name of the XML element/node. \code{TRUE} means prepend the prefix.}
}
\value{
A character vector of length 1
which is the \code{node$name} entry.
}
\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{xmlAttrs}},
\code{\link{xmlTreeParse}}
}
\examples{
fileName <- system.file("exampleData", "test.xml", package="XML")
doc <- xmlTreeParse(fileName)
xmlName(xmlRoot(doc)[[1]])
tt = xmlRoot(doc)[[1]]
xmlName(tt)
xmlName(tt) <- "bob"
# We can set the node on an internal object also.
n = newXMLNode("x")
xmlName(n)
xmlName(n) <- "y"
xmlName(n) <- "r:y"
}
\keyword{file}
|