I'd like to do exactly what xml2::xml_text()
or rvest::html_text()
do but preserve the tags instead of replacing e.g. <br>
with \n
. The objective is to e.g. scrape a web page, extract the nodes I want, and store the plain HTML in a variable, much like write_html()
would store it in a file.
How can I do this?
xml2
, only without discarding the tags, or what another function does, only with output to another variable instead of an external file.xml2
and then get the output of specific parts as a raw, unparsed string?