Marshalling of 'xml2' objects

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

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

# S3 method for xml_document
marshallable(...)

# S3 method for xml_nodeset
marshallable(...)

Arguments

xml2

A xml2::xml_document or similar.

...

Not used.

Value

A marshalled object as described in marshal().

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.

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))
}