【问题标题】:Biztalk Schema for missing values缺失值的 Biztalk 架构
【发布时间】:2016-02-02 19:28:18
【问题描述】:

我有一个 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, 

【问题讨论】:

  • 请将您的架构添加到问题中,并向我们提供您正在使用的确切示例。
  • 我添加了架构和文件

标签: biztalk biztalk-2013r2


【解决方案1】:

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

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

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

【讨论】:

  • 我用了notepad++,上面写着CR LF
  • 我确实发生了最大值,但它不起作用。我已将架构附加到问题中。错误 1 ​​查找时发现意外数据:'\r\n' 当前正在解析的定义是 MySchema_Detail。发生错误的流偏移量为31。发生错误的行号为1。发生错误的列为31。C:\BiztalkTestFiles\ldcSyncList\without.txt 1 1
  • 你让它工作了吗?您将我的答案标记为答案。我刚刚使用您的架构和示例进行了尝试,并且可以正常工作。我确实在我的答案中犯了一个错字,我会更正,它应该是 Min Occurs = 0 而不是 Max Occurs,Max 发生可以留空(默认值 1)或设置为 1
猜你喜欢
  • 2014-04-16
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2012-04-18
  • 2013-11-09
  • 1970-01-01
  • 2022-07-05
相关资源
最近更新 更多