These functions allow one to assign a sub-node
to an existing XML node by name or index.
These are the assignment equivalents of the
subsetting accessor functions.
They are typically called indirectly
via the assignment operator, such as
x[["myTag"]] <- xmlNode("mySubTag")
.
# S3 method for XMLNode
[(x, i) <- value
# S3 method for XMLNode
[(x, i) <- value
# S3 method for XMLNode
[[(x, i) <- value
The XML node x
containing the new or modified
nodes.
the XMLNode
object to which the sub-node is to be assigned.
the identifier for the position in the list of children
of x
into which the right-hand-side node(s) should be assigned.
These can be either numbers or names.
one or more XMLNode
objects which are to be the sub-nodes
of x
.
Duncan Templle Lang
[.XMLNode
[[.XMLNode
append.xmlNode
xmlSize
top <- xmlNode("top", xmlNode("next","Some text"))
top[["second"]] <- xmlCDataNode("x <- 1:10")
top[[3]] <- xmlNode("tag",attrs=c(id="name"))
Run the code above in your browser using DataLab