Home > Enterprise >  Talend trest extractXMLField path
Talend trest extractXMLField path

Time:03-24

I am trying to extract data from an API that setup like the below pic. I am only trying to extract the logs data. How would I go about Mapping on tExtractJsonFields. I keep getting Trying to output non-whitespace characters outside main element tree (in prolog or epilog) error

{<?xml version="1.0" encoding="UTF-8"?><root><status>success</status>
  <data>
     <story>
          <ID>BL0492PE</ID>
          <name>Atlas</name>
          <type>assessment</type>
          <app>
              <ID>pioneer</ID>
              <name>PS</name>
              <version>2.9.7</version>
          </app>
      </story>
     <logs>
       <firstname>Jan</firstname>  
       <lastname>Doe</lastname>
         <country>********</country>
       <city>********</city>
 <status>
 <complete>true</complete>
   <updated>2021-10-25T13:04:45 02:00</updated>
     </status>
  </logs>
    <logs>
       <firstname>Peter</firstname>  
       <lastname>Pan</lastname>
         <country>********</country>
       <city>********</city>
 <status>
 <complete>true</complete>
   <updated>2021-10-25T13:04:45 02:00</updated>
     </status>
  </logs></data><hash>1fda</hash><response_time>0.22277402877807617</response_time></root>}

enter image description here

CodePudding user response:

Your "xpath Query" expressions does not seem correct, if I refer to the screenshot of your actual XML. It seems that you have inverted Column and XpathQuery.

Also, you won't access "complete" with this expression, you'll need to use "./status/complete".

To access logs directly, either use "//logs" or "/root/logs".

CodePudding user response:

I was also suppose to select Body instead of string on tExtractXMLField xml field. Thank you

  • Related