Description Usage Arguments Value Examples
An XML generator DSL in R, inspired by Ruby's Nokogiri.
Compile an R expression into XML.
1 | rokogiri(expr, output_type = "xml", enclos = parent.frame())
|
expr |
expression. The R expression to compile to XML. |
output_type |
character. Either |
enclos |
environment. The enclosing environment to use for evaluating
variables mentioned in the XML generation process. By default,
|
a character string representing the compiled XML.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | xml <- rokogiri({
note({
to("Tove")
from("Jani")
heading("Reminder")
msg("Don't forget me this weekend!")
})
})
expected_xml <- "
<note>
<to>Tove</to>
<from>Jani</from>
<heading>Reminder</heading>
<msg>Don't forget me this weekend!</msg>
</note>
"
remove_spacing <- function(x) { gsub("[ \n]", "", x) }
stopifnot(remove_spacing(xml) == remove_spacing(expected_xml))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.