-1

Rapid Minerで、xmlページからxpathを使用してデータを取得しようとしていますが、さまざまなステートメントを試しましたが、成功しませんでした。以下は、取得しようとしているデータです。順序付けされていないリストからすべての機能が必要です。

enter code here

<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 &amp; driveway</li>
</ul></div>
4

2 に答える 2

0

このデータをプルする方法やデータの送信先を実際に指定していませんが、おそらくこれが役立つでしょう。

サンプルの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 &amp; 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はデータをプルしようとしているノードの番号です。これがお役に立てば幸いです。

于 2013-03-07T04:45:52.347 に答える
0

文字列のシーケンスが必要だとすると、簡単な方法があります。

//li/string()

そして具体的な方法:

/div[@id='features']/ul/li/string()
于 2013-03-04T22:36:09.130 に答える