[resolved] tExtractXMLField "the root element must be well-formed"

Four Stars

[resolved] tExtractXMLField "the root element must be well-formed"

Hi,
i have a simple XML-File, I read it with tFileInputXML, than one filed I want to extract with tExtractXMLField. The from tFileInputXML mapped variable contains:
<productidentifier>
        <b221>01</b221><b233>VLB_ID_old</b233><b244>3726602</b244></productidentifier><productidentifier>
        <b221>01</b221><b233>Publishers Order No</b233><b244>11199</b244></productidentifier><productidentifier>
        <b221>02</b221><b244>3866324502</b244></productidentifier><productidentifier>
        <b221>03</b221><b244>9783866324503</b244></productidentifier><productidentifier>
        <b221>15</b221><b244>9783866324503</b244></productidentifier>

in tExtractXMLField the Loop Xpath Query is "productidentifier". In this step the error 
Error on line 2 of document  : The markup in the document following the root element must be well-formed. Nested exception: The markup in the document following the root element must be well-formed. - Line: 4
occured.
But the XML-Snippet is wellformed. I'm a little bit helpless.

Accepted Solutions
Four Stars

Re: [resolved] tExtractXMLField "the root element must be well-formed"

The solution is:
<productidentifier>
       <b221>03</b221>
       <b244>9783866324503</b244>
   </productidentifier>

is really " not wellformed". I put an map-Component between the steps, and add an 
"<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?><message release=\"2.1\">" + row2.gtin + "</message>"

so the xml-snippet now is well formed, and the xpath query will work. 
Hope, this helps in other cases too.

All Replies
Four Stars

Re: [resolved] tExtractXMLField "the root element must be well-formed"

The solution is:
<productidentifier>
       <b221>03</b221>
       <b244>9783866324503</b244>
   </productidentifier>

is really " not wellformed". I put an map-Component between the steps, and add an 
"<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?><message release=\"2.1\">" + row2.gtin + "</message>"

so the xml-snippet now is well formed, and the xpath query will work. 
Hope, this helps in other cases too.

Calling Talend Open Studio Users

The first 100 community members completing the Open Studio survey win a $10 gift voucher.

Start the survey

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

Definitive Guide to Data Quality

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

Download