darwin_as_xml: Construct simple darwin core

View source: R/darwin_as_xml.R

darwin_as_xmlR Documentation

Construct simple darwin core

Description

Construct simple darwin core

Usage

darwin_as_xml(x)

Arguments

x

an object of class darwin_simple, the output from the function darwin_simple()

Value

an xml_document

Examples

library(xml2)
# just dublin core
out <- darwin_simple(type = "PhysicalObject", 
  modified = "2009-02-12", language = "en")
out
xml <- darwin_as_xml(out)
xml_structure(xml)
write_xml(xml, (f <- tempfile(fileext=".xml")))

# add some darwin core
out <- darwin_simple(basisOfRecord = "PreservedSpecimen", 
  taxonID = "12345", scientificName = "Poa annua")
out
xml <- darwin_as_xml(out)
xml_structure(xml)
write_xml(xml, (f <- tempfile(fileext=".xml")))

# together
out <- darwin_simple(type = "PhysicalObject", 
  modified = "2009-02-12", language = "en", 
  basisOfRecord = "PreservedSpecimen", taxonID = "12345", 
  scientificName = "Poa annua")
out
xml <- darwin_as_xml(out)
xml_structure(xml)
write_xml(xml, (f <- tempfile(fileext=".xml")))

ropenscilabs/taxadc documentation built on May 17, 2022, 5:34 p.m.