doc <- xmlTreeParse(system.file("exampleData", "job.xml", package="XML"))
xmlNamespace(xmlRoot(doc))
xmlNamespace(xmlRoot(doc)[[1]][[1]])
doc <- xmlInternalTreeParse(system.file("exampleData", "job.xml", package="XML"))
# Since the first node, xmlRoot() will skip that, by default.
xmlNamespace(xmlRoot(doc))
xmlNamespace(xmlRoot(doc)[[1]][[1]])
node <- xmlNode("arg", xmlNode("name", "foo"), namespace="R")
xmlNamespace(node)
doc = xmlParse('a = 1:10')
node = xmlRoot(doc)[[1]][[1]]
xmlNamespace(node) = "r"
node
doc = xmlParse('a = 1:10')
node = xmlRoot(doc)[[1]][[1]]
xmlNamespaces(node, set = TRUE) = c(omg = "https://www.omegahat.net")
node
Run the code above in your browser using DataLab