我有一个平面文件输入,如下所示:
D1~0000002~917~NEGS515968~NEFS1606091~09062016~Some Random Company ~33330~
D2~0000003~NEFS1606091~1~~~0~0~NEGS~AC40010~54110~C90~0000~00~0000~33330~EXEMPT~0~~~~~~~~~~~
D1~0000004~2112~NEGS518497~NEFS1606091~09062016~Another random company~6890~
D2~0000005~NEFS1606091~1~~~0~0~NEGS~AC40010~54110~C90~0000~00~0000~6890~EXEMPT~0~~~~~~~~~~~
有两种记录类型,由第一列表示 - " D1"或" D2"。
我已使用该向导定义以下平面文件架构:
<?xml version="1.0" encoding="utf-16"?>
<xs:schema xmlns="http://Random.Unit4.Supplier.Schemas.Suppliers.NegsFF" xmlns:b="http://schemas.microsoft.com/BizTalk/2003" targetNamespace="http://Random.Unit4.Supplier.Schemas.Suppliers.NegsFF" 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="complexity" 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="NegsFF" />
</xs:appinfo>
</xs:annotation>
<xs:element name="NegsFF">
<xs:annotation>
<xs:appinfo>
<b:recordInfo structure="delimited" child_delimiter_type="hex" child_delimiter="0xD 0xA" child_order="postfix" 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 minOccurs="1" maxOccurs="unbounded" name="DataRecType1">
<xs:annotation>
<xs:appinfo>
<b:recordInfo tag_name="D1" structure="delimited" child_delimiter_type="char" child_delimiter="~" child_order="prefix" 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="SequenceNumber" type="xs:string">
<xs:annotation>
<xs:appinfo>
<b:fieldInfo justification="left" sequence_number="1" />
</xs:appinfo>
</xs:annotation>
</xs:element>
<xs:element name="OracleSupplierNumber" type="xs:string">
<xs:annotation>
<xs:appinfo>
<b:fieldInfo justification="left" sequence_number="2" />
</xs:appinfo>
</xs:annotation>
</xs:element>
<xs:element name="AlternateSiteName" type="xs:string">
<xs:annotation>
<xs:appinfo>
<b:fieldInfo justification="left" sequence_number="3" />
</xs:appinfo>
</xs:annotation>
</xs:element>
<xs:element name="InvoiceNumber" type="xs:string">
<xs:annotation>
<xs:appinfo>
<b:fieldInfo justification="left" sequence_number="4" />
</xs:appinfo>
</xs:annotation>
</xs:element>
<xs:element name="InvoiceDate" type="xs:string">
<xs:annotation>
<xs:appinfo>
<b:fieldInfo justification="left" sequence_number="5" />
</xs:appinfo>
</xs:annotation>
</xs:element>
<xs:element name="InvoiceHeaderDesc" type="xs:string">
<xs:annotation>
<xs:appinfo>
<b:fieldInfo justification="left" sequence_number="6" />
</xs:appinfo>
</xs:annotation>
</xs:element>
<xs:element name="AmountGrossInvoice" type="xs:string">
<xs:annotation>
<xs:appinfo>
<b:fieldInfo justification="left" sequence_number="7" />
</xs:appinfo>
</xs:annotation>
</xs:element>
<xs:element name="Blank1" type="xs:string">
<xs:annotation>
<xs:appinfo>
<b:fieldInfo sequence_number="8" justification="left" />
</xs:appinfo>
</xs:annotation>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element minOccurs="1" maxOccurs="unbounded" name="DataRecType2">
<xs:annotation>
<xs:appinfo>
<b:recordInfo tag_name="D2" structure="delimited" child_delimiter_type="char" child_delimiter="~" child_order="prefix" sequence_number="2" 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="SequenceNumber" type="xs:string">
<xs:annotation>
<xs:appinfo>
<b:fieldInfo justification="left" sequence_number="1" />
</xs:appinfo>
</xs:annotation>
</xs:element>
<xs:element name="InvoiceNumber" type="xs:string">
<xs:annotation>
<xs:appinfo>
<b:fieldInfo justification="left" sequence_number="2" />
</xs:appinfo>
</xs:annotation>
</xs:element>
<xs:element name="InvoiceLineNumber" type="xs:string">
<xs:annotation>
<xs:appinfo>
<b:fieldInfo justification="left" sequence_number="3" />
</xs:appinfo>
</xs:annotation>
</xs:element>
<xs:element name="Blank1" type="xs:string">
<xs:annotation>
<xs:appinfo>
<b:fieldInfo justification="left" sequence_number="4" />
</xs:appinfo>
</xs:annotation>
</xs:element>
<xs:element name="Blank2" type="xs:string">
<xs:annotation>
<xs:appinfo>
<b:fieldInfo justification="left" sequence_number="5" />
</xs:appinfo>
</xs:annotation>
</xs:element>
<xs:element name="QuantityInvoiced" type="xs:string">
<xs:annotation>
<xs:appinfo>
<b:fieldInfo justification="left" sequence_number="6" />
</xs:appinfo>
</xs:annotation>
</xs:element>
<xs:element name="UnitPrice" type="xs:string">
<xs:annotation>
<xs:appinfo>
<b:fieldInfo justification="left" sequence_number="7" />
</xs:appinfo>
</xs:annotation>
</xs:element>
<xs:element name="InvoiceLineDesc" type="xs:string">
<xs:annotation>
<xs:appinfo>
<b:fieldInfo justification="left" sequence_number="8" />
</xs:appinfo>
</xs:annotation>
</xs:element>
<xs:element name="CostCentre" type="xs:string">
<xs:annotation>
<xs:appinfo>
<b:fieldInfo justification="left" sequence_number="9" />
</xs:appinfo>
</xs:annotation>
</xs:element>
<xs:element name="Subjective" type="xs:string">
<xs:annotation>
<xs:appinfo>
<b:fieldInfo justification="left" sequence_number="10" />
</xs:appinfo>
</xs:annotation>
</xs:element>
<xs:element name="Objective" type="xs:string">
<xs:annotation>
<xs:appinfo>
<b:fieldInfo justification="left" sequence_number="11" />
</xs:appinfo>
</xs:annotation>
</xs:element>
<xs:element name="ProjectGroup" type="xs:string">
<xs:annotation>
<xs:appinfo>
<b:fieldInfo justification="left" sequence_number="12" />
</xs:appinfo>
</xs:annotation>
</xs:element>
<xs:element name="Balancing" type="xs:string">
<xs:annotation>
<xs:appinfo>
<b:fieldInfo justification="left" sequence_number="13" />
</xs:appinfo>
</xs:annotation>
</xs:element>
<xs:element name="Blank3" type="xs:string">
<xs:annotation>
<xs:appinfo>
<b:fieldInfo justification="left" sequence_number="14" />
</xs:appinfo>
</xs:annotation>
</xs:element>
<xs:element name="AmountGrossLine" type="xs:string">
<xs:annotation>
<xs:appinfo>
<b:fieldInfo justification="left" sequence_number="15" />
</xs:appinfo>
</xs:annotation>
</xs:element>
<xs:element name="VatCode" type="xs:string">
<xs:annotation>
<xs:appinfo>
<b:fieldInfo justification="left" sequence_number="16" />
</xs:appinfo>
</xs:annotation>
</xs:element>
<xs:element name="Blank4" type="xs:string">
<xs:annotation>
<xs:appinfo>
<b:fieldInfo sequence_number="17" justification="left" />
</xs:appinfo>
</xs:annotation>
</xs:element>
<xs:element name="Blank5" type="xs:string">
<xs:annotation>
<xs:appinfo>
<b:fieldInfo sequence_number="18" justification="left" />
</xs:appinfo>
</xs:annotation>
</xs:element>
<xs:element name="Blank6" type="xs:string">
<xs:annotation>
<xs:appinfo>
<b:fieldInfo sequence_number="19" justification="left" />
</xs:appinfo>
</xs:annotation>
</xs:element>
<xs:element name="Blank7" type="xs:string">
<xs:annotation>
<xs:appinfo>
<b:fieldInfo sequence_number="20" justification="left" />
</xs:appinfo>
</xs:annotation>
</xs:element>
<xs:element name="Blank8" type="xs:string">
<xs:annotation>
<xs:appinfo>
<b:fieldInfo sequence_number="21" justification="left" />
</xs:appinfo>
</xs:annotation>
</xs:element>
<xs:element name="Blank9" type="xs:string">
<xs:annotation>
<xs:appinfo>
<b:fieldInfo sequence_number="22" justification="left" />
</xs:appinfo>
</xs:annotation>
</xs:element>
<xs:element name="Blank10" type="xs:string">
<xs:annotation>
<xs:appinfo>
<b:fieldInfo sequence_number="23" justification="left" />
</xs:appinfo>
</xs:annotation>
</xs:element>
<xs:element name="Blank11" type="xs:string">
<xs:annotation>
<xs:appinfo>
<b:fieldInfo sequence_number="24" justification="left" />
</xs:appinfo>
</xs:annotation>
</xs:element>
<xs:element name="Blank12" type="xs:string">
<xs:annotation>
<xs:appinfo>
<b:fieldInfo sequence_number="25" justification="left" />
</xs:appinfo>
</xs:annotation>
</xs:element>
<xs:element name="Blank13" type="xs:string">
<xs:annotation>
<xs:appinfo>
<b:fieldInfo sequence_number="26" justification="left" />
</xs:appinfo>
</xs:annotation>
</xs:element>
<xs:element name="Blank14" type="xs:string">
<xs:annotation>
<xs:appinfo>
<b:fieldInfo sequence_number="27" justification="left" />
</xs:appinfo>
</xs:annotation>
</xs:element>
<xs:element name="Blank15" type="xs:string">
<xs:annotation>
<xs:appinfo>
<b:fieldInfo sequence_number="28" justification="left" />
</xs:appinfo>
</xs:annotation>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
现在,如果我在VS中右键单击平面文件架构并选择validate instance,则创建的XML只包含一条记录 - 即使输入平面文件包含多个D1和D2记录。如果我构建并部署到BizTalk中,当我通过接收位置推送消息时,该文件被分配,我得到两个XML输出文件。
我曾经想过通过设置&#34; DataType1&#34;和&#34; DataType2&#34;记录元素&#34; Max发生&#34;财产到&#34;无界&#34;这样可以防止打击。谁能看到我哪里出错了?
答案 0 :(得分:1)
您的问题是您已在DataRecType1&amp;上定义了repeat(maxoccurs)。 DataRecType2和序列的一部分,这意味着它需要1到多个DataRecType1,然后是1到多个DataRecType2。
e.g。
D1~0000002~917~NEGS515968~NEFS1606091~09062016~Some Random Company ~33330~
D1~0000004~2112~NEGS518497~NEFS1606091~09062016~Another random company~6890~
D2~0000003~NEFS1606091~1~~~0~0~NEGS~AC40010~54110~C90~0000~00~0000~33330~EXEMPT~0~~~~~~~~~~~
D2~0000005~NEFS1606091~1~~~0~0~NEGS~AC40010~54110~C90~0000~00~0000~6890~EXEMPT~0~~~~~~~~~~~
您需要有一个重复记录,其中包含DataRecType1和&amp; DataRecType2或具有期望DataRecType1或DataRecType2的重复选择节点。
您可以通过将NegsFF更改为组最大发生次数设置为无界并将组订单类型设置为序列来实现此目的或选择视情况而定。
<?xml version="1.0" encoding="utf-16"?>
<xs:schema xmlns="http://Random.Unit4.Supplier.Schemas.Suppliers.NegsFF" xmlns:b="http://schemas.microsoft.com/BizTalk/2003" targetNamespace="http://Random.Unit4.Supplier.Schemas.Suppliers.NegsFF" 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="complexity" 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="NegsFF" />
</xs:appinfo>
</xs:annotation>
<xs:element name="NegsFF">
<xs:annotation>
<xs:appinfo>
<b:recordInfo structure="delimited" child_delimiter_type="hex" child_delimiter="0xD 0xA" child_order="postfix" sequence_number="1" preserve_delimiter_for_empty_data="true" suppress_trailing_delimiters="false" />
</xs:appinfo>
</xs:annotation>
<xs:complexType>
<xs:sequence minOccurs="1" maxOccurs="unbounded">
<xs:annotation>
<xs:appinfo>
<b:groupInfo sequence_number="0" />
</xs:appinfo>
</xs:annotation>
<xs:element minOccurs="1" maxOccurs="unbounded" name="DataRecType1">
<xs:annotation>
<xs:appinfo>
<b:recordInfo tag_name="D1" structure="delimited" child_delimiter_type="char" child_delimiter="~" child_order="prefix" 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="SequenceNumber" type="xs:string">
<xs:annotation>
<xs:appinfo>
<b:fieldInfo justification="left" sequence_number="1" />
</xs:appinfo>
</xs:annotation>
</xs:element>
<xs:element name="OracleSupplierNumber" type="xs:string">
<xs:annotation>
<xs:appinfo>
<b:fieldInfo justification="left" sequence_number="2" />
</xs:appinfo>
</xs:annotation>
</xs:element>
<xs:element name="AlternateSiteName" type="xs:string">
<xs:annotation>
<xs:appinfo>
<b:fieldInfo justification="left" sequence_number="3" />
</xs:appinfo>
</xs:annotation>
</xs:element>
<xs:element name="InvoiceNumber" type="xs:string">
<xs:annotation>
<xs:appinfo>
<b:fieldInfo justification="left" sequence_number="4" />
</xs:appinfo>
</xs:annotation>
</xs:element>
<xs:element name="InvoiceDate" type="xs:string">
<xs:annotation>
<xs:appinfo>
<b:fieldInfo justification="left" sequence_number="5" />
</xs:appinfo>
</xs:annotation>
</xs:element>
<xs:element name="InvoiceHeaderDesc" type="xs:string">
<xs:annotation>
<xs:appinfo>
<b:fieldInfo justification="left" sequence_number="6" />
</xs:appinfo>
</xs:annotation>
</xs:element>
<xs:element name="AmountGrossInvoice" type="xs:string">
<xs:annotation>
<xs:appinfo>
<b:fieldInfo justification="left" sequence_number="7" />
</xs:appinfo>
</xs:annotation>
</xs:element>
<xs:element name="Blank1" type="xs:string">
<xs:annotation>
<xs:appinfo>
<b:fieldInfo sequence_number="8" justification="left" />
</xs:appinfo>
</xs:annotation>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element minOccurs="1" maxOccurs="unbounded" name="DataRecType2">
<xs:annotation>
<xs:appinfo>
<b:recordInfo tag_name="D2" structure="delimited" child_delimiter_type="char" child_delimiter="~" child_order="prefix" sequence_number="2" 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="SequenceNumber" type="xs:string">
<xs:annotation>
<xs:appinfo>
<b:fieldInfo justification="left" sequence_number="1" />
</xs:appinfo>
</xs:annotation>
</xs:element>
<xs:element name="InvoiceNumber" type="xs:string">
<xs:annotation>
<xs:appinfo>
<b:fieldInfo justification="left" sequence_number="2" />
</xs:appinfo>
</xs:annotation>
</xs:element>
<xs:element name="InvoiceLineNumber" type="xs:string">
<xs:annotation>
<xs:appinfo>
<b:fieldInfo justification="left" sequence_number="3" />
</xs:appinfo>
</xs:annotation>
</xs:element>
<xs:element name="Blank1" type="xs:string">
<xs:annotation>
<xs:appinfo>
<b:fieldInfo justification="left" sequence_number="4" />
</xs:appinfo>
</xs:annotation>
</xs:element>
<xs:element name="Blank2" type="xs:string">
<xs:annotation>
<xs:appinfo>
<b:fieldInfo justification="left" sequence_number="5" />
</xs:appinfo>
</xs:annotation>
</xs:element>
<xs:element name="QuantityInvoiced" type="xs:string">
<xs:annotation>
<xs:appinfo>
<b:fieldInfo justification="left" sequence_number="6" />
</xs:appinfo>
</xs:annotation>
</xs:element>
<xs:element name="UnitPrice" type="xs:string">
<xs:annotation>
<xs:appinfo>
<b:fieldInfo justification="left" sequence_number="7" />
</xs:appinfo>
</xs:annotation>
</xs:element>
<xs:element name="InvoiceLineDesc" type="xs:string">
<xs:annotation>
<xs:appinfo>
<b:fieldInfo justification="left" sequence_number="8" />
</xs:appinfo>
</xs:annotation>
</xs:element>
<xs:element name="CostCentre" type="xs:string">
<xs:annotation>
<xs:appinfo>
<b:fieldInfo justification="left" sequence_number="9" />
</xs:appinfo>
</xs:annotation>
</xs:element>
<xs:element name="Subjective" type="xs:string">
<xs:annotation>
<xs:appinfo>
<b:fieldInfo justification="left" sequence_number="10" />
</xs:appinfo>
</xs:annotation>
</xs:element>
<xs:element name="Objective" type="xs:string">
<xs:annotation>
<xs:appinfo>
<b:fieldInfo justification="left" sequence_number="11" />
</xs:appinfo>
</xs:annotation>
</xs:element>
<xs:element name="ProjectGroup" type="xs:string">
<xs:annotation>
<xs:appinfo>
<b:fieldInfo justification="left" sequence_number="12" />
</xs:appinfo>
</xs:annotation>
</xs:element>
<xs:element name="Balancing" type="xs:string">
<xs:annotation>
<xs:appinfo>
<b:fieldInfo justification="left" sequence_number="13" />
</xs:appinfo>
</xs:annotation>
</xs:element>
<xs:element name="Blank3" type="xs:string">
<xs:annotation>
<xs:appinfo>
<b:fieldInfo justification="left" sequence_number="14" />
</xs:appinfo>
</xs:annotation>
</xs:element>
<xs:element name="AmountGrossLine" type="xs:string">
<xs:annotation>
<xs:appinfo>
<b:fieldInfo justification="left" sequence_number="15" />
</xs:appinfo>
</xs:annotation>
</xs:element>
<xs:element name="VatCode" type="xs:string">
<xs:annotation>
<xs:appinfo>
<b:fieldInfo justification="left" sequence_number="16" />
</xs:appinfo>
</xs:annotation>
</xs:element>
<xs:element name="Blank4" type="xs:string">
<xs:annotation>
<xs:appinfo>
<b:fieldInfo sequence_number="17" justification="left" />
</xs:appinfo>
</xs:annotation>
</xs:element>
<xs:element name="Blank5" type="xs:string">
<xs:annotation>
<xs:appinfo>
<b:fieldInfo sequence_number="18" justification="left" />
</xs:appinfo>
</xs:annotation>
</xs:element>
<xs:element name="Blank6" type="xs:string">
<xs:annotation>
<xs:appinfo>
<b:fieldInfo sequence_number="19" justification="left" />
</xs:appinfo>
</xs:annotation>
</xs:element>
<xs:element name="Blank7" type="xs:string">
<xs:annotation>
<xs:appinfo>
<b:fieldInfo sequence_number="20" justification="left" />
</xs:appinfo>
</xs:annotation>
</xs:element>
<xs:element name="Blank8" type="xs:string">
<xs:annotation>
<xs:appinfo>
<b:fieldInfo sequence_number="21" justification="left" />
</xs:appinfo>
</xs:annotation>
</xs:element>
<xs:element name="Blank9" type="xs:string">
<xs:annotation>
<xs:appinfo>
<b:fieldInfo sequence_number="22" justification="left" />
</xs:appinfo>
</xs:annotation>
</xs:element>
<xs:element name="Blank10" type="xs:string">
<xs:annotation>
<xs:appinfo>
<b:fieldInfo sequence_number="23" justification="left" />
</xs:appinfo>
</xs:annotation>
</xs:element>
<xs:element name="Blank11" type="xs:string">
<xs:annotation>
<xs:appinfo>
<b:fieldInfo sequence_number="24" justification="left" />
</xs:appinfo>
</xs:annotation>
</xs:element>
<xs:element name="Blank12" type="xs:string">
<xs:annotation>
<xs:appinfo>
<b:fieldInfo sequence_number="25" justification="left" />
</xs:appinfo>
</xs:annotation>
</xs:element>
<xs:element name="Blank13" type="xs:string">
<xs:annotation>
<xs:appinfo>
<b:fieldInfo sequence_number="26" justification="left" />
</xs:appinfo>
</xs:annotation>
</xs:element>
<xs:element name="Blank14" type="xs:string">
<xs:annotation>
<xs:appinfo>
<b:fieldInfo sequence_number="27" justification="left" />
</xs:appinfo>
</xs:annotation>
</xs:element>
<xs:element name="Blank15" type="xs:string">
<xs:annotation>
<xs:appinfo>
<b:fieldInfo sequence_number="28" justification="left" />
</xs:appinfo>
</xs:annotation>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>