mclm_xml_text {mclm}R Documentation

Get text from xml node

Description

Get text from xml node

Usage

mclm_xml_text(node, trim = FALSE)

Arguments

node

XML node as read with xml2::read_xml().

trim

If TRUE will trim leading and trailing spaces.

Value

Character vector: The text value of the (elements of the) node, concatenated with spaces in between.

Examples

test_xml <- '
<p>
  <w pos="at">The</w>
  <w pos="nn">example</w>
  <punct>.</punct>
</p>'

test_xml_parsed <- xml2::read_xml(test_xml)

# xml2 output
xml2::xml_text(test_xml_parsed)

# mclm version
mclm_xml_text(test_xml_parsed)

[Package mclm version 0.2.7 Index]