Accessors for name of XML document
docName.RdThese functions and methods allow us to query and set the “name” of an XML document. This is intended to be its URL or file name or a description of its origin if raw XML content provided as a string.
Value
A character string giving the name.
If the document was created from text, this is NA
(of class character).
The assignment function returns the updated object, but the R assignment operation will return the value on the right of the assignment!
Examples
f = system.file("exampleData", "catalog.xml", package = "XML")
doc = xmlInternalTreeParse(f)
docName(doc)
#> [1] "/tmp/Rtmpl3iivm/temp_libpath3330db5194e430/XML/exampleData/catalog.xml"
doc = xmlInternalTreeParse("<a><b/></a>", asText = TRUE)
# an NA
docName(doc)
#> [1] NA
docName(doc) = "Simple XML example"
docName(doc)
#> [1] "Simple XML example"