GN


I have a package that opens an XML file and stores the XML to a variable. Then the package executes a stored procedure passing the variable containing the XML data. This package had been working perfectly until I applied service pack 2 to SQL Server. Now when I execute the package I get an error when the stored procedure attempts to exeucte. The error is: "XML parsing: line 615, character 11, illegal xml character". The strange thing is that I can run profiler and copy out the command that is being executed and paste it into a query window and it exeuctes successfully in the query window. So does anyone know what changed with service pack two that is causing this problem and/or how to resolve it

The position that the error message is referring to is the last character in the xml variable that the package is passing to the stored procedure. What I find strange is that it throws an error when called from the package but not when executed in the query window. Any help would be greatly appreciated. Below is a copy of the command from profiler that is throwing the error:

exec sp_executesql N'EXEC dbo.ABF_UpdateBillerList @P1, @P2',N'@P1 nvarchar(max),@P2 datetime',N' <billers>
<biller Key="8958">
<billerFieldUpdates effDate="2007-06-06">
<acdind>D</acdind>
</billerFieldUpdates>
<addresses>
<address Key="26741">
<addressFieldUpdates effDate="2007-06-06">
<acdind>D</acdind>
</addressFieldUpdates>
</address>
<address Key="26742">
<addressFieldUpdates effDate="2007-06-06">
<acdind>D</acdind>
</addressFieldUpdates>
</address>
<address Key="33073">
<addressFieldUpdates effDate="2007-06-06">
<acdind>D</acdind>
</addressFieldUpdates>
</address>
<address Key="33074">
<addressFieldUpdates effDate="2007-06-06">
<acdind>D</acdind>
</addressFieldUpdates>
</address>
</addresses>
<masks>
<mask Key="218293">
<maskFieldUpdates effDate="2007-06-06">
<acdind>D</acdind>
</maskFieldUpdates>
</mask>
<mask Key="218888">
<maskFieldUpdates effDate="2007-06-06">
<acdind>D</acdind>
</maskFieldUpdates>
</mask>
</masks>
<akas>
<aka Key="13159">
<akaFieldUpdates effDate="2007-06-06">
<acdind>D</acdind>
</akaFieldUpdates>
</aka>
<aka Key="13160">
<akaFieldUpdates effDate="2007-06-06">
<acdind>D</acdind>
</akaFieldUpdates>
</aka>
<aka Key="13161">
<akaFieldUpdates effDate="2007-06-06">
<acdind>D</acdind>
</akaFieldUpdates>
</aka>
<aka Key="16948">
<akaFieldUpdates effDate="2007-06-06">
<acdind>D</acdind>
</akaFieldUpdates>
</aka>
</akas>
<contacts>
<contact Key="26740">
<contactFieldUpdates effDate="2007-06-06">
<acdind>D</acdind>
</contactFieldUpdates>
<phones>
<phone Key="16411">
<phoneFieldUpdates effDate="2007-06-06">
<acdind>D</acdind>
</phoneFieldUpdates>
</phone>
<phone Key="16412">
<phoneFieldUpdates effDate="2007-06-06">
<acdind>D</acdind>
</phoneFieldUpdates>
</phone>
</phones>
</contact>
</contacts>
</biller>
<biller Key="5136">
<billerFieldUpdates effDate="2007-06-07">
<acdind>C</acdind>
<billerNoteCurrent>State Farm Insurance is accepting payments electronically for auto, life, fire and health premium payments. Verify the premium account number matches one of the masks AND one of the addresses listed. Send all Paper Payments to: P. O. Box 588002, North Metro, GA 30029-8002, they may be addressed to State Farm Insurance or State Farm Insurance Support Center or Insurance Support Center</billerNoteCurrent>
<billerNotePrior>State Farm Insurance is accepting payments electronically for auto, life, fire and health premium payments. Verify the premium account number matches one of the masks AND one of the addresses listed. Send all Paper Payments to: P. O. Box 588002, North Metro, GA 30028-8002, they may be addressed to State Farm Insurance or State Farm Insurance Support Center or Insurance Support Center</billerNotePrior>
</billerFieldUpdates>
</biller>
<biller Key="8820">
<masks>
<mask Key="229786">
<maskFieldUpdates effDate="2007-06-11">
<acdind>A</acdind>
<maskFormatCurrent>560100##########</maskFormatCurrent>
<maskLengthCurrent>16</maskLengthCurrent>
</maskFieldUpdates>
</mask>
<mask Key="229787">
<maskFieldUpdates effDate="2007-06-11">
<acdind>A</acdind>
<maskFormatCurrent>570105##########</maskFormatCurrent>
<maskLengthCurrent>16</maskLengthCurrent>
</maskFieldUpdates>
</mask>
<mask Key="229788">
<maskFieldUpdates effDate="2007-06-11">
<acdind>A</acdind>
<maskFormatCurrent>570106##########</maskFormatCurrent>
<maskLengthCurrent>16</maskLengthCurrent>
</maskFieldUpdates>
</mask>
<mask Key="229789">
<maskFieldUpdates effDate="2007-06-11">
<acdind>A</acdind>
<maskFormatCurrent>580100##########</maskFormatCurrent>
<maskLengthCurrent>16</maskLengthCurrent>
</maskFieldUpdates>
</mask>
</masks>
</biller>
<biller Key="9494">
<addresses>
<address Key="37164">
<addressFieldUpdates effDate="2007-06-11">
<acdind>A</acdind>
<address1Current>PO Box 1087</address1Current>
<cityCurrent>Norwich </cityCurrent>
<typeCurrent>Standard</typeCurrent>
<countryCurrent>USA</countryCurrent>
<stateCurrent>CT</stateCurrent>
<postalCodeCurrent>06360-1087</postalCodeCurrent>
</addressFieldUpdates>
</address>
</addresses>
<akas>
<aka Key="20439">
<akaFieldUpdates effDate="2007-06-11">
<acdind>A</acdind>
<nameCurrent>Norwich Dept of Public Utilities</nameCurrent>
</akaFieldUpdates>
</aka>
</akas>
</biller>
<biller Key="7572">
<masks>
<mask Key="229757">
<maskFieldUpdates effDate="2007-06-11">
<acdind>A</acdind>
<maskFormatCurrent>5########</maskFormatCurrent>
<maskLengthCurrent>9</maskLengthCurrent>
</maskFieldUpdates>
</mask>
</masks>
</biller>
<biller Key="8844">
<addresses>
<address Key="26200">
<addressFieldUpdates effDate="2007-06-11">
<acdind>C</acdind>
<postalCodeCurrent>07101-0197</postalCodeCurrent>
<postalCodePrior>07101</postalCodePrior>
</addressFieldUpdates>
</address>
<address Key="26201">
<addressFieldUpdates effDate="2007-06-11">
<acdind>C</acdind>
<postalCodeCurrent>90030-0179</postalCodeCurrent>
<postalCodePrior>90030</postalCodePrior>
</addressFieldUpdates>
</address>
<address Key="37112">
<addressFieldUpdates effDate="2007-06-11">
<acdind>A</acdind>
<address1Current>PO Box 7835</address1Current>
<cityCurrent>Edison</cityCurrent>
<typeCurrent>Standard</typeCurrent>
<countryCurrent>USA</countryCurrent>
<stateCurrent>NJ</stateCurrent>
<postalCodeCurrent>08818-7835</postalCodeCurrent>
</addressFieldUpdates>
</address>
<address Key="37113">
<addressFieldUpdates effDate="2007-06-11">
<acdind>A</acdind>
<address1Current>PO Box 54228</address1Current>
<cityCurrent>Los Angeles</cityCurrent>
<typeCurrent>Standard</typeCurrent>
<countryCurrent>USA</countryCurrent>
<stateCurrent>CA</stateCurrent>
<postalCodeCurrent>90054-0228</postalCodeCurrent>
</addressFieldUpdates>
</address>
<address Key="37114">
<addressFieldUpdates effDate="2007-06-11">
<acdind>A</acdind>
<address1Current>PO Box 11731</address1Current>
<cityCurrent>Newark</cityCurrent>
<typeCurrent>Standard</typeCurrent>
<countryCurrent>USA</countryCurrent>
<stateCurrent>NJ</stateCurrent>
<postalCodeCurrent>07101-4731</postalCodeCurrent>
</addressFieldUpdates>
</address>
</addresses>
<akas>
<aka Key="20435">
<akaFieldUpdates effDate="2007-06-11">
<acdind>A</acdind>
<nameCurrent>First Investors - SMART</nameCurrent>
</akaFieldUpdates>
</aka>
<aka Key="20436">
<akaFieldUpdates effDate="2007-06-11">
<acdind>A</acdind>
<nameCurrent>First Investors Federal - Smart</nameCurrent>
</akaFieldUpdates>
</aka>
</akas>
<contacts>
<contact Key="26199">
<contactFieldUpdates effDate="2007-06-11">
<acdind>C</acdind>
<stateCurrent />
<statePrior>NJ</statePrior>
<emailCurrent>billersupport@orcc.com</emailCurrent>
<emailPrior>billersupport@princetonecom.com</emailPrior>
<organizationCurrent>Online Resources</organizationCurrent>
<organizationPrior>Princeton eCom</organizationPrior>
</contactFieldUpdates>
<phones>
<phone Key="16180">
<phoneFieldUpdates effDate="2007-06-11">
<acdind>D</acdind>
</phoneFieldUpdates>
</phone>
<phone Key="19346">
<phoneFieldUpdates effDate="2007-06-11">
<acdind>A</acdind>
<phoneNumCurrent>609-606-3370</phoneNumCurrent>
<phoneTypeCurrent>Phone</phoneTypeCurrent>
</phoneFieldUpdates>
</phone>
</phones>
</contact>
</contacts>
</biller>
<biller Key="3956">
<masks>
<mask Key="123272">
<maskFieldUpdates effDate="2007-06-06">
<acdind>A</acdind>
<maskFormatCurrent>601921##########</maskFormatCurrent>
<maskLengthCurrent>16</maskLengthCurrent>
</maskFieldUpdates>
</mask>
<mask Key="123912">
<maskFieldUpdates effDate="2007-06-06">
<acdind>A</acdind>
<maskFormatCurrent>601918##########</maskFormatCurrent>
<maskLengthCurrent>16</maskLengthCurrent>
</maskFieldUpdates>
</mask>
<mask Key="229658">
<maskFieldUpdates effDate="2007-06-06">
<acdind>A</acdind>
<maskFormatCurrent>601916##########</maskFormatCurrent>
<maskLengthCurrent>16</maskLengthCurrent>
</maskFieldUpdates>
</mask>
<mask Key="229659">
<maskFieldUpdates effDate="2007-06-06">
<acdind>A</acdind>
<maskFormatCurrent>603464##########</maskFormatCurrent>
<maskLengthCurrent>16</maskLengthCurrent>
</maskFieldUpdates>
</mask>
</masks>
</biller>
<biller Key="8215">
<addresses>
<address Key="20880">
<addressFieldUpdates effDate="2007-06-11">
<acdind>C</acdind>
<postalCodeCurrent>19355-1114</postalCodeCurrent>
<postalCodePrior>19355</postalCodePrior>
</addressFieldUpdates>
</address>
<address Key="20885">
<addressFieldUpdates effDate="2007-06-11">
<acdind>C</acdind>
<postalCodeCurrent>19493-0001</postalCodeCurrent>
<postalCodePrior>19493</postalCodePrior>
</addressFieldUpdates>
</address>
</addresses>
<akas>
<aka Key="19477">
<akaFieldUpdates effDate="2007-06-11">
<acdind>A</acdind>
<nameCurrent>Transamerica Life Insurance Company</nameCurrent>
</akaFieldUpdates>
</aka>
<aka Key="19478">
<akaFieldUpdates effDate="2007-06-11">
<acdind>A</acdind>
<nameCurrent>TLIC</nameCurrent>
</akaFieldUpdates>
</aka>
</akas>
</biller>
<biller Key="7450">
<billerFieldUpdates effDate="2007-06-05">
<acdind>D</acdind>
</billerFieldUpdates>
<addresses>
<address Key="31492">
<addressFieldUpdates effDate="2007-06-05">
<acdind>D</acdind>
</addressFieldUpdates>
</address>
</addresses>
<contacts>
<contact Key="31491">
<contactFieldUpdates effDate="2007-06-05">
<acdind>D</acdind>
</contactFieldUpdates>
<phones>
<phone Key="17309">
<phoneFieldUpdates effDate="2007-06-05">
<acdind>D</acdind>
</phoneFieldUpdates>
</phone>
</phones>
</contact>
</contacts>
</biller>
<biller Key="8169">
<akas>
<aka Key="20419">
<akaFieldUpdates effDate="2007-06-11">
<acdind>A</acdind>
<nameCurrent>GLICO CO.</nameCurrent>
</akaFieldUpdates>
</aka>
<aka Key="20420">
<akaFieldUpdates effDate="2007-06-11">
<acdind>A</acdind>
<nameCurrent>Genworth Life Insurance Co.</nameCurrent>
</akaFieldUpdates>
</aka>
<aka Key="20421">
<akaFieldUpdates effDate="2007-06-11">
<acdind>A</acdind>
<nameCurrent>GLIC LTC</nameCurrent>
</akaFieldUpdates>
</aka>
<aka Key="20422">
<akaFieldUpdates effDate="2007-06-11">
<acdind>A</acdind>
<nameCurrent>Genworth Long Term Care</nameCurrent>
</akaFieldUpdates>
</aka>
<aka Key="20423">
<akaFieldUpdates effDate="2007-06-11">
<acdind>A</acdind>
<nameCurrent>Genworth LTC</nameCurrent>
</akaFieldUpdates>
</aka>
<aka Key="20424">
<akaFieldUpdates effDate="2007-06-11">
<acdind>A</acdind>
<nameCurrent>GLAIC Co.</nameCurrent>
</akaFieldUpdates>
</aka>
<aka Key="20425">
<akaFieldUpdates effDate="2007-06-11">
<acdind>A</acdind>
<nameCurrent>Genworth Life and Annuity Insurance Company</nameCurrent>
</akaFieldUpdates>
</aka>
<aka Key="20426">
<akaFieldUpdates effDate="2007-06-11">
<acdind>A</acdind>
<nameCurrent>Genworth Life and Annuity Insurance Co.</nameCurrent>
</akaFieldUpdates>
</aka>
<aka Key="20427">
<akaFieldUpdates effDate="2007-06-11">
<acdind>A</acdind>
<nameCurrent>GLAIC LTC</nameCurrent>
</akaFieldUpdates>
</aka>
<aka Key="20428">
<akaFieldUpdates effDate="2007-06-11">
<acdind>A</acdind>
<nameCurrent>Metlife, CO.</nameCurrent>
</akaFieldUpdates>
</aka>
<aka Key="20429">
<akaFieldUpdates effDate="2007-06-11">
<acdind>A</acdind>
<nameCurrent>Metlife Insurance Co of Connecticut</nameCurrent>
</akaFieldUpdates>
</aka>
<aka Key="20430">
<akaFieldUpdates effDate="2007-06-11">
<acdind>A</acdind>
<nameCurrent>MIC</nameCurrent>
</akaFieldUpdates>
</aka>
<aka Key="20431">
<akaFieldUpdates effDate="2007-06-11">
<acdind>A</acdind>
<nameCurrent>Metlife Ins Co of CT</nameCurrent>
</akaFieldUpdates>
</aka>
<aka Key="20432">
<akaFieldUpdates effDate="2007-06-11">
<acdind>A</acdind>
<nameCurrent>GLICNY CO.</nameCurrent>
</akaFieldUpdates>
</aka>
<aka Key="20433">
<akaFieldUpdates effDate="2007-06-11">
<acdind>A</acdind>
<nameCurrent>Genworth Life Insurance Co of New York</nameCurrent>
</akaFieldUpdates>
</aka>
<aka Key="20434">
<akaFieldUpdates effDate="2007-06-11">
<acdind>A</acdind>
<nameCurrent>GLICNY LTC</nameCurrent>
</akaFieldUpdates>
</aka>
</akas>
</biller>
<biller Key="9983">
<addresses>
<address Key="37075">
<addressFieldUpdates effDate="2007-06-07">
<acdind>A</acdind>
<address1Current>PO Box 1335</address1Current>
<cityCurrent>Buffalo</cityCurrent>
<typeCurrent>Standard</typeCurrent>
<countryCurrent>USA</countryCurrent>
<stateCurrent>NY</stateCurrent>
<postalCodeCurrent>14240-1335</postalCodeCurrent>
</addressFieldUpdates>
</address>
</addresses>
<masks>
<mask Key="229671">
<maskFieldUpdates effDate="2007-06-07">
<acdind>A</acdind>
<maskFormatCurrent>##############</maskFormatCurrent>
<maskLengthCurrent>14</maskLengthCurrent>
</maskFieldUpdates>
</mask>
<mask Key="229672">
<maskFieldUpdates effDate="2007-06-07">
<acdind>A</acdind>
<maskFormatCurrent>###############</maskFormatCurrent>
<maskLengthCurrent>15</maskLengthCurrent>
</maskFieldUpdates>
</mask>
<mask Key="229673">
<maskFieldUpdates effDate="2007-06-07">
<acdind>A</acdind>
<maskFormatCurrent>##################</maskFormatCurrent>
<maskLengthCurrent>18</maskLengthCurrent>
</maskFieldUpdates>
</mask>
<mask Key="229674">
<maskFieldUpdates effDate="2007-06-07">
<acdind>A</acdind>
<maskFormatCurrent>####-####</maskFormatCurrent>
<maskLengthCurrent>9</maskLengthCurrent>
</maskFieldUpdates>
</mask>
<mask Key="229675">
<maskFieldUpdates effDate="2007-06-07">
<acdind>A</acdind>
<maskFormatCurrent>###-####</maskFormatCurrent>
<maskLengthCurrent>8</maskLengthCurrent>
</maskFieldUpdates>
</mask>
</masks>
<akas>
<aka Key="20380">
<akaFieldUpdates effDate="2007-06-07">
<acdind>A</acdind>
<nameCurrent>Creditor Interchange</nameCurrent>
</akaFieldUpdates>
</aka>
<aka Key="20381">
<akaFieldUpdates effDate="2007-06-07">
<acdind>A</acdind>
<nameCurrent>Creditors Exchange</nameCurrent>
</akaFieldUpdates>
</aka>
</akas>
</biller>
<biller Key="1767">
<addresses>
<address Key="5189">
<addressFieldUpdates effDate="2007-06-06">
<acdind>C</acdind>
<postalCodeCurrent>50704-0780</postalCodeCurrent>
<postalCodePrior>50704-0788</postalCodePrior>
</addressFieldUpdates>
</address>
</addresses>
</biller>
<biller Key="1770">
<addresses>
<address Key="37073">
<addressFieldUpdates effDate="2007-06-07">
<acdind>A</acdind>
<address1Current>1001 Fannin St. STE 4000</address1Current>
<cityCurrent>Houston</cityCurrent>
<typeCurrent>Standard</typeCurrent>
<countryCurrent>USA</countryCurrent>
<stateCurrent>TX</stateCurrent>
<postalCodeCurrent>77002-6711</postalCodeCurrent>
</addressFieldUpdates>
</address>
</addresses>
</biller>
<biller Key="10101">
<addresses>
<address Key="36672">
<addressFieldUpdates effDate="2007-06-11">
<acdind>C</acdind>
<postalCodeCurrent>15250-7877</postalCodeCurrent>
<postalCodePrior>15250-0877</postalCodePrior>
</addressFieldUpdates>
</address>
</addresses>
</biller>
<biller Key="8957">
<billerFieldUpdates effDate="2007-06-06">
<acdind>D</acdind>
</billerFieldUpdates>
<addresses>
<address Key="26738">
<addressFieldUpdates effDate="2007-06-06">
<acdind>D</acdind>
</addressFieldUpdates>
</address>
<address Key="26739">
<addressFieldUpdates effDate="2007-06-06">
<acdind>D</acdind>
</addressFieldUpdates>
</address>
<address Key="33071">
<addressFieldUpdates effDate="2007-06-06">
<acdind>D</acdind>
</addressFieldUpdates>
</address>
<address Key="33072">
<addressFieldUpdates effDate="2007-06-06">
<acdind>D</acdind>
</addressFieldUpdates>
</address>
</addresses>
<masks>
<mask Key="218292">
<maskFieldUpdates effDate="2007-06-06">
<acdind>D</acdind>
</maskFieldUpdates>
</mask>
<mask Key="218887">
<maskFieldUpdates effDate="2007-06-06">
<acdind>D</acdind>
</maskFieldUpdates>
</mask>
</masks>
<akas>
<aka Key="13157">
<akaFieldUpdates effDate="2007-06-06">
<acdind>D</acdind>
</akaFieldUpdates>
</aka>
<aka Key="13158">
<akaFieldUpdates effDate="2007-06-06">
<acdind>D</acdind>
</akaFieldUpdates>
</aka>
<aka Key="16947">
<akaFieldUpdates effDate="2007-06-06">
<acdind>D</acdind>
</akaFieldUpdates>
</aka>
</akas>
<contacts>
<contact Key="26737">
<contactFieldUpdates effDate="2007-06-06">
<acdind>D</acdind>
</contactFieldUpdates>
<phones>
<phone Key="16409">
<phoneFieldUpdates effDate="2007-06-06">
<acdind>D</acdind>
</phoneFieldUpdates>
</phone>
<phone Key="16410">
<phoneFieldUpdates effDate="2007-06-06">
<acdind>D</acdind>
</phoneFieldUpdates>
</phone>
</phones>
</contact>
</contacts>
</biller>
</billers> ','2007-06-05 00:00:00:000'

Thanks!

gn




Re: XML Parsing Error in Package Execution

Jamie Thomson


Hi,

Can you post your stored procedure as well

[Microsoft follow-up] This sounds like a potential bug.

-Jamie







Re: XML Parsing Error in Package Execution

Denise Draper - MSFT

Often strange XML errors result from encoding issues. I don't know if that is the case here, but it might be. Try adding the following XML declaration to the top of your XML string and see if that fixes things:

< xml encoding=¡±utf-16¡± version=¡±1.0¡± >

If it doesn't, then this probably is a bug.






Re: XML Parsing Error in Package Execution

Matt Masson - MSFT

I believe this issue is being caused by the size of your input string. IIRC, an nvarchar field is limited to 4000 characters in our OLEDB provider (or perhaps it's in SQL Server itself). Anything bigger than that, and the field has to be treated as nvarchar(max). Unfortunately, the Execute SQL Task doesn't support this mapping. There is currently a lightweight improvement open for this, and it will be reviewed for Katmai.

This 4000 character limit for strings appears in multiple places in the product. You can see a related connect issue here.

I believe you can get around this problem by switching to using the ADO.Net provider instead. Here are the settings I used on the Execute SQL Task for this to work:

ConnectionType: ADO.NET

SQLStatement: dbo.ABF_UpdateBillerList

IsQueryStoredProcedure: True

On the parameter mapping tab, use @P1, @P2 ... as the parameter names.

You can refer to the Book Online Entry for more info about how to setup the mappings for ADO.NET.

Hope that helps,

~Matt






Re: XML Parsing Error in Package Execution

GN

Thanks! I did figure out that if I changed to using the ADO.Net provider then I could map my input parameter as an xml data type and eliminate the error.