Search code examples
character-encodingxsdbiztalkflat-file

Disassemble a flatfile with BizTalk, when record contains nulls


An external partner will be sending us comma-separated files containing purchase orders, which we need to process in our BizTalk environment. I will be using BizTalk's flatfile disassembler to transform the csv data into workable xml.

However, many of the records in our partner's files have null values for certain 'columns' (e.g. not all address fields have a value). Upon disassembly by BizTalk using the flatfile xsd (created with the wizard in Visual Studio), the resulting xml contains elements like this:

<ShipToAddress2>&#x0;</ShipToAddress2>

And our subsequent mappings fails with

System.Xml.XmlException: '.', hexadecimal value 0x00, is an invalid character.

In what way can I eliminate this error? Is there a property in the flatfile xsd, or a setting in the disassember in which I can set the behaviour for handling null values in the data?


Solution

  • If the relevant fields don't already have a padding character set, you can use that to strip the zero characters during disassembly.

    For every field that requires it first set the Pad Character Type to Hexadecimal, then Pad Character to 0x00.

    Visual Studio setting