f = system.file("exampleData", "catalog.xml", package = "XML")
doc = xmlInternalTreeParse(f)
docName(doc)
doc = xmlInternalTreeParse("<a><b/></a>", asText = TRUE)
# an NA
docName(doc)
docName(doc) = "Simple XML example"
docName(doc)
Run the code above in your browser using DataLab