BizTalk平面文件模式 - 文件标头和页脚,但没有记录
我正在处理一个平坦的文件,该文件具有标记和管道定界标题,位置主体记录和位置页脚,
H|20220601|XXXX
CONTENT FIELD 1 CONTENT FIELD 2 CONTENT FIELD 3
CONTENT FIELD 1 CONTENT FIELD 2 CONTENT FIELD 3
F00001234
我遇到了问题:摆脱此错误:
原因:寻找流的意外结束: 位置数据(长度为x) 当前正在解析的定义是记录。发生错误的流偏移量为xx。发生误差的线号为3。发生误差的列为0。
当我获得一个空文件时,例如:
H|20220601|XXXX
F00001234
这是我的平面文件架构
<xs:element name="Root">
<xs:annotation>
<xs:appinfo>
<b:recordInfo suppress_trailing_delimiters="false" preserve_delimiter_for_empty_data="true" sequence_number="1" child_order="postfix" child_delimiter="0xD 0xA" child_delimiter_type="hex" structure="delimited"/>
</xs:appinfo>
</xs:annotation>
<xs:complexType>
<xs:sequence>
<xs:annotation>
<xs:appinfo>
<groupInfo xmlns="http://schemas.microsoft.com/BizTalk/2003" sequence_number="0"/>
</xs:appinfo>
</xs:annotation>
<xs:element name="Header" maxOccurs="1" minOccurs="1">
<xs:annotation>
<xs:appinfo>
<b:recordInfo suppress_trailing_delimiters="false" preserve_delimiter_for_empty_data="true" sequence_number="1" child_order="infix" child_delimiter="/" child_delimiter_type="char" structure="delimited" tag_name="H"/>
</xs:appinfo>
</xs:annotation>
<xs:complexType>
[...]
</xs:complexType>
</xs:element>
<xs:element name="Records" maxOccurs="unbounded" minOccurs="0" nillable="true">
<xs:annotation>
<xs:appinfo>
<b:recordInfo suppress_trailing_delimiters="false" preserve_delimiter_for_empty_data="true" sequence_number="2" structure="positional"/>
</xs:appinfo>
</xs:annotation>
<xs:complexType>
[...]
</xs:complexType>
</xs:element>
<xs:element name="Footers" maxOccurs="1" minOccurs="1">
<xs:annotation>
<xs:appinfo>
<b:recordInfo suppress_trailing_delimiters="false" preserve_delimiter_for_empty_data="true" sequence_number="3" structure="positional" tag_name="F" tag_offset="0"/>
</xs:appinfo>
</xs:annotation>
<xs:complexType>
[...]
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
试图将记录设置为minoccurrs
= 0和<代码> nillable ,但错误仍然存在。在这种情况下,如何获取管道来处理没有记录的文件?
I'm dealing with a flat file that has a tagged and pipe delimited header, positional body records, and a positional footer
H|20220601|XXXX
CONTENT FIELD 1 CONTENT FIELD 2 CONTENT FIELD 3
CONTENT FIELD 1 CONTENT FIELD 2 CONTENT FIELD 3
F00001234
I'm having an issue getting rid of this error:
Reason: Unexpected end of stream while looking for:
Positional data (length is X)
The current definition being parsed is Records. The stream offset where the error occured is XX. The line number where the error occured is 3. The column where the error occured is 0.
when I get an empty file like:
H|20220601|XXXX
F00001234
This is my flat file schema
<xs:element name="Root">
<xs:annotation>
<xs:appinfo>
<b:recordInfo suppress_trailing_delimiters="false" preserve_delimiter_for_empty_data="true" sequence_number="1" child_order="postfix" child_delimiter="0xD 0xA" child_delimiter_type="hex" structure="delimited"/>
</xs:appinfo>
</xs:annotation>
<xs:complexType>
<xs:sequence>
<xs:annotation>
<xs:appinfo>
<groupInfo xmlns="http://schemas.microsoft.com/BizTalk/2003" sequence_number="0"/>
</xs:appinfo>
</xs:annotation>
<xs:element name="Header" maxOccurs="1" minOccurs="1">
<xs:annotation>
<xs:appinfo>
<b:recordInfo suppress_trailing_delimiters="false" preserve_delimiter_for_empty_data="true" sequence_number="1" child_order="infix" child_delimiter="/" child_delimiter_type="char" structure="delimited" tag_name="H"/>
</xs:appinfo>
</xs:annotation>
<xs:complexType>
[...]
</xs:complexType>
</xs:element>
<xs:element name="Records" maxOccurs="unbounded" minOccurs="0" nillable="true">
<xs:annotation>
<xs:appinfo>
<b:recordInfo suppress_trailing_delimiters="false" preserve_delimiter_for_empty_data="true" sequence_number="2" structure="positional"/>
</xs:appinfo>
</xs:annotation>
<xs:complexType>
[...]
</xs:complexType>
</xs:element>
<xs:element name="Footers" maxOccurs="1" minOccurs="1">
<xs:annotation>
<xs:appinfo>
<b:recordInfo suppress_trailing_delimiters="false" preserve_delimiter_for_empty_data="true" sequence_number="3" structure="positional" tag_name="F" tag_offset="0"/>
</xs:appinfo>
</xs:annotation>
<xs:complexType>
[...]
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
Tried setting the records to minoccurrs
= 0 and nillable
, but error persists. How can I get the pipeline to handle a file with no records in this case?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果您的行没有标签,并且您有其他记录,请更改模式属性,将解析器优化从速度到复杂性。
原因是因为该行没有标签,因此很难识别行何时结束。
将其设置为复杂性执行以下操作
解析模式(learn..microsoft.com)。
If your lines do not have a tag, and you have other records following, then change the Schema properties, Parser Optimisation from Speed to Complexity.
The reason for this is because the line doesn't have a tag, it has trouble recognising when the lines end.
Setting it to Complexity does the following
Parsing Modes (learn.microsoft.com).