Unable to parse XML with XPATH and put it to Header with cHeader component

Six Stars

Unable to parse XML with XPATH and put it to Header with cHeader component

I would like to parse XML and put the value in the header. I am using cSetHeader for that.

This is how my XML looks like

<?xml version="1.0" ?>
<ORDER xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
	<HEAD>
		<DOC_STATUS>3</DOC_STATUS>
		<DOC_NO>9300983009</DOC_NO>
	</HEAD>
</ORDER>

and would like to set Header with XPATH(the expression: "/ORDER/HEAD/DOC_NO")

 

 

But in Header I get the value instead of 9300983009 I get something like ORDER_NO=com.sun.org.apache.xml.internal.dtm.ref.DTMNodeList@7ff63561}

 

How can I fix that?

 

My testing route looks like this:

Untitled2.png


Accepted Solutions
Nine Stars

Re: Unable to parse XML with XPATH and put it to Header with cHeader component

Hi,

 

Your result type is an object.

 

Could you try with:

"/ORDER/HEAD/DOC_NO", String.class

 

Capture.PNG

 

Eric


All Replies
Nine Stars

Re: Unable to parse XML with XPATH and put it to Header with cHeader component

Hi,

 

Your result type is an object.

 

Could you try with:

"/ORDER/HEAD/DOC_NO", String.class

 

Capture.PNG

 

Eric

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

An API-First Approach to Modernizing Applications

Learn how to use an API-First Approach to Modernize your Applications

Watch Now

Best Practices for Using Context Variables with Talend – Part 4

Pick up some tips and tricks with Context Variables

Blog

Talend API Designer – Technical Overview

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

Watch Now