Response Of tRestClient as XML

Six Stars

Response Of tRestClient as XML

Hi all,

 

I am using trestclient to fetch my api.

 

this is data after fetch

 

 

<?xml version="1.0" encoding="UTF-8"?>
<query-response>
  <data-table count="1" filter="VISITID_QUERY">
    <columns>
      <column>Visit</column>
      <column>Line</column>
      <column>Vel Name</column>
      <column>Vel Class</column>
      <column>I/B yg</column>
      <column>O/B Vy</column>
      <column>Pse</column>
    </columns>
    <rows>
      <row primary-key="32116">
        <field>M02</field>
        <field>MK</field>
        <field>MKA</field>
        <field>A</field>
        <field>19</field>
        <field>02</field>
        <field>In</field>
      </row>
    </rows>
  </data-table>
</query-response>

 

i wanna use this data in other element for example i wanna take first field, how can use that ?

i tried use tXMLmap but the data show as string not XML 


Accepted Solutions
Seven Stars

Re: Response Of tRestClient as XML

Hi @Turki,

 

pass the xml response to textractXMLField component and give "/query-response/data-table/rows/row" in the loop Xquery path and "field" in the xpath query and in the XML field choose the column that has the xml string. output schema for the extactxml component would be the strings you want to extract from the response.

 

 


All Replies
Eight Stars

Re: Response Of tRestClient as XML

Put a tConvertType before your tXMLMap and convert String to Document

Eight Stars

Re: Response Of tRestClient as XML

Evansdar is right .

 

Here is the code snippet. 

 

 

RestXMLResponseHandling.jpg

Six Stars

Re: Response Of tRestClient as XML

Evansdar and Ashif thanks for reply.

Ok after convert how can I interactive with field?
for example I want to take first field "M02" from my response, How can I do that ?
Seven Stars

Re: Response Of tRestClient as XML

Hi @Turki,

 

pass the xml response to textractXMLField component and give "/query-response/data-table/rows/row" in the loop Xquery path and "field" in the xpath query and in the XML field choose the column that has the xml string. output schema for the extactxml component would be the strings you want to extract from the response.

 

 

What’s New for Talend Spring ’19

Watch the recorded webinar!

Watch Now

Tutorial

Introduction to Talend Open Studio for Data Integration.

Watch

Downloads and Trials

Test drive Talend's enterprise products.

Downloads

Definitive Guide to Data Integration

Practical steps to developing your data integration strategy.

Download