0

I use R to parse the xml https://d396qusza40orc.cloudfront.net/getdata%2Fdata%2Frestaurants.xml. This xml exists, but R remind me that it does not seem to be XML.

2 Answers 2

1

Try using http instead of https :

library(XML)
u <- "http://d396qusza40orc.cloudfront.net/getdata%2Fdata%2Frestaurants.xml"
doc <- xmlTreeParse(u, useInternalNodes = TRUE)
0
1

I had the same problem. I learnt that xmlTreeParse does not work with https. While the solution recommended by Grothendieck would work, sometimes you have to use https for added security, so if that is your situation then it is better to load the library RCurl and get the document using getURL. You can then parse it in XML. It worked for me as follows:

library(RCurl)
library(XML)
temp <- getURL("https://d396qusza40orc.cloudfront.net/getdata%2Fdata%2Frestaurants.xml")
doc <- xmlTreeParse(temp, useInternalNodes = TRUE)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.