xml_serialize: Serializing XML objects to connections.

Description Usage Arguments Value Examples

View source: R/xml_serialize.R

Description

Serializing XML objects to connections.

Usage

1
2
3

Arguments

object

R object to serialize.

connection

an open connection or (for serialize) NULL or (for unserialize) a raw vector (see ‘Details’).

...

Additional arguments passed to read_xml.

Value

For serialize, NULL unless connection = NULL, when the result is returned in a raw vector.

For unserialize an R object.

Examples

1
2
3
4
5
6
7
8
9
library(xml2)
x <- read_xml("<a>
  <b><c>123</c></b>
  <b><c>456</c></b>
</a>")

b <- xml_find_all(x, "//b")
out <- xml_serialize(b, NULL)
xml_unserialize(out)

Example output

{xml_nodeset (2)}
[1] <b>\n  <c>123</c>\n</b>
[2] <b>\n  <c>456</c>\n</b>

xml2 documentation built on Jan. 24, 2018, 5:21 p.m.