Failed to load external entity when using xmlTreeParse

When I tried to use xmlTreeParse function to parse xml document, I received an error message.

 url <- ""
 doc <- xmlTreeParse(url, useInternal=TRUE)

The XML package has had some issues with url arguments. A simple solution is to download the XML file to your computer and use the xmlTreeParse function to parse using the filename instead of the url.

download.file(url, destfile = "foo.xml")
doc <- xmlTreeParse("foo.xml", useInternal=TRUE)

Not able to resolve this issue, after downloading Xml file also getting same error.


fileurl1 <- “

download.file(fileurl1, destfile = “F://simple.xml”, method = “curl”
doc <- xmlTreeParse(“F://simple.xml”, useInternalNodes = TRUE)

Extra content at the end of the document
Error: 1: Extra content at the end of the document