as_xml: as_xml

Description Usage Arguments Details Examples

View source: R/as_xml.R

Description

as_xml

Usage

1
2
3
as_xml(x, file = NULL, root = "eml", ns = "eml",
  schemaLocation = paste0("eml://ecoinformatics.org/",
  getOption("emld_db", "eml-2.2.0"), "/ eml.xsd"))

Arguments

x

an emld object

file

optional path to write out to file. Otherwise, defaults to NULL and will return an xml_document object.

root

name for the root node; default to 'eml'

ns

namespace abbreviation on root node, default 'eml'

schemaLocation

default to set schemaLocation if not already defined in emld object

Details

Unlike as_json, this function cannot rely on the existing convention of serializing a list to xml, eg, as defined by xml2::as_xml_document() Instead, this relies on a modified version, as_eml_document. In addition further steps must be taken when working with JSON-LD to deal with different possible framings and namespaces from the JSON-LD context element. Thus this 'as_xml' function is particular to EML and 'emld' objects alone.

Examples

1
2
3
f <- system.file("extdata/example.xml", package = "emld")
emld <- as_emld(f)
xml <- as_xml(emld)

cboettig/emljson documentation built on Dec. 6, 2018, 3:10 p.m.