我正在使用 BizTalk 平面文件架构来处理 CSV 文件。我的架构基本上如下所示:
<?xml version="1.0" encoding="utf-16"?>
<xs:schema xmlns="http://My.Namespace.For.Schema" xmlns:b="http://schemas.microsoft.com/BizTalk/2003" targetNamespace="http://My.Namespace.For.Schema" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:annotation>
<xs:appinfo>
<schemaEditorExtension:schemaInfo namespaceAlias="b" extensionClass="Microsoft.BizTalk.FlatFileExtension.FlatFileExtension" standardName="Flat File" xmlns:schemaEditorExtension="http://schemas.microsoft.com/BizTalk/2003/SchemaEditorExtensions" />
<b:schemaInfo standard="Flat File" codepage="65001" default_pad_char=" " pad_char_type="char" count_positions_by_byte="false" parser_optimization="speed" lookahead_depth="3" suppress_empty_nodes="false" generate_empty_nodes="true" allow_early_termination="false" early_terminate_optional_fields="false" allow_message_breakup_of_infix_root="false" compile_parse_tables="false" root_reference="MyFile" />
</xs:appinfo>
</xs:annotation>
<xs:element name="MyFile">
<xs:annotation>
<xs:appinfo>
<b:recordInfo structure="delimited" child_delimiter_type="hex" child_delimiter="0x0D 0x0A" child_order="postfix" sequence_number="1" preserve_delimiter_for_empty_data="true" suppress_trailing_delimiters="false" rootTypeName="MyFile" />
</xs:appinfo>
</xs:annotation>
<xs:complexType>
<xs:sequence>
<xs:annotation>
<xs:appinfo>
<groupInfo sequence_number="0" xmlns="http://schemas.microsoft.com/BizTalk/2003" />
</xs:appinfo>
</xs:annotation>
<xs:element maxOccurs="unbounded" name="MasEdiAuditRecord">
<xs:annotation>
<xs:appinfo>
<b:recordInfo structure="delimited" child_delimiter_type="char" child_delimiter="," child_order="infix" sequence_number="1" preserve_delimiter_for_empty_data="true" suppress_trailing_delimiters="false" />
</xs:appinfo>
</xs:annotation>
<xs:complexType>
<xs:sequence>
<xs:annotation>
<xs:appinfo>
<groupInfo sequence_number="0" xmlns="http://schemas.microsoft.com/BizTalk/2003" />
</xs:appinfo>
</xs:annotation>
<xs:element name="SomeField" type="xs:string">
<xs:annotation>
<xs:appinfo>
<b:fieldInfo justification="left" sequence_number="1" wrap_char_type="char" wrap_char=""" />
</xs:appinfo>
</xs:annotation>
</xs:element>
<xs:element name="SomeOtherField" type="xs:string">
<xs:annotation>
<xs:appinfo>
<b:fieldInfo justification="left" sequence_number="2" wrap_char_type="char" wrap_char=""" />
</xs:appinfo>
</xs:annotation>
</xs:element>
<!-- And a whole bunch more fields -->
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
当文件实际上包含 CSV 记录时,这可以正常工作。但是,我有时会收到空白文件,我仍需要对这些文件进行解析(并最终启动编排。因此,我希望空白 CSV 文件生成如下内容:
<ns0:MyFile xmlns:ns0="http://My.Namespace.For.Schema">
</ns0:MyFile>
但据我所知,当接收端口得到一个空白文件时,接收管道启动,然后下游没有其他事情发生。我认为这是因为平面文件架构正在生成一条空消息,然后 BizTalk 将在该点停止。
收到空白文件时,如何使平面文件架构仍然生成没有子记录的 XML 记录?