names.XMLNode: Get the names of an XML nodes children.

Description Usage Arguments Value Note Author(s) References See Also Examples

View source: R/XMLClasses.R

Description

This is a convenient way to obtain the XML tag name of each of the sub-nodes of a given XMLNode object.

Usage

1
2
## S3 method for class 'XMLNode'
names(x)

Arguments

x

the XMLNode whose sub-node tag names are being queried.

Value

A character vector returning the tag names of the sub-nodes of the given XMLNode argument.

Note

This overrides the regular names method which would display the names of the internal fields of an XMLNode object. Since these are intended to be invisible and queried via the accessor methods (xmlName, xmlAttrs, etc.), this should not be a problem. If you really need the names of the fields, use names(unclass(x)).

Author(s)

Duncan Temple Lang

References

http://www.w3.org/XML, http://www.jclark.com/xml, http://www.omegahat.net

See Also

xmlApply xmlSApply

Examples

1
2
3
4
5
 doc <- xmlTreeParse(system.file("exampleData", "mtcars.xml", package="XML"))
 names(xmlRoot(doc))

 r <- xmlRoot(doc)
 r[names(r) == "variables"]

XML documentation built on June 20, 2017, 9:13 a.m.

Search within the XML package
Search all R packages, documentation and source code