This method can be used to get parts of a parsed XML tree object, or to fill it with new values.
XiMpLe.XML
is a class union for objects of classes XiMpLe_node
and XiMpLe_doc
.
node(
obj,
node = list(),
what = NULL,
cond.attr = NULL,
cond.value = NULL,
element = NULL
)# S4 method for XiMpLe.XML
node(
obj,
node = list(),
what = NULL,
cond.attr = NULL,
cond.value = NULL,
element = NULL
)
node(
obj,
node = list(),
what = NULL,
cond.attr = NULL,
cond.value = NULL,
element = NULL
) <- value
# S4 method for XiMpLe.XML
node(
obj,
node = list(),
what = NULL,
cond.attr = NULL,
cond.value = NULL,
element = NULL
) <- value
An object of class XiMpLe_doc
or
XiMpLe_node
.
A list of node names (or their numeric values), where each element is the child of its previous element. duplicate matches will be returned as a list.
A character string,
must be a valid slot name of class XiMpLe_node
, like
"attributes"
or "value"
. If not NULL
,
only that part of a node will be returned.
There's also two special properties for this option: what="@path"
will not return the
node or it's contents,
but a character string with the "path" to it in the object; what="obj@path"
is the same but won't have obj
substituted with the object's name.
A named character string, to further filter the returned results.
If not NULL
, only nodes with fully matching attributes will be considered.
A character string, similar to cond.attr
, but is matched
against the value between a pair of tags.
A character string naming one list element of the node slot. If NULL
,
all
elements will be returned.
The value to set.
if (FALSE) {
node(my.xml.tree, node=list("html","body"), what="attributes")
node(my.xml.tree, node=list("html","head","title"), what="value") <- "foobar"
}
Run the code above in your browser using DataLab