Learn R Programming

XML (version 0.7-1)

xmlAttrs: Get the list of attributes of an XML node.

Description

This returns a named character vector giving the name-value pairs of attributes of an XMLNode object which is part of an XML document.

Usage

xmlAttrs(node)

Arguments

node
The XMLNode object whose attributes are to be extracted.

Value

  • A named character vector, where the names are the attribute names and the elements are the corresponding values. This corresponds to the (attr, "value") pairs in the XML tag

References

http://www.w3.org

See Also

xmlChildren, xmlSize, xmlName

Examples

Run this code
fileName <- system.file("exampleData", "mtcars.xml", package="XML") 
 doc <- xmlTreeParse(fileName)

 xmlAttrs(doc$doc$children[["dataset"]])

 xmlAttrs(doc$doc$children[["dataset"]][["variables"]])

Run the code above in your browser using DataLab