我提出这个要求:
http://en.wikipedia.org/w/api.php?format=xml&action=query&titles=self-administration&prop=revisions&rvprop=content&rvparse=&rvsection=0我的目标是从一篇文章的介绍中获得纯文本。
它给出了XML文件中的一些HTML。在strip_tags和preg_replace,删除引用之后,我得到以下内容:
在医学意义上,自我管理是一个主体向他、她或其自身服用一种药理学物质的过程。..。引号错误:此页上有标记,但如果没有{{Reflist}模板或标记,引用将不会显示;请参阅帮助页。
我想移除
引号错误:此页上有标记,但如果没有{{Reflist}模板或标记,引用将不会显示;请参阅帮助页。
我怎样才能使用php (preg_replace?)或者在我最初的查询中(忽略错误?)。
发布于 2012-12-30 21:47:38
$bad = ' <br /><strong class="error">Cite error: There are <code><ref></code> tags on this page, but the references will not show without a <code>{{Reflist}}</code> template or a <code><references /></code> tag; see the <a href="/wiki/Help:Cite_errors/Cite_error_refs_without_references" title="Help:Cite errors/Cite error refs without references">help page</a>.</strong> ';
$good = str_replace($bad, '', $intro);https://stackoverflow.com/questions/14094911
复制相似问题