Marshalling of 'XML' objects

# 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.

Value

A marshalled object as described in marshal().

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.

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))
}
#> <a>
#>   <b>c</b>
#> </a> 
#> <a>
#>   <b>c</b>
#> </a>