Parsing xml with multiple headers Talend

Five 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 !!!!

Tags (1)
Thirteen 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)

-----------
Five 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 )

Tutorial

Introduction to Talend Open Studio for Data Integration.

Definitive Guide to Data Integration

Practical steps to developing your data integration strategy.

Definitive Guide to Data Quality

Create systems and workflow to manage clean data ingestion and data transformation.