marshal.xml2: Marshalling of 'xml2' objects

marshal.xml_documentR Documentation

Marshalling of 'xml2' objects

Description

Marshalling of 'xml2' objects

Usage

## S3 method for class 'xml_document'
marshal(xml2, ...)

## S3 method for class 'xml_nodeset'
marshal(xml2, ...)

## S3 method for class 'xml_document'
marshallable(...)

## S3 method for class 'xml_nodeset'
marshallable(...)

Arguments

xml2

A xml2::xml_document or similar.

...

Not used.

Details

xml2::xml_serialize() is used to produce a marshalled version of the original object. xml2::xml_unserialize() is used to reconstruct a version of the original object from the marshalled object.

Value

A marshalled object as described in marshal().

Examples

if (requireNamespace("xml2", quietly = TRUE)) {
  doc <- xml2::read_xml("<body></body>")

  ## Marshal 'xml_document' object
  doc_ <- marshal(doc)

  ## Unmarshal 'xml_document' object
  doc2 <- unmarshal(doc_)

  stopifnot(all.equal(doc2, doc))
}

HenrikBengtsson/marshal documentation built on June 11, 2024, 11:35 a.m.