"what's wrong with my Generate Attribute?"

User: "cindyharper"
New Altair Community Member
Updated by Jocelyn
I get  Syntax Error:
An operator failed to generate a macro, attribute or other object which is calculated on the fly.
My XML text entries (in InstitutionName or macroGoogleQuery) have CRLFs in them - could that be the problem? How do I filter out the \r and \n's?

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<process version="5.2.003">
  <context>
    <input/>
    <output/>
    <macros/>
  </context>
  <operator activated="true" class="process" compatibility="5.2.003" expanded="true" name="Process">
    <parameter key="logverbosity" value="all"/>
    <parameter key="logfile" value="C:\Users\charper\Documents\Rapid-I\GetPagesLog.txt"/>
    <parameter key="resultfile" value="C:\Users\charper\Documents\Rapid-I\ExampleSet1.csv"/>
    <parameter key="encoding" value="UTF-8"/>
    <process expanded="true" height="428" width="547">
      <operator activated="true" class="read_xml" compatibility="5.2.003" expanded="true" height="60" name="Read XML" width="90" x="45" y="30">
        <parameter key="file" value="C:\Users\charper\Documents\ALiNBUS\libwebcatsout-20120303.xml"/>
        <parameter key="xpath_for_examples" value="//html/Institution"/>
        <enumeration key="xpaths_for_attributes">
          <parameter key="xpath_for_attribute" value="InstitutionName[1]/text()"/>
          <parameter key="xpath_for_attribute" value="Row[1]/attribute::rownum"/>
          <parameter key="xpath_for_attribute" value="LibraryName[1]/text()"/>
          <parameter key="xpath_for_attribute" value="Location[1]/text()"/>
          <parameter key="xpath_for_attribute" value="Consortium[1]/text()"/>
          <parameter key="xpath_for_attribute" value="website[1]/text()"/>
          <parameter key="xpath_for_attribute" value="catalog[1]/text()"/>
          <parameter key="xpath_for_attribute" value="CatalogVendor[1]/text()"/>
        </enumeration>
        <list key="namespaces">
          <parameter key="xsi" value="http://www.w3.org/2001/XMLSchema-instance"/>
        </list>
        <parameter key="use_default_namespace" value="false"/>
        <list key="annotations"/>
        <list key="data_set_meta_data_information">
          <parameter key="0" value="InstitutionName[1]/text().true.polynominal.attribute"/>
          <parameter key="1" value="Row[1]/attribute::rownum.true.integer.attribute"/>
          <parameter key="2" value="LibraryName[1]/text().true.text.attribute"/>
          <parameter key="3" value="Location[1]/text().true.polynominal.attribute"/>
          <parameter key="4" value="Consortium[1]/text().true.polynominal.attribute"/>
          <parameter key="5" value="website[1]/text().true.text.attribute"/>
          <parameter key="6" value="catalog[1]/text().true.text.attribute"/>
          <parameter key="7" value="CatalogVendor[1]/text().true.polynominal.attribute"/>
        </list>
      </operator>
      <operator activated="true" class="loop_examples" compatibility="5.2.003" expanded="true" height="76" name="Loop Examples" width="90" x="179" y="30">
        <process expanded="true" height="446" width="557">
          <operator activated="true" class="extract_macro" compatibility="5.2.003" expanded="true" height="60" name="Extract Macro" width="90" x="45" y="30">
            <parameter key="macro" value="macroGoogleQuery"/>
            <parameter key="macro_type" value="data_value"/>
            <parameter key="attribute_name" value="InstitutionName[1]/text()"/>
            <parameter key="example_index" value="1"/>
          </operator>
          <operator activated="true" class="generate_attributes" compatibility="5.2.003" expanded="true" height="76" name="Generate Attributes" width="90" x="380" y="210">
            <list key="function_descriptions">
              <parameter key="urlGoogleQuery" value="&quot;http://www.google.com/search?q=&quot; + replaceAll(&quot;%{macroGoogleQuery}&quot;,&quot;\n&quot;,&quot;+&quot;)"/>
            </list>
            <parameter key="use_standard_constants" value="false"/>
          </operator>
          <connect from_port="example set" to_op="Extract Macro" to_port="example set"/>
          <connect from_op="Extract Macro" from_port="example set" to_op="Generate Attributes" to_port="example set input"/>
          <connect from_op="Generate Attributes" from_port="example set output" to_port="example set"/>
          <portSpacing port="source_example set" spacing="0"/>
          <portSpacing port="sink_example set" spacing="0"/>
          <portSpacing port="sink_output 1" spacing="0"/>
        </process>
      </operator>
      <connect from_op="Read XML" from_port="output" to_op="Loop Examples" to_port="example set"/>
      <connect from_op="Loop Examples" 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>

Find more posts tagged with