fileName <- system.file("exampleData", "test.xml", package="XML") 
 doc <- xmlTreeParse(fileName)
 xmlName(xmlRoot(doc)[[1]])
 tt = xmlRoot(doc)[[1]]
 xmlName(tt)
 xmlName(tt) <- "bob"
  # We can set the node on an internal object also.
 n = newXMLNode("x")
 xmlName(n)
 xmlName(n) <- "y"
 
 xmlName(n) <- "r:y"
Run the code above in your browser using DataLab