xml_text {xml2} | R Documentation

## Extract the text

### Description

Extract the text

### Usage

    xml_text(x, trim = FALSE)

### Arguments

`x` | A document, node, or node set.
`trim` | If `TRUE` will trim leading and trailing spaces.

### Value

A character vector, the same length as x.

### Examples

    x <- read_xml("<p>This is some text. This is <b>bold!</b></p>")
    xml_text(x)
    xml_text(xml_children(x))

    x <- read_xml("<x>This is some text. <x>This is some nested text.</x></x>")
    xml_text(x)
    xml_text(xml_find_all(x, "//x"))

    x <- read_xml("<p>   Some text    </p>")
    xml_text(x, trim = TRUE)

[Package xml2 version 0.1.2 Index]