xmlOutputBuffer
and xmlOutputDOM
but that uses the internal structures of
libxml.
This can be used to create a DOM that can be
constructed in R and exported to another system
such as XSLT (xmlTree(tag, attrs = NULL, dtd=NULL, namespaces=list())
newXMLDoc
c(shelp = "http://www.omegahat.org/XML/SHelp")
XMLInternalDOM
that extends XMLOutputStream
and has the same interface (i.e. ``methods'') as
xmlOutputBuffer
and xmlOutputDOM
.
Each object has methods for
adding a new XML tag,
closing a tag, adding an XML comment,
and retrieving the contents of the tree.saveXML
to serialize the
contents of the tree.saveXML
newXMLDoc
newXMLNode
xmlOutputBuffer
xmlOutputDOM
tr <- xmlTree("Duncan")
tr$addTag("name", attrs=c(a=1,b="xyz"), close=FALSE)
tr$addTag("first", "Larry")
tr$addTag("last", "User")
tr$closeTag()
tr$value()
cat(saveXML(tr$value()))
tr <- xmlTree("CDataTest")
tr$addTag("top", close=FALSE)
tr$addCData("x <- list(1, a='&');
x[[2]]")
tr$addPI("S", "plot(1:10)")
tr$closeTag()
cat(saveXML(tr$value()))
Run the code above in your browser using DataLab