BizTalk平面文件反汇编程序忽略记录中断

时间:2013-09-26 22:04:23

标签: biztalk biztalk-2010 disassembly

给定以管道分隔的文档:

HDR|A
PSN|CCC|111|00|111111111|DOE|JOHN||M
PSN|CCC|111|01|111111111|DOE|JANE|A|F|07/30/1975
ADR|CCC|111|00|U|100 S 1ST #11||ANYTOWN|US|XX|55555|09/24/2013|
PHN|CCC|111|00|U|US|5551111111||09/24/2013|

和BizTalk架构:

<?xml version="1.0" encoding="utf-16"?>
<xs:schema xmlns="http://xxxx.com/schemas/test1" xmlns:b="http://schemas.microsoft.com/BizTalk/2003" targetNamespace="http://xxxx.com/schemas/test1" 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="complexity" lookahead_depth="0" suppress_empty_nodes="false" generate_empty_nodes="true" allow_early_termination="true" early_terminate_optional_fields="true" allow_message_breakup_of_infix_root="false" compile_parse_tables="false" root_reference="Root" />
    </xs:appinfo>
  </xs:annotation>
  <xs:element name="Root">
    <xs:annotation>
      <xs:appinfo>
        <b:recordInfo structure="delimited" child_delimiter_type="hex" child_order="postfix" sequence_number="1" preserve_delimiter_for_empty_data="true" suppress_trailing_delimiters="true" child_delimiter="0x0D 0x0A" />
      </xs:appinfo>
    </xs:annotation>
    <xs:complexType>
      <xs:choice minOccurs="0" maxOccurs="unbounded">
        <xs:annotation>
          <xs:appinfo>
            <groupInfo sequence_number="0" xmlns="http://schemas.microsoft.com/BizTalk/2003" />
          </xs:appinfo>
        </xs:annotation>
        <xs:element minOccurs="1" maxOccurs="1" name="Header" type="HeaderType">
          <xs:annotation>
            <xs:appinfo>
              <b:recordInfo structure="delimited" child_delimiter_type="char" child_delimiter="|" child_order="infix" preserve_delimiter_for_empty_data="true" suppress_trailing_delimiters="false" tag_name="HDR" tag_offset="0" sequence_number="1" />
            </xs:appinfo>
          </xs:annotation>
        </xs:element>
        <xs:element minOccurs="0" maxOccurs="unbounded" name="Person" type="PersonType">
          <xs:annotation>
            <xs:appinfo>
              <b:recordInfo structure="delimited" tag_name="PSN" tag_offset="0" preserve_delimiter_for_empty_data="true" suppress_trailing_delimiters="false" child_delimiter_type="char" child_delimiter="|" sequence_number="2" />
            </xs:appinfo>
          </xs:annotation>
        </xs:element>
        <xs:element minOccurs="0" maxOccurs="unbounded" name="Address" type="AddressType">
          <xs:annotation>
            <xs:appinfo>
              <b:recordInfo structure="delimited" tag_name="ADR" tag_offset="0" preserve_delimiter_for_empty_data="true" suppress_trailing_delimiters="false" child_delimiter_type="char" child_delimiter="|" sequence_number="3" />
            </xs:appinfo>
          </xs:annotation>
        </xs:element>
        <xs:element minOccurs="0" maxOccurs="unbounded" name="Phone" type="PhoneType">
          <xs:annotation>
            <xs:appinfo>
              <b:recordInfo structure="delimited" tag_name="PHN" tag_offset="0" preserve_delimiter_for_empty_data="true" suppress_trailing_delimiters="false" child_delimiter_type="char" child_delimiter="|" sequence_number="4" />
            </xs:appinfo>
          </xs:annotation>
        </xs:element>
      </xs:choice>
    </xs:complexType>
  </xs:element>
  <xs:complexType name="HeaderType">
    <xs:attribute default="" name="type" type="xs:string">
      <xs:annotation>
        <xs:appinfo>
          <b:fieldInfo justification="left" sequence_number="1" />
        </xs:appinfo>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute default="" name="description" type="xs:string">
      <xs:annotation>
        <xs:appinfo>
          <b:fieldInfo justification="left" sequence_number="2" />
        </xs:appinfo>
      </xs:annotation>
    </xs:attribute>
  </xs:complexType>
  <xs:complexType name="PersonType">
    <xs:attribute name="group" type="xs:string">
      <xs:annotation>
        <xs:appinfo>
          <b:fieldInfo justification="left" sequence_number="1" />
        </xs:appinfo>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="id" type="xs:string">
      <xs:annotation>
        <xs:appinfo>
          <b:fieldInfo justification="left" sequence_number="2" />
        </xs:appinfo>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="seq" type="xs:string">
      <xs:annotation>
        <xs:appinfo>
          <b:fieldInfo justification="left" sequence_number="3" />
        </xs:appinfo>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute default="" name="ssn" type="xs:string">
      <xs:annotation>
        <xs:appinfo>
          <b:fieldInfo justification="left" sequence_number="4" />
        </xs:appinfo>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="last" type="xs:string">
      <xs:annotation>
        <xs:appinfo>
          <b:fieldInfo justification="left" sequence_number="5" />
        </xs:appinfo>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="first" type="xs:string">
      <xs:annotation>
        <xs:appinfo>
          <b:fieldInfo justification="left" sequence_number="6" />
        </xs:appinfo>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute default="" name="mi" type="xs:string">
      <xs:annotation>
        <xs:appinfo>
          <b:fieldInfo justification="left" sequence_number="7" />
        </xs:appinfo>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute default="" name="gender" type="xs:string">
      <xs:annotation>
        <xs:appinfo>
          <b:fieldInfo justification="left" sequence_number="8" />
        </xs:appinfo>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute default="" name="dob" type="xs:string">
      <xs:annotation>
        <xs:appinfo>
          <b:fieldInfo justification="left" sequence_number="9" />
        </xs:appinfo>
      </xs:annotation>
    </xs:attribute>
  </xs:complexType>
  <xs:complexType name="AddressType">
    <xs:attribute name="group" type="xs:string">
      <xs:annotation>
        <xs:appinfo>
          <b:fieldInfo justification="left" sequence_number="1" />
        </xs:appinfo>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="id" type="xs:string">
      <xs:annotation>
        <xs:appinfo>
          <b:fieldInfo justification="left" sequence_number="2" />
        </xs:appinfo>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="seq" type="xs:string">
      <xs:annotation>
        <xs:appinfo>
          <b:fieldInfo justification="left" sequence_number="3" />
        </xs:appinfo>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="type" type="xs:string">
      <xs:annotation>
        <xs:appinfo>
          <b:fieldInfo justification="left" sequence_number="4" />
        </xs:appinfo>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute default="" name="addr1" type="xs:string">
      <xs:annotation>
        <xs:appinfo>
          <b:fieldInfo justification="left" sequence_number="5" />
        </xs:appinfo>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute default="" name="addr2" type="xs:string">
      <xs:annotation>
        <xs:appinfo>
          <b:fieldInfo justification="left" sequence_number="6" />
        </xs:appinfo>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute default="" name="city" type="xs:string">
      <xs:annotation>
        <xs:appinfo>
          <b:fieldInfo justification="left" sequence_number="7" />
        </xs:appinfo>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute default="" name="country" type="xs:string">
      <xs:annotation>
        <xs:appinfo>
          <b:fieldInfo justification="left" sequence_number="8" />
        </xs:appinfo>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute default="" name="state" type="xs:string">
      <xs:annotation>
        <xs:appinfo>
          <b:fieldInfo justification="left" sequence_number="9" />
        </xs:appinfo>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute default="" name="zip" type="xs:string">
      <xs:annotation>
        <xs:appinfo>
          <b:fieldInfo justification="left" sequence_number="10" />
        </xs:appinfo>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="date" type="xs:string">
      <xs:annotation>
        <xs:appinfo>
          <b:fieldInfo justification="left" sequence_number="11" />
        </xs:appinfo>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute default="" name="filler" type="xs:string">
      <xs:annotation>
        <xs:appinfo>
          <b:fieldInfo justification="left" sequence_number="12" />
        </xs:appinfo>
      </xs:annotation>
    </xs:attribute>
  </xs:complexType>
  <xs:complexType name="PhoneType">
    <xs:attribute name="client_code" type="xs:string">
      <xs:annotation>
        <xs:appinfo>
          <b:fieldInfo justification="left" sequence_number="1" />
        </xs:appinfo>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="id" type="xs:string">
      <xs:annotation>
        <xs:appinfo>
          <b:fieldInfo justification="left" sequence_number="2" />
        </xs:appinfo>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="seq" type="xs:string">
      <xs:annotation>
        <xs:appinfo>
          <b:fieldInfo justification="left" sequence_number="3" />
        </xs:appinfo>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="type" type="xs:string">
      <xs:annotation>
        <xs:appinfo>
          <b:fieldInfo justification="left" sequence_number="4" />
        </xs:appinfo>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute default="" name="country" type="xs:string">
      <xs:annotation>
        <xs:appinfo>
          <b:fieldInfo justification="left" sequence_number="5" />
        </xs:appinfo>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute default="" name="number" type="xs:string">
      <xs:annotation>
        <xs:appinfo>
          <b:fieldInfo justification="left" sequence_number="6" />
        </xs:appinfo>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute default="" name="extension" type="xs:string">
      <xs:annotation>
        <xs:appinfo>
          <b:fieldInfo justification="left" sequence_number="7" />
        </xs:appinfo>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute default="" name="date" type="xs:string">
      <xs:annotation>
        <xs:appinfo>
          <b:fieldInfo justification="left" sequence_number="8" />
        </xs:appinfo>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute default="" name="filler" type="xs:string">
      <xs:annotation>
        <xs:appinfo>
          <b:fieldInfo justification="left" sequence_number="9" />
        </xs:appinfo>
      </xs:annotation>
    </xs:attribute>
  </xs:complexType>
</xs:schema>

其中“选择”用于Root(因为子记录可以按任何顺序),并且“tag_name”用于将记录与架构元素匹配。

并运行fadsm实用程序

ffdasm "test1.psv" -bs "test1.xsd" -s -m "test1.xml" -v -s

得到这个

- <Root xmlns="http://xxxx.com/schemas/test1">
  <Header type="" description="A" xmlns="" /> 
  <Person group="CCC" id="111" seq="00" ssn="111111111" last="DOE" first="JOHN" mi="" gender="M PSN" dob="CCC|111|01|111111111|DOE|JANE|A|F|07/30/1975" xmlns="" /> 
  <Address group="CCC" id="111" seq="00" type="U" addr1="100 S 1ST #11" addr2="" city="ANYTOWN" country="US" state="XX" zip="55555" date="09/24/2013" filler="" xmlns="" /> 
  <Phone client_code="CCC" id="111" seq="00" type="U" country="US" number="5551111111" extension="" date="09/24/2013" filler="" xmlns="" /> 
  </Root>
  • 为什么标题(HDR)记录的第一个字段值(“A”)出错 (第二个)输出XML的属性?

  • 为什么记录分隔符(CRLF / 0x0D ox0A)会被忽略 第二个(PSN)记录的内容进入可选属性 架构设置时,结果XML中的先前记录 提前终止记录和可选字段?

和BTW

  • 为什么“tag_name”匹配的内容会从输出中省略 用于分隔文件的XML?固定长度的平面文件不会发生这种情况;在那些, tag_name数据保留在输出中。

非常感谢任何见解。

1 个答案:

答案 0 :(得分:1)

由于您定义的Infix的child_order,HDR中的第一个字段将转到第二个字段。 有三个子命令,Prefix,Infix,Postfix。

前缀表示分隔符出现在每个字段之前。 |1|2|3

中缀意味着它发生在每个字段之间。 1|2|3

Postfix意味着它发生在每个字段之后。 1|2|3|

现在您已选择了Infix。 所以让我们看看你的专栏。

HDR|A

你已经告诉它标签是HDR,所以它剥离了

的标签

|A

因为它是中缀,所以在|之前是字段1,后面是字段2。

你想要的是前缀。

如您所见,标签名称被剥离,它们将被视为记录名称。

对于被忽略的记录分隔符,如果它确实期望另一个它找不到的字段,则这是平面文件分解器的坏习惯,然后它消耗下一行以使其进入该字段。 再次检查您正在执行的子订单类型以及字段是否正确匹配。