Just use function "htmlTreeParse" from XML
library(XML)
html <- htmlTreeParse("http://www.imd.gov.in/section/hydro/dynamic/rfmaps/weekrain.htm",
useInternalNodes = T)
xpathSApply(html, "//meta/@name")
But in your case you have another problem. The data which you want to access is located in html frame. Code below can help you to read these data:
library(XML)
library(RCulr)
url <- "http://www.imd.gov.in/section/hydro/dynamic/rfmaps/weekrain.htm"
html <- htmlTreeParse(url, useInternalNodes = T)
frameUrl <- paste("http://www.imd.gov.in/section/hydro/dynamic/rfmaps/",
xpathSApply(html, "//frame[1]/@src"),
sep = "")
htmlWithData = getURL(frameUrl,
httpheader = c("User-Agent" = "RCurl",
"Referer" = url))
dataXml <- htmlTreeParse(htmlWithData, isURL = F, useInternalNodes = T)
xpathSApply(dataXml, "//body/table")
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…