我是repidminer的新手,对于一个学术项目,我试图从论坛帖子中提取文本信息,例如http://www.tripadvisor.com/ShowTopic-g29220-i86-k1487815-Alamo-Maui_Hawaii.html
我已经尝试了很多并提出了XPath查询:// div [@class =' postBody'] / p [not(*)] [text()]
在谷歌文档中可以正常工作,但在快速制作者中没有。
编辑: 对不起,但你的询问问题并不是快速的问题。看我的快速过程:
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<process version="5.3.015">
<context>
<input/>
<output/>
<macros/>
</context>
<operator activated="true" class="process" compatibility="5.3.015" expanded="true" name="Process">
<process expanded="true">
<operator activated="true" class="web:get_webpage" compatibility="5.3.001" expanded="true" height="60" name="Get Page" width="90" x="45" y="75">
<parameter key="url" value="http://www.tripadvisor.com/ShowTopic-g29220-i86-k1487815-Alamo-Maui_Hawaii.html"/>
<parameter key="random_user_agent" value="true"/>
<list key="query_parameters"/>
<list key="request_properties"/>
</operator>
<operator activated="true" class="text:process_documents" compatibility="5.3.002" expanded="true" height="94" name="Process Documents" width="90" x="380" y="30">
<process expanded="true">
<operator activated="true" class="text:extract_information" compatibility="5.3.002" expanded="true" height="60" name="Extract Information" width="90" x="45" y="30">
<parameter key="query_type" value="XPath"/>
<list key="string_machting_queries"/>
<list key="regular_expression_queries"/>
<list key="regular_region_queries"/>
<list key="xpath_queries">
<parameter key="xpath1" value="//div[@class='postBody']"/>
<parameter key="xpath2" value="//div[@class='postBody']/text()"/>
<parameter key="xpath3" value="//div[@class='postBody']/p[not(*)][text()]"/>
</list>
<list key="namespaces"/>
<list key="index_queries"/>
</operator>
<connect from_port="document" to_op="Extract Information" to_port="document"/>
<connect from_op="Extract Information" from_port="document" to_port="document 1"/>
<portSpacing port="source_document" spacing="0"/>
<portSpacing port="sink_document 1" spacing="0"/>
<portSpacing port="sink_document 2" spacing="0"/>
</process>
</operator>
<connect from_op="Get Page" from_port="output" to_op="Process Documents" to_port="documents 1"/>
<connect from_op="Process Documents" from_port="example set" to_port="result 1"/>
<portSpacing port="source_input 1" spacing="0"/>
<portSpacing port="sink_result 1" spacing="0"/>
<portSpacing port="sink_result 2" spacing="0"/>
</process>
</operator>
</process>
还有其他想法吗?
答案 0 :(得分:0)
如果您想获得整个帖子内容,请尝试:
//div[@class='postBody']
或:
//div[@class='postBody']/text()
而不是:
//div[@class='postBody']/p[not(*)][text()]
答案 1 :(得分:0)
您必须将h:
放在div
和p
节点名称前面。
所以xpath3将是
//h:div[@class='postBody']/h:p[not(*)][text()]