Learn R Programming

XiMpLe (version 0.03-21)

node: Extract/manipulate a node or parts of it from an XML tree

Description

This method can be used to get parts of a parsed XML tree object, or to fill it with new values.

Arguments

obj
An object of class XiMpLe.doc or XiMpLe.node.
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.
what
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
cond.attr
A named character string, to further filter the returned results. If not NULL, only nodes with fully matching attributes will be considered.
cond.value
A character string, similar to cond.attr, but is matched against the value between a pair of tags.
element
A character string naming one list element of the node slot. If NULL, all elements will be returned.

Examples

Run this code
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