This function provides a way to find XML nodes that match a particular
criterion. It uses the XPath syntax and allows quite powerful
expressions for identifying nodes. The XPath language requires some
knowledge, but tutorials are available. Uses the libxml routine xmlXPathEval.
NOTE: Not currently working in S-Plus -- this function only works with
"Internal Document" objects, which are not currently implemented.
USAGE:
getNodeSet(doc, path, namespaces = character())
ARGUMENTS:
doc
an object of class XMLInternalDocument to process.
path
a string (character vector of length 1) giving the
XPath expression to evaluate.
namespaces
a named character vector giving
the name-URI pairs for the namespaces of interest in the
XPath query.
VALUE:
The result of the libxml routine xmlXPathEval, converted to an S-Plus object.
# NOTE: THIS WILL NOT CURRENTLY WORK, SEE ABOVE
fileName <- system.file("exampleData", "mtcars.xml", package ="XML")
doc < xmlTreeParse(fileName, useInternalNodes = TRUE )
getNodeSet(doc, "/dataset")