Reputation: 115
When I execute htmlTreeParser()
, I am getting this error:
Error in htmlTreeParse(webpage, error = function(...) { :
error in creating parser for
In addition: Warning message:
XML content does not seem to be XML: ''
Kindly someone help me to debug it.
library(RCurl)
library(XML)
theurl <- "http://www.forbes.com/powerful-brands/list/"
webpage <- getURL(theurl)
webpage <- readLines(tc <- textConnection(webpage)); close(tc)
pagetree <- htmlTreeParse(webpage, error=function(...){}, useInternalNodes = TRUE)
Upvotes: 0
Views: 473
Reputation: 70
The problem is clearly stated in the error message. The url you provided does not point directly to an XML page.
Try this:
theurl <- "https://www.forbes.com/powerful-brands/list/#tab:rank"
Upvotes: 1