Options

xpath

denhojerdenhojer Member Posts: 10 Contributor II
edited November 2018 in Help
Hi al
In rapid miner i am trying to take data using xpath from an xml page, i have tried a number of different statements listed below but no success.
  • //li/string()
  • //li/text()
  • /div[@id='features']/ul/li/string()
  • /div[@id='features']/ul/li/text()
   
Below is the data that im trying to retrieve, i want all the features from the un-ordered list.

<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>
I would be greatful if somebody help me out with my problem.
Thanks.

Answers

  • Options
    SkirzynskiSkirzynski Member Posts: 164 Maven
    Here is the configuration of the "Read XML" operator which works for the data you have posted:

    <?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="45" y="30">
            <parameter key="file" value="/home/marcin/temp/forum.xml"/>
            <parameter key="xpath_for_examples" value="//div[@id='features']/ul/li"/>
            <enumeration key="xpaths_for_attributes">
              <parameter key="xpath_for_attribute" value="text()"/>
            </enumeration>
            <list key="namespaces"/>
            <parameter key="use_default_namespace" value="false"/>
            <list key="annotations"/>
            <list key="data_set_meta_data_information">
              <parameter key="0" value="Attribute.true.polynominal.attribute"/>
            </list>
          </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>
Sign In or Register to comment.