marshal.XML: Marshalling of 'XML' objects

marshal.XMLAbstractNodeR Documentation

Marshalling of 'XML' objects

Description

Marshalling of 'XML' objects

Usage

## S3 method for class 'XMLAbstractNode'
marshal(xml, ...)

## S3 method for class 'XMLAbstractDocument'
marshal(xml, ...)

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

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

Arguments

xml

An XML::XMLAbstractNode or XML::XMLAbstractDocument.

...

Not used.

Details

XML::xmlSerializeHook() is used to produce a marshalled version of the original object. XML::xmlDeserializeHook() 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("XML", quietly = TRUE)) {
  node <- XML::xmlParseString("<a><b>c</b></a>")
  print(node)
  
  ## Marshal XMLAbstractNode object
  node_ <- marshal(node)
  ## Unmarshal XMLAbstractNode object
  node2 <- unmarshal(node_)
  print(node2)
  
  stopifnot(all.equal(node2, node))
  
  
  doc <- XML::xmlParse(system.file("exampleData", "tides.xml", package = "XML"))
  
  ## Marshal XMLAbstractDocument object
  doc_ <- marshal(doc)
  ## Unmarshal XMLAbstractDocument object
  doc2 <- unmarshal(doc_)
  
  stopifnot(all.equal(doc2, doc))
}

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