Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

AssignXMLNode

Assign sub-nodes to an XML node


Description

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").

Usage

## S3 replacement method for class 'XMLNode'
x[i] <- value
## S3 replacement method for class 'XMLNode'
x[i] <-  value
## S3 replacement method for class 'XMLNode'
x[[i]] <- value

Arguments

x

the XMLNode object to which the sub-node is to be assigned.

i

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.

value

one or more XMLNode objects which are to be the sub-nodes of x.

Value

The XML node x containing the new or modified nodes.

Author(s)

Duncan Templle Lang

References

See Also

Examples

top <- xmlNode("top", xmlNode("next","Some text"))
 top[["second"]] <- xmlCDataNode("x <- 1:10")
 top[[3]] <- xmlNode("tag",attrs=c(id="name"))

XML

Tools for Parsing and Generating XML Within R and S-Plus

v3.99-0.10
BSD_3_clause + file LICENSE
Authors
CRAN Team [ctb, cre] (de facto maintainer since 2013), Duncan Temple Lang [aut] (<https://orcid.org/0000-0003-0159-1546>), Tomas Kalibera [ctb]
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.