\name{xmlAddChild} \alias{xmlAddChild} \title{Adds a child node to an XML node.} \description{ Adds \code{child} and a child node of \code{node}. This is a shortcut for calling \code{append.XMLnode} when the thing to be appended is a single node. } \usage{ xmlAddChild(node, child) } \arguments{ \item{node}{An \code{XMLnode} to which the \code{child} will be added.} \item{child}{An \code{XMLnode} which will be added to \code{node}.} } \details{ A shorthand for the expression \code{append.XMLNode(node,list(child))}. } \value{ The node \code{node} modified to include \code{child}. } \author{Russell Almond} \seealso{\code{\link[XML]{append.XMLNode}}, \code{\link[XML]{xmlChildren}}} \examples{ fb <- xmlNode("foo",xmlNode("bar")) fb1 <- xmlAddChild(xmlNode("foo"),xmlNode("bar")) \dontshow{stopifnot(identical(fb,fb1))} fbb <- xmlNode("foo",xmlNode("bar",attrs=c(v=1)), xmlNode("bar",attrs=c(v=2))) fbb1 <- xmlNode("foo") for (v in 1:2) { fbb1 <- xmlAddChild(fbb1,xmlNode("bar",attrs=c(v=v))) } \dontshow{ stopifnot(identical(toString(fbb),toString(fbb1))) ## Note: No comparison for XML nodes, so compare strings. stopifnot( toString(fb) == toString(fb1)) } } \keyword{manip}