Learn R Programming

xml2 (version 1.3.3)

xml_name: The (tag) name of an xml element.

Description

The (tag) name of an xml element.

Modify the (tag) name of an element

Usage

xml_name(x, ns = character())

xml_name(x, ns = character()) <- value

xml_set_name(x, value, ns = character())

Value

A character vector.

Arguments

x

A document, node, or node set.

ns

Optionally, a named vector giving prefix-url pairs, as produced by xml_ns(). If provided, all names will be explicitly qualified with the ns prefix, i.e. if the element bar is defined in namespace foo, it will be called foo:bar. (And similarly for attributes). Default namespaces must be given an explicit name. The ns is ignored when using xml_name<-() and xml_set_name().

value

a character vector with replacement name.

Examples

Run this code
x <- read_xml("123")
xml_name(x)

y <- read_xml("1abc")
z <- xml_children(y)
xml_name(xml_children(y))

Run the code above in your browser using DataLab