0

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)

1 Answer 1

1

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"
Sign up to request clarification or add additional context in comments.

1 Comment

Didn't show an error when I just ran it (after correcting the lack of quotes.

Your Answer

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.