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

Highlighted
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
Highlighted
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.

View solution in original post


All Replies
Highlighted
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.

View solution in original post

2019 GARTNER 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

Best Practices for Using Context Variables with Talend – Part 1

Learn how to do cool things with Context Variables

Blog

Migrate Data from one Database to another with one Job using the Dynamic Schema

Find out how to migrate from one database to another using the Dynamic schema

Blog

Best Practices for Using Context Variables with Talend – Part 4

Pick up some tips and tricks with Context Variables

Blog