如何读取下面网页中的表格?
http://www.china-customs.com/customs-tax/04/
使用下面代码,无法读取,请教:如何修改代码?谢谢!
一开始检查,webpage的内容还没乱码,但是后面就乱码了!
而且最后,读取的不是表格!不知道问题在哪里!
link <- c( "http://www.china-customs.com/customs-tax/04/ )
require(XML)
require(RCurl)
webpage<-getURL(link,.encoding="gb2312")
webpage <- readLines(tc <- textConnection(webpage),encoding='gb2312'); close(tc)
tablehead <- xpathSApply(pagetree, "//table//th", xmlValue)
result<-xpathSApply(pagetree,"//table//td",xmlValue)