0

带有嵌套节点的 BizTalk 平面文件架构给我带来了一些麻烦。发生的事情是子记录分隔符在最后一个字段中显示为数据。我按照这篇旧博客文章中的食谱进行操作。

在 BizTalk 2004 中管理平面文件

这是输入和模式在这里。

https://bitbucket.org/kirk98445/stuff/src/90becbaa638b1bc42555cf84f2a1a4cb4f3cd3fc?at=master

结果是除了 user 和 ponumber 字段中的 crlf 之外,xml 大部分看起来都很好。

<Orders xmlns="http://KS.Biztalk.EDI.Common.Amtech.ASN.FlatFileSchema1"><Header><user>USER_1234
</user></Header><Order><OrderHeader><ponumber>PO_001
</ponumber></OrderHeader><LineItems><LineItem><item>Item32  33</item></LineItem><LineItem><item>Item63  45</item></LineItem></LineItems></Order><Order><OrderHeader><ponumber>PO_002
</ponumber></OrderHeader><LineItems><LineItem><item>Item454 12</item></LineItem></LineItems></Order></Orders>
4

1 回答 1

0

您的架构存在问题。记录“订单”- 未为分隔记录设置子分隔符类型属性。记录“顺序”- 未为分隔记录设置子分隔符类型属性。

通常使用这种平面文件,我会为标题创建一个模式,然后为订单和订单行创建一个模式。然后在平面文件 dissembler 中定义将 Header schema 和 Document schema 设置为上述两个。这样,它将取消批处理,您将收到文件中每个采购订单的消息。

但是,如果您希望在单个模式中使用它,请尝试使用序列组节点的此模式。

<?xml version="1.0" encoding="utf-16"?>
<xs:schema xmlns="http://KS.Biztalk.EDI.Common.Amtech.ASN.FlatFileSchema1" xmlns:b="http://schemas.microsoft.com/BizTalk/2003" elementFormDefault="qualified" targetNamespace="http://KS.Biztalk.EDI.Common.Amtech.ASN.FlatFileSchema1" xmlns:xs="http://www.w3.org/2001/XMLSchema">
  <xs:annotation>
    <xs:appinfo>
      <b:schemaInfo standard="Flat File" root_reference="Orders" default_pad_char=" " pad_char_type="char" count_positions_by_byte="false" parser_optimization="speed" lookahead_depth="3" suppress_empty_nodes="true" generate_empty_nodes="true" allow_early_termination="false" early_terminate_optional_fields="false" allow_message_breakup_of_infix_root="false" compile_parse_tables="false" child_delimiter_type="hex" default_child_delimiter="0x0D 0x0A" default_child_order="postfix" />
      <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="Orders">
    <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:element minOccurs="1" maxOccurs="1" name="Header">
          <xs:annotation>
            <xs:appinfo>
              <b:recordInfo sequence_number="1" structure="delimited" preserve_delimiter_for_empty_data="true" suppress_trailing_delimiters="false" tag_name="HEADER" child_delimiter_type="hex" child_delimiter="0x09" 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 name="user" type="xs:string">
                <xs:annotation>
                  <xs:appinfo>
                    <b:fieldInfo sequence_number="1" justification="left" />
                  </xs:appinfo>
                </xs:annotation>
              </xs:element>
            </xs:sequence>
          </xs:complexType>
        </xs:element>
        <xs:sequence maxOccurs="unbounded">
          <xs:annotation>
            <xs:appinfo>
              <b:groupInfo sequence_number="2" />
            </xs:appinfo>
          </xs:annotation>
          <xs:element name="OrderHeader">
            <xs:annotation>
              <xs:appinfo>
                <b:recordInfo structure="delimited" preserve_delimiter_for_empty_data="true" suppress_trailing_delimiters="false" tag_name="PURCHASE" child_order="prefix" child_delimiter_type="hex" child_delimiter="0x09" sequence_number="1" />
              </xs:appinfo>
            </xs:annotation>
            <xs:complexType>
              <xs:sequence>
                <xs:annotation>
                  <xs:appinfo>
                    <b:groupInfo sequence_number="0" />
                  </xs:appinfo>
                </xs:annotation>
                <xs:element name="ponumber" type="xs:string">
                  <xs:annotation>
                    <xs:appinfo>
                      <b:fieldInfo sequence_number="1" justification="left" />
                    </xs:appinfo>
                  </xs:annotation>
                </xs:element>
              </xs:sequence>
            </xs:complexType>
          </xs:element>
          <xs:element maxOccurs="unbounded" name="LineItem">
            <xs:annotation>
              <xs:appinfo>
                <b:recordInfo structure="delimited" preserve_delimiter_for_empty_data="true" suppress_trailing_delimiters="false" tag_name="LINEITEM" child_delimiter_type="hex" child_delimiter="0x09" child_order="prefix" sequence_number="2" />
              </xs:appinfo>
            </xs:annotation>
            <xs:complexType>
              <xs:sequence>
                <xs:annotation>
                  <xs:appinfo>
                    <b:groupInfo sequence_number="0" />
                  </xs:appinfo>
                </xs:annotation>
                <xs:element name="item" type="xs:string">
                  <xs:annotation>
                    <xs:appinfo>
                      <b:fieldInfo sequence_number="1" justification="left" />
                    </xs:appinfo>
                  </xs:annotation>
                </xs:element>
                <xs:element name="Qty" type="xs:string">
                  <xs:annotation>
                    <xs:appinfo>
                      <b:fieldInfo sequence_number="2" justification="left" />
                    </xs:appinfo>
                  </xs:annotation>
                </xs:element>
              </xs:sequence>
            </xs:complexType>
          </xs:element>
        </xs:sequence>
      </xs:sequence>
    </xs:complexType>
  </xs:element>
</xs:schema>    
于 2013-08-18T22:34:53.593 回答