I am trying to get the contents of href
using Xpath code as described in these two posts. Unfortunately the code is returning the actual text "href" and several spaces in addition to the URL. How can I avoid that?
library(XML)
html <- readLines("http://www.msu.edu")
html.parse <- htmlParse(html)
Node <- getNodeSet(html.parse, "//div[@id='MSU-top-utilities']//a/@href")
Node[[1]]
# > Node[[1]]
# href
# "students/index.html"
# attr(,"class")
# [1] "XMLAttributeValue"