xmlOutputBuffer(dtd=NULL, nameSpace=NULL, buf=NULL, nsURI=NULL, header="<?xml version=\"1.0\"?>") xmlOutputDOM(tag="doc", attrs = NULL, dtd=NULL, nameSpace=NULL, nsURI=character(0))
xmlOuputDOM
, this is a named character vector with each
element giving the name space identifier and the
corresponding URI,
e.g
c(shelp = "http://www.omegahat.org/XML/SHelp")
These functions create a list of functions that, when attached as a frame, can operate on shared data used to represent the contents of the XML document being created and the current state of that creation.
XMLNode
object
into the currently active (i.e. open) node. There are also helper
functions
addComment
,
addPI
, and
addCData
for adding these types of nodes.
xmlOutputDOM
object
in order to use it to generate DOM objects.
Only one xmlOutputDOM or xmlOutputBuffer object can be active (attached) at a time. When you activate/attach a new object, you may lose the information you had built up in the previously attached object. Calling the xmlEventHandler function automatically activates/attaches its xmlOutputDOM object; with the other functions, you must first call the function, and then attach the object.
Duncan Temple Lang
http://www.omegahat.org/RSXML, http://www.w3.org/xml
con <- xmlOutputDOM() attach.DOM(con) con$reset() con$addTag("author", "Duncan Temple Lang") con$addTag("address", close=FALSE) con$addTag("office", "2C-259") con$addTag("street", "Mountain Avenue.") con$addTag("phone", close=FALSE) con$addTag("area", "908", attrs=c(state="NJ")) con$addTag("number", "582-3217") con$closeTag() # phone con$closeTag() # address con$addTag("section", close=FALSE) con$addNode(xmlTextNode("This is some text ")) con$addTag("a","and a link", attrs=c(href="http://www.omegahat.org")) con$addNode(xmlTextNode("and some follow up text")) con$addTag("subsection", close=FALSE) con$addNode(xmlTextNode("some addtional text ")) con$addTag("a", attrs=c(href="http://www.omegahat.org"), close=FALSE) con$addNode(xmlTextNode("the content of the link")) con$closeTag() # a con$closeTag() # "subsection" con$closeTag() # section print(con$value()) detach.DOM() b <- xmlOutputBuffer() attach.DOM(b) b$reset() b$addTag("doc", close=F) b$addPI("S", "plot(1:10)") b$addCData('x <- list(1, a="&");\nx[[2]]') b$closeTag() cat(b$value()) detach.DOM()