R's XML package has an xmlToList function, but does not have the reverse, is there a function for R that will convert a list to an XML object?
I would like something like
listToXML(list('a'))
that returns
<a></a>
but the closest I can find is
library(XML)
xmlNode(list('a'))
which returns
</a>
help on this question, and understanding the conversion of R objects to XML in general appreciated (the XML package appears more focused on the use of R to read XML, with less support for creating XML).
Update... One reason that I could not figure this out is because I did not realize that the trailing '/' in <node/> indicates an empty node, equivalent to <node></node>
x = newXMLNode("bob"); addChildren(x, newXMLNode("el", "Red", "Blue", "Green", attrs = c(lang ="en")))does what you're looking for?<node/>=<node></node>and thereby better understand how the XML package works.