BizTalk Flat File Schema-如何接受LF或CRLF作为行定界符 [英] BizTalk Flat File Schema - how to accept a LF or CRLF as the line delimiter

查看:103
本文介绍了BizTalk Flat File Schema-如何接受LF或CRLF作为行定界符的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们的客户向我们发送了一个平面文件作为输入,然后我们将其接收并转换为XML文件,然后再发送至目标系统.

Our client sends us a flat file as input, which we then take and convert to an XML file before sending to the destination system.

平面文件包含多行,每行由LF或CRLF分隔.

The flat file consists of multiple lines, each line is delimited by LF or CRLF.

如何创建平面文件架构,以便BizTalk能够解释每行数据,而不管该行是由LF(0x0A)还是由CRLF(0x0D 0x0A)分隔?

How do I create a Flat File Schema so that BizTalk can interpret each line of data regardless of whether the line was delimited by LF (0x0A) or CRLF (0x0D 0x0A)?

推荐答案

问题已解决.这是万一其他人想知道的解决方案:

Problem solved. Here is the solution in case anyone else is wondering:

由于LF和CRLF都共享LF字符,因此我将行定界符设置为LF(0x0A).这对于提取完整记录是正确的(带有副作用,当CRLF是分隔符时,末尾会有一个额外的CR字符).

Since LF and CRLF both share the LF character, I set the line delimiter as LF (0x0A). This works correctly for extracting the full records (with the side effect of having one extra CR character at the end when CRLF is the delimiter).

可以使用伪字段吸收CR字符或使用映射来摆脱多余的CR字符.

One can get rid of the extra CR character using a dummy field to absorb the CR character or by using a map.

请注意,由于LF和CRLF分隔符的长度不同(分别为1个字符和2个字符),因此我不得不对模式进行更多更改,以确保正确处理两者.

Notice that since the LF and CRLF delimiters have different lengths (1 and 2 characters respectively), I had to do a couple more changes to the schema to ensure that both are handled correctly.

在我的场景中,每个已解析的行记录都包含8个位置字段,因此,由于Biztalk期望最后一个字段具有一定的长度而不考虑额外的CR,因此结尾处有一个额外的CR字符会导致错误特点.解决方案是将第8个字段(在我的情况下为Filler字段)的长度增加1.但是,为了仍然能够处理LF行定界符,请确保设置'Allow Early终止" 标志设置为TRUE.这样,如果最后一个字段比其分配的长度短1个字符(如果不包括CR字符),则不会引发任何错误.

In my scenario, each line record that was parsed contains 8 positional fields, so having an extra CR character at the end resulted in an error due to Biztalk expecting a certain length for the last field that does not account for the additional CR character. The solution is to increase the length of the 8th field (which is a Filler field in my case) by 1. However, in order to still be able to handle the LF line delimiters, make sure you set the 'Allow Early Termination' flag to TRUE. This way no errors are thrown if the last field is 1 character short of its assigned length (if the CR character was not included).

这篇关于BizTalk Flat File Schema-如何接受LF或CRLF作为行定界符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆