File: as_xml_document.Rd

package info (click to toggle)
r-cran-xml2 1.4.1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 976 kB
  • sloc: cpp: 1,826; xml: 333; javascript: 238; ansic: 178; sh: 71; makefile: 6
file content (32 lines) | stat: -rw-r--r-- 953 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/as_xml_document.R
\name{as_xml_document}
\alias{as_xml_document}
\title{Coerce a R list to xml nodes.}
\usage{
as_xml_document(x, ...)
}
\arguments{
\item{x}{A document, node, or node set.}

\item{...}{Needed for compatibility with generic. Unused.}
}
\description{
This turns an R list into the equivalent XML document. Not all R lists will
produce valid XML, in particular there can only be one root node and all
child nodes need to be named (or empty) lists. R attributes become XML
attributes and R names become XML node names.
}
\examples{
as_xml_document(list(x = list()))

# Nesting multiple nodes
as_xml_document(list(foo = list(bar = list(baz = list()))))

# attributes are stored as R attributes
as_xml_document(list(foo = structure(list(), id = "a")))
as_xml_document(list(foo = list(
  bar = structure(list(), id = "a"),
  bar = structure(list(), id = "b")
)))
}