【发布时间】:2015-03-03 18:44:50
【问题描述】:
我正在尝试从以下内容部分中提取文本。
<meta itemprop="datePublished" content="2015-02-24T11:34:57Z"/>
<meta itemprop="description" content="South Africa's gross domestic output
(GDP) expanded by a much stronger 4.1 percent in the fourth quarter"/>
我对从“datePublished”和“description”中提取时间和日期特别感兴趣。现在有趣的是我可以提取“描述”文本,使用
xpathSApply(story2, "//head/meta[@name=\"description\"]/@content")
但不是datePublished,即使我使用的语法相同,只产生NULL 结果。
我无法解释这一点,想知道是否有人知道为什么xpathSApply 在提取描述时不提取datePublished,以及正确的格式是什么。我也无法通过 grep 使用子字符串操作来提取它。
【问题讨论】: