Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

[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.
Labels (3)
1 Solution

Accepted Solutions
Anonymous
Not applicable
Author

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

1 Reply
Anonymous
Not applicable
Author

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.