xmlAttrs {XML} | R Documentation |
This returns a named character vector giving the name-value pairs of attributes of an XMLNode object which is part of an XML document.
xmlAttrs(node, ...)
node |
The XMLNode object
whose attributes are to be extracted. |
... |
additional arguments for the specific methods. |
A named character vector, where the names
are the attribute names and the
elements are the corresponding values.
This corresponds to the (attr<i>, "value<i>")
pairs in the XML tag
<tag attr1="value1" attr2="value2"
Duncan Temple Lang
fileName <- system.file("exampleData", "mtcars.xml", package="XML") doc <- xmlTreeParse(fileName) xmlAttrs(doc$doc$children[["dataset"]]) xmlAttrs(doc$doc$children[["dataset"]][["variables"]])