Response Of tRestClient as XML

Highlighted
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
Eight 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 ?
Eight 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.

 

 

15TH OCTOBER, COUNTY HALL, LONDON

Join us at the Community Lounge.

Register Now

2019 GARNER MAGIC QUADRANT FOR DATA INTEGRATION TOOL

Talend named a Leader.

Get your copy

OPEN STUDIO FOR DATA INTEGRATION

Kickstart your first data integration and ETL projects.

Download now

What’s New for Talend Summer ’19

Watch the recorded webinar!

Watch Now

Talend API Designer – Technical Overview

Take a look at this technical overview video of Talend API Designer

Watch Now

Getting Started with APIs

Find out how to get started with APIs

Read