BizTalk平面文件/ CSV架构

问题描述 投票:0回答:1

我正在重构一个BizTalk应用程序。现有模式具有以下结构,表示发票,其中Level1是标题,第4级是多个行项目。

enter image description here

在旧的2010版应用程序中,它一次写出一个发票数据,并使用平面文件架构发送管道。我们正在努力改进旧系统并将其推向2013年。

我添加了一个接收管道来重新读取数据,它适用于单个发票。但如果文件中有多个发票,则会失败。

我可以调整我已经拥有的模式(而不必重新运行向导)以允许在同一个文件中存储多个发票吗?例如,添加包含Level1和Level4的“Invoice”记录?

[最终目标是添加0级,其中包括当天的总发票,并根据我们建筑师的偏好在地图与管道中执行此操作。]

我尝试了以下内容,并收到此错误:

原因:寻找的意外结束:','

我使用类似的步骤来BizTalk FlatFile Schema multiple repeating records

  1. 添加了发票记录,并将级别1和级别4置于其下。
  2. 将记录设置为未绑定
  3. 设置子订单中缀
  4. 子分隔符类型为十六进制
  5. 子分隔符为0x0D 0x0A

enter image description here

如果我尝试“Child Delimiter” - “None”,那么我收到此错误:

原因:寻找时发现意外数据:$ Delimited $

然后我尝试添加“标签标识符”(分别设置为“Level1”和“Level4”)。在这种情况下,带有一张发票的文件被序列化,但带有3张发票的文件给出了一个神秘的错误:

消息传递引擎在处理一个或多个入站消息期间遇到错误。

样本数据:

Level1,,VO,TEST01,12/17/2018,34093092-1,,12/17/2018,60,1075,0,A,,,,12/17/2018,2/15/2019,2/15/2019,,,2000,1000,,1010,1000,,,,,EP
Level4,N,1200,,,1000,INDFRT-ECO,0,,0,145.72,7,34093092-448-887,,,,,,,,,,,,,,,,,
Level4,N,1200,,,1000,INDFRT-ECO,0,,0,802.67,7,34093092-492-930,,,,,,,,,,,,,,,,,
Level4,N,1200,,,1000,INDFRT-ECO,0,,0,126.61,7,34093092-833-096,,,,,,,,,,,,,,,,,
Level1,,VO,TEST01,12/17/2018,34068721-1,,12/17/2018,60,1250,0,A,,,,12/17/2018,2/15/2019,2/15/2019,,,2000,1000,,1010,1000,,,,,EP
Level4,N,1200,,,1000,INDFRT-ECO,0,,0,1250,7,34068721-492-930,,,,,,,,,,,,,,,,,
Level1,,VO,TEST01,12/17/2018,34094975-1,,12/17/2018,60,595,0,A,,,,12/17/2018,2/15/2019,2/15/2019,,,2000,1000,,1010,1000,,,,,EP
Level4,N,1200,,,1000,INDFRT-ECO,0,,0,142.8,7,34094975-448-887,,,,,,,,,,,,,,,,,
Level4,N,1200,,,1000,INDFRT-ECO,0,,0,452.2,7,34094975-492-930,,,,,,,,,,,,,,,,,
csv xsd flat-file biztalk-2013
1个回答
1
投票

这是一个将解析您的文件的架构。

请注意,<Sequence>节点和Level4都有Max Occurs无限制。

Schema structure

使用标签时的技巧是,如果您不想先使用空字段,则必须在标记中包含第一个分隔符或将分隔符子顺序设置为前缀。

此外,如果您的最后一行不以CR LF结尾,则必须将根节点(TAR210)子顺序从Postfix更改为Infix

您将要使用正确的字段名称替换重复的字段,您可以通过在重复字段之前添加它来一次执行该字段,或者将此结构应用于现有模式。

<?xml version="1.0" encoding="utf-16"?>
<xs:schema xmlns="http://Scratch.SO55026928" xmlns:b="http://schemas.microsoft.com/BizTalk/2003" targetNamespace="http://Scratch.SO55026928" xmlns:xs="http://www.w3.org/2001/XMLSchema">
  <xs:annotation>
    <xs:appinfo>
      <b:schemaInfo standard="Flat File" root_reference="TAR210" 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" />
      <schemaEditorExtension:schemaInfo namespaceAlias="b" extensionClass="Microsoft.BizTalk.FlatFileExtension.FlatFileExtension" standardName="Flat File" xmlns:schemaEditorExtension="http://schemas.microsoft.com/BizTalk/2003/SchemaEditorExtensions" />
    </xs:appinfo>
  </xs:annotation>
  <xs:element name="TAR210">
    <xs:annotation>
      <xs:appinfo>
        <b:recordInfo structure="delimited" preserve_delimiter_for_empty_data="true" suppress_trailing_delimiters="false" sequence_number="1" child_order="postfix" child_delimiter_type="hex" child_delimiter="0x0D 0x0A" />
      </xs:appinfo>
    </xs:annotation>
    <xs:complexType>
      <xs:sequence>
        <xs:annotation>
          <xs:appinfo>
            <b:groupInfo sequence_number="0" />
          </xs:appinfo>
        </xs:annotation>
        <xs:sequence maxOccurs="unbounded">
          <xs:annotation>
            <xs:appinfo>
              <b:groupInfo sequence_number="1" />
            </xs:appinfo>
          </xs:annotation>
          <xs:element name="Level1">
            <xs:annotation>
              <xs:appinfo>
                <b:recordInfo structure="delimited" preserve_delimiter_for_empty_data="true" suppress_trailing_delimiters="false" repeating_delimiter_type="char" repeating_delimiter="," sequence_number="1" tag_name="Level1" child_order="prefix" />
              </xs:appinfo>
            </xs:annotation>
            <xs:complexType>
              <xs:sequence>
                <xs:annotation>
                  <xs:appinfo>
                    <b:groupInfo sequence_number="0" />
                  </xs:appinfo>
                </xs:annotation>
                <xs:element maxOccurs="unbounded" name="Field" type="xs:string">
                  <xs:annotation>
                    <xs:appinfo>
                      <b:fieldInfo justification="left" sequence_number="1" />
                    </xs:appinfo>
                  </xs:annotation>
                </xs:element>
              </xs:sequence>
            </xs:complexType>
          </xs:element>
          <xs:element maxOccurs="unbounded" name="Level4">
            <xs:annotation>
              <xs:appinfo>
                <b:recordInfo sequence_number="2" structure="delimited" preserve_delimiter_for_empty_data="true" suppress_trailing_delimiters="false" repeating_delimiter_type="char" repeating_delimiter="," tag_name="Level4" child_order="prefix" />
              </xs:appinfo>
            </xs:annotation>
            <xs:complexType>
              <xs:sequence>
                <xs:annotation>
                  <xs:appinfo>
                    <b:groupInfo sequence_number="0" />
                  </xs:appinfo>
                </xs:annotation>
                <xs:element maxOccurs="unbounded" name="Field" type="xs:string">
                  <xs:annotation>
                    <xs:appinfo>
                      <b:fieldInfo justification="left" sequence_number="1" />
                    </xs:appinfo>
                  </xs:annotation>
                </xs:element>
              </xs:sequence>
            </xs:complexType>
          </xs:element>
        </xs:sequence>
      </xs:sequence>
    </xs:complexType>
  </xs:element>
</xs:schema>
© www.soinside.com 2019 - 2024. All rights reserved.