代码之家  ›  专栏  ›  技术社区  ›  neitcouq

BizTalk平面文件即使在数据为空时也会生成CRLF

  •  1
  • neitcouq  · 技术社区  · 7 年前

        <?xml version="1.0" encoding="utf-16"?>
    <xs:schema xmlns="http://mynamespace" xmlns:b="http://schemas.microsoft.com/BizTalk/2003" targetNamespace="http://mynamespace" 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="File" />
        </xs:appinfo>
      </xs:annotation>
      <xs:element name="File">
        <xs:annotation>
          <xs:appinfo>
            <b:recordInfo structure="delimited" child_delimiter_type="hex" child_delimiter="0x0D 0x0A" 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 minOccurs="0" maxOccurs="unbounded" name="TransactionDate">
              <xs:annotation>
                <xs:appinfo>
                  <b:recordInfo structure="delimited" child_delimiter_type="hex" child_delimiter="0x0D 0x0A" child_order="infix" sequence_number="1" preserve_delimiter_for_empty_data="true" suppress_trailing_delimiters="false" repeating_delimiter_type="hex" repeating_delimiter="0x0D 0x0A" />
                </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="0" maxOccurs="unbounded" name="Items">
                    <xs:annotation>
                      <xs:appinfo>
                        <b:recordInfo structure="delimited" child_delimiter_type="hex" child_delimiter="0xD 0xA" child_order="infix" sequence_number="1" preserve_delimiter_for_empty_data="true" suppress_trailing_delimiters="false" repeating_delimiter_type="hex" repeating_delimiter="0x0D 0x0A" />
                      </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="0" maxOccurs="unbounded" name="Item">
                          <xs:annotation>
                            <xs:appinfo>
                              <b:recordInfo structure="positional" 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>
                               <!-- My elements here -->
                            </xs:sequence>
                          </xs:complexType>
                        </xs:element>
    
                      </xs:sequence>
                    </xs:complexType>
                  </xs:element>
                </xs:sequence>
              </xs:complexType>
            </xs:element>
            <xs:element minOccurs="1" maxOccurs="1" default="EOF" name="EOF" type="xs:string">
              <xs:annotation>
                <xs:appinfo>
                  <b:fieldInfo sequence_number="2" justification="left" pos_offset="0" pos_length="3" />
                </xs:appinfo>
              </xs:annotation>
            </xs:element>
          </xs:sequence>
        </xs:complexType>
      </xs:element>
    </xs:schema>
    

    问题是,当xml有数据时,我们得到了正确的结果,例如:

    line1
    line2
    line3
    EOF
    

    但是当我们没有数据时(XML只有名称空间)

    <ns:SAPFile Channel="Eziemall" xmlns:ns="http://mynamespace" />
    

    那么平面文件是:

    CRLF (for easy reading)
    EOF
    

    1 回复  |  直到 7 年前
        1
  •  0
  •   Dijkgraaf    7 年前

    我只是用一个地图尝试了你的模式,我没有把任何东西映射到目的地,也没有得到CRLF。

    所以问题在于你的地图,而不是模式。

    您需要添加一个到TransactionDate的链接,如果没有数据,则该链接将取消该链接。

    enter image description here