Biztalk Schema缺失值

时间:2016-02-02 19:28:18

标签: biztalk biztalk-2013r2

我有一个针对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:without.txt

Mike Myers, 30 West Street, NY, 10001, 

1 个答案:

答案 0 :(得分:1)

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

同时确保您的记录确实以CR&amp; LF(使用NotePad ++并显示所有符号)

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