SSIS 2017 Foreach Loop causing error with XML Source Data Flow

Tran, Frankie 21 Reputation points
2022-01-23T05:27:48.33+00:00

I have an issue when running a Data Flow task which extracts data from an XML Source.

I have set up the XML Source to use a variable (User::SourceFile)) as the source, and an XSD, modified slightly from the autogenerated version.

I have no issues executing the Data Flow task by itself, but I get the same error every time I try to execute the Foreach Loop Container that the Data Flow task resides in. The Foreach Loop is set to scan all the XML files in a folder, setting the User::SourceFile variable with each iteration. There is also a cleanup task in the container to move the processed file to an Archive location.

I get the same error messages, no matter what file is read:

**[XML Source [6]] Error: The XML Source was unable to process the XML data. The 'RESPONSE' start tag on line 515181 position 4 does not match the end tag of 'RES'. Line 515184, position 5.

[SSIS.Pipeline] Error: SSIS Error Code DTS_E_PRIMEOUTPUTFAILED. The PrimeOutput method on XML Source returned error code 0xC02092AF. The component returned a failure code when the pipeline engine called PrimeOutput(). The meaning of the failure code is defined by the component, but the error is fatal and the pipeline stopped executing. There may be error messages posted before this with more information about the failure.**

I don't believe there is an issue with the source file, as the first error would indicate, as the Data Flow runs fine when executed by itself. This error only occurs when trying to execute the Foreach Loop container.

SQL Server Integration Services
SQL Server Integration Services
A Microsoft platform for building enterprise-level data integration and data transformations solutions.
2,702 questions
0 comments No comments
{count} votes

Accepted answer
  1. Yitzhak Khabinsky 26,586 Reputation points
    2022-01-23T18:26:21.707+00:00

    Hi @Tran, Frankie ,

    [XML Source [6]] Error: The XML Source was unable to process the XML data. The 'RESPONSE' start tag on line 515181 position 4 does not match the end tag of 'RES'. Line 515184, position 5.

    This error means that the XML file in question is not well-formed. Or there is an issue with the XSD.

    Please attach to the question the following:

    • One of your XML files.
    • The XSD file.

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.