Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

xmlName

Extraces the tag name of an XMLNode object.


Description

Each XMLNode object has an element or tag name introduced in the <name ...> entry in an XML document. This function returns that name.

We can also set that name using xmlName(node) <- "name" and the value can have an XML name space prefix, e.g. "r:name".

Usage

xmlName(node, full = FALSE)

Arguments

node

The XMLNode object whose tag name is being requested.

full

a logical value indicating whether to prepend the namespace prefix, if there is one, or return just the name of the XML element/node. TRUE means prepend the prefix.

Value

A character vector of length 1 which is the node$name entry.

Author(s)

Duncan Temple Lang

References

See Also

Examples

fileName <- system.file("exampleData", "test.xml", package="XML") 
 doc <- xmlTreeParse(fileName)
 xmlName(xmlRoot(doc)[[1]])

 tt = xmlRoot(doc)[[1]]
 xmlName(tt)
 xmlName(tt) <- "bob"


  # We can set the node on an internal object also.
 n = newXMLNode("x")

 xmlName(n)
 xmlName(n) <- "y"

 
 xmlName(n) <- "r:y"

XML

Tools for Parsing and Generating XML Within R and S-Plus

v3.99-0.10
BSD_3_clause + file LICENSE
Authors
CRAN Team [ctb, cre] (de facto maintainer since 2013), Duncan Temple Lang [aut] (<https://orcid.org/0000-0003-0159-1546>), Tomas Kalibera [ctb]
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.