Parsing xml with multiple headers Talend

Six Stars

Parsing xml with multiple headers Talend

Hello community,

 

I'm trying to read xml data received from trestclient which have multiple header

Example :

<?xml version="1.0" encoding="utf-8"?>                         
 <RepeaterData>
<Version />
<Items>
    <Item>
        <year>2017</year>
        <Additional>
            <?xml version="1.0" encoding="utf-8"?>
            <RepeaterData>
                <Version />
                <Items>
                        <Name>toto</Nom>
                </Items>
            </RepeaterData>
        </AdditionalCharge>
    </Item>
    <Item>
        <year>2018</year>
        <Additional >
            <?xml version="1.0" encoding="utf-8"?>
            <RepeaterData>
                <Version />
                <Items>
                    <Item>
                        <element type="System.String">3</Sousdept>
                        <Name type="System.String">toto</Nom>
                        </Item>
                    <Item>
                        <element type="System.String">3</Sousdept>
                        <Name type="System.String">tata</Nom>
                        </Item>
                </Items>
            </RepeaterData>
        </Additional>
    </Item>
</Items>

 

I tried also to delete the xml header with StringHandling.EREPLACE ( b ,"<?xml version=1.0 encoding=utf-8?>",""); but it's not working

Help please !!!!

Forteen Stars

Re: Parsing xml with multiple headers Talend

You have a lot of errors in this XML

and additional header is only part of many

You need seriously debug structure with proper XML tools, as variant - Oxygen or Altova (or similar)

-----------
Six Stars

Re: Parsing xml with multiple headers Talend

@vapukov OK for Xml errors but how to parse an XML with two headers with Talend ? ( this Xml i get it from a TRestClient )

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

Best Practices for Using Context Variables with Talend – Part 4

Pick up some tips and tricks with Context Variables

Blog

How Media Organizations Achieved Success with Data Integration

Learn how media organizations have achieved success with Data Integration

Read

Tutorial

Introduction to Talend Open Studio for Data Integration.

Watch