https://github.com/cran/XML
Tip revision: 4290c36165416096276efc099b90aebd5514e32c authored by CRAN Team on 03 October 2022, 07:46:01 UTC
version 3.99-0.11
version 3.99-0.11
Tip revision: 4290c36
xmlRoot.R
setGeneric("xmlRoot<-",
function(x, ..., value)
standardGeneric("xmlRoot<-"))
setMethod("xmlRoot<-", c("XMLInternalDocument", value = "character"),
function(x, ..., value)
{
newXMLNode(value, doc = x)
x
})
setMethod("xmlRoot<-", c("XMLInternalDocument", value = "XMLInternalNode"),
function(x, ..., value)
{
#XXX check that this does the reference counting correctly
# specifically, d = newXMLDoc(); xmlRoot(d) = "bar"; xmlRoot(d) = newXMLNode("foo")
.Call("RS_XML_setRootNode", x, value, PACKAGE = "XML")
x
})
setMethod("xmlRoot<-", "XMLHashTree",
function(x, ..., value)
{
x$.addNode(value)
x
})