xpath - R: Getting the value of an attribute -
i retrieve value of "position" attribute html.
here sample:
<message> <meta date="20150707" expired="false" lastmod="jul 08, 2015 08:00:03" matched="11" position="jul 07, 2015 19:25:05" sentdate="jul 07, 2015 19:25:05"> <pubdate>tue, 07 jul 2015 23:25:05 +0000</pubdate> <summary>summaryhere</summary> <title>titlehere</title> </meta> <keywords>keywordshere</keywords> <category>news</category> </message> i tried use code
date <- xpathsapply(data3,"//meta[@position]",xmlvalue) where data3 whole html source.
however, returns following
date [1] "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" [30] "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" any idea?
thanks!
you can use:
date <- xpathsapply(data3,"//meta[@position]", xmlgetattr, 'position')
Comments
Post a Comment