Options

extract information: parametric operetor

daddou20012daddou20012 Member Posts: 3 Contributor I
edited November 2018 in Help
I have a problem for extracting text from a document using the operator extract information, when I want to have parametric xpath that contains a call to a macro effect like this:
/ / *[@ class = 'contentheading' and contains (.,. +% {macro}. +)]

But this is not functional %{macro}Since runnig is not replaced by its value

any one can help  ??? :'(

thanks you in advance   :)

Answers

  • Options
    SkirzynskiSkirzynski Member Posts: 164 Maven
    Actually it works inside the query expression (see example below). Do not forget the quotes and take care that you expression is grammatically correct .

    <?xml version="1.0" encoding="UTF-8" standalone="no"?>
    <process version="5.3.009">
      <context>
        <input/>
        <output/>
        <macros>
          <macro>
            <key>this_is_from_a_macro</key>
            <value>class_from_macro</value>
          </macro>
        </macros>
      </context>
      <operator activated="true" class="process" compatibility="5.3.009" expanded="true" name="Process">
        <process expanded="true">
          <operator activated="true" class="text:create_document" compatibility="5.3.000" expanded="true" height="60" name="Create Document" width="90" x="45" y="30">
            <parameter key="text" value="&lt;!DOCTYPE html&gt;&#10;&lt;html&gt;&#10;&lt;body&gt;&#10;&#10;&lt;p class=&quot;class_from_macro&quot;&gt;Paragraph.&lt;/p&gt;&#10;&#10;&lt;/body&gt;&#10;&lt;/html&gt;"/>
          </operator>
          <operator activated="true" class="text:extract_information" compatibility="5.3.000" expanded="true" height="60" name="Extract Information" width="90" x="179" 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="x" value="//*[@class = &quot;%{this_is_from_a_macro}&quot;]"/>
            </list>
            <list key="namespaces"/>
            <list key="index_queries"/>
          </operator>
          <connect from_op="Create Document" from_port="output" to_op="Extract Information" to_port="document"/>
          <connect from_op="Extract Information" from_port="document" 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.