0

我有一个 txt 文件的 biztalk 2013-r2 架构,有时最后一列没有值。

With value:
Name, address, city, state, zip, phone
Mike Myers, 30 West Street, NY, 10001, 2124444444

Without value:
Name, address, city, state, zip, phone
Mike Myers, 30 West Street, NY, 10001, 

当该列具有价值时,就没有问题。

当最后一列没有值时,我收到以下错误:

PublicKeyToken=92c4a30afea05f3e" Source: "Flat file disassembler" Receive Port: "rp_List" URI: "C:\BiztalkTestFiles\List\myfiles\*.txt" Reason: Unexpected data found while looking for:
'\r\n'
The current definition being parsed is Mydefinition. The stream offset where the error occured is 101. The line number where the error occured is 2. The column where the error occured is 6.  

是否有解决此类问题的方法?

附上架构:

<?xml version="1.0" encoding="utf-16"?>
<xs:schema xmlns="http://usgeSales.ldcSyncList.schemas.MySchema" xmlns:b="http://schemas.microsoft.com/BizTalk/2003" targetNamespace="http://usgeSales.ldcSyncList.schemas.MySchema" 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="MySchema" />
    </xs:appinfo>
  </xs:annotation>
  <xs:element name="MySchema">
    <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 maxOccurs="unbounded" name="MySchema_Detail">
          <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="Name" type="xs:string">
                <xs:annotation>
                  <xs:appinfo>
                    <b:fieldInfo justification="left" sequence_number="1" />
                  </xs:appinfo>
                </xs:annotation>
              </xs:element>
              <xs:element name="Address" type="xs:string">
                <xs:annotation>
                  <xs:appinfo>
                    <b:fieldInfo justification="left" sequence_number="2" />
                  </xs:appinfo>
                </xs:annotation>
              </xs:element>
              <xs:element name="State" type="xs:string">
                <xs:annotation>
                  <xs:appinfo>
                    <b:fieldInfo justification="left" sequence_number="3" />
                  </xs:appinfo>
                </xs:annotation>
              </xs:element>
              <xs:element name="Zip" type="xs:string">
                <xs:annotation>
                  <xs:appinfo>
                    <b:fieldInfo justification="left" sequence_number="4" />
                  </xs:appinfo>
                </xs:annotation>
              </xs:element>
              <xs:element maxOccurs="0" name="Phone" type="xs:string">
                <xs:annotation>
                  <xs:appinfo>
                    <b:fieldInfo justification="left" sequence_number="5" />
                  </xs:appinfo>
                </xs:annotation>
              </xs:element>
            </xs:sequence>
          </xs:complexType>
        </xs:element>
      </xs:sequence>
    </xs:complexType>
  </xs:element>
</xs:schema>

文件 1:with.txt

Mike Myers, 30 West Street, NY, 10001, 2124444444

文件2:没有.txt

Mike Myers, 30 West Street, NY, 10001, 
4

1 回答 1

1

通常您只需将最后一个元素上的 Min Occurs 设置为 0

还要确保您的记录确实以 CR 和 LF 结束(使用 NotePad++ 并显示所有符号)

事实上,它在第 2 行第 11 列抱怨,你的问题实际上可能是别的东西。

于 2016-02-02T19:44:06.243 回答