您并没有真正指定您需要如何提取这些数据或它的去向,但也许这会有所帮助:
我将您的示例 xml 保存如下:
<?xml version="1.0" encoding="utf-8" ?>
<div id="features">
<h3>Features:</h3>
<ul><li>Front garden</li>
<li>Rear Large Shed</li>
<li>Superb condition and tastefully decorated</li>
<li>Energy Efficent with a B2 Ber rating</li>
<li>Gravel & driveway</li>
</ul></div>
然后,我创建了以下 RapidMiner 进程,该进程将每个列表元素作为单独的属性提取:
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<process version="5.3.005">
<context>
<input/>
<output/>
<macros/>
</context>
<operator activated="true" class="process" compatibility="5.3.005" expanded="true" name="Process">
<process expanded="true">
<operator activated="true" class="read_xml" compatibility="5.3.005" expanded="true" height="60" name="Read XML" width="90" x="112" y="165">
<parameter key="file" value="path/to/Test.xml"/>
<parameter key="xpath_for_examples" value="//h3"/>
<enumeration key="xpaths_for_attributes">
<parameter key="xpath_for_attribute" value="//li[1]/text()"/>
<parameter key="xpath_for_attribute" value="//li[2]/text()"/>
<parameter key="xpath_for_attribute" value="//li[3]/text()"/>
<parameter key="xpath_for_attribute" value="//li[4]/text()"/>
<parameter key="xpath_for_attribute" value="//li[5]/text()"/>
</enumeration>
<list key="namespaces"/>
<parameter key="use_default_namespace" value="false"/>
<list key="annotations"/>
<list key="data_set_meta_data_information"/>
</operator>
<connect from_op="Read XML" from_port="output" 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>
我认为您要查找的 XPATH 查询是“//li[n]/text()”,其中 n 是您尝试从中提取数据的节点的编号。我希望这有帮助!