Hitachi Vantara Pentaho Community Forums
Results 1 to 4 of 4

Thread: Pentaho escaping characters

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    May 2013
    Posts
    4

    Default Pentaho escaping characters

    Hi everybody, I'm totally new at Pentaho and I'm having some problems with my first project. Basically, I have an xml input and I want to generate an xml output, so I've created a transformation and added a "Get data from XML" component, a "Modified Java Script Value", and a "XML Output"; the input component just reads the XML file, in the Java Script step I created a variable to hold the xml content of the file and also I read some values on it (the function's code is at the bottom) and the XML Output just generates the file. The problem is that the generated xml escapes all the "<" and ">" symbols; I've tried adding a "Replace in String" component and specifying the symbols to replace (&lt; by < and &gt; by >) but nothing happened, does anybody have some tip?
    This is the javascript code:
    Code:
    var xml;
    if (xml==null) {
     xml = new XML();
     var xml =<docs>
     <cases-doc>
      <marginal>
       <marginal-yea>{parteactora_pub}</marginal-yea>
       <marginal-num/>
      </marginal>
     </cases-doc>
    </docs>;
    }
    And this is what I get:

    <docs>
    &lt;cases-doc&gt;
    &lt;marginal&gt;
    &lt;marginal-yea&gt;Yonhy Lescano Ancieta&lt;/marginal-yea&gt;
    &lt;marginal-num/&gt;
    &lt;/marginal&gt;
    &lt;/cases-doc&gt;
    </docs>

    Any help will be appreciated, regards

  2. #2
    Join Date
    Jun 2012
    Posts
    5,534

    Default

    Compare your output to a MJSV step preview.
    How did you produce the XML escaped output, anyway?
    Attached Files Attached Files
    So long, and thanks for all the fish.

  3. #3
    Join Date
    May 2013
    Posts
    4

    Default

    Hi @marabu, thanks for your response, it works with the "Generate Rows" step so I appreciate your help, but when I run the transformation I don't get the real values of the variables, just the ones specified in the "Generate Rows" step, so for example if I put "123456" as value of "parteactora_pub" in the definition of the step, that's what I get, no matter if the real value is 654321, so how can I read the values? Thanks again for your help with my problem.

  4. #4
    Join Date
    Jun 2012
    Posts
    5,534

    Default

    In your transformation you would replace the Generate Rows step with some other step, e.g. Get Data From XML.
    So long, and thanks for all the fish.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Privacy Policy | Legal Notices | Safe Harbor Privacy Policy

Copyright © 2005 - 2019 Hitachi Vantara Corporation. All Rights Reserved.