[英]Understanding BizTalk flat file schemas
我正在尝试修改BizTalk平面文件向导生成的架构。 这非常复杂,我宁愿花几天时间让向导再次使某些事情变得可行。
输入是一个复杂的文件,由回车/换行分隔的记录组成。 当前只有一行,前面有一个标签来标识它。 他们想增加接受当前行或其他相似行的功能。
我需要以任何顺序排列的任意两行中的任何一个。
我为第一行之后的第二行创建了定义。 然后,我用Choice节点将两条线定义包围起来。 选择节点设置为minOccurs =“ 0” maxOccurs =“ unbounded”。 我认为这将给我任何一行的任意数量的块:
<xs:choice minOccurs="0" maxOccurs="unbounded">
<xs:annotation>
<xs:appinfo>
<b:recordInfo structure="delimited" preserve_delimiter_for_empty_data="true" suppress_trailing_delimiters="false" sequence_number="2" />
</xs:appinfo>
</xs:annotation>
<xs:element name="GROS">
<xs:annotation>
<xs:appinfo>
<b:recordInfo structure="positional" tag_name="GROS" tag_offset="0" sequence_number="1" preserve_delimiter_for_empty_data="true" suppress_trailing_delimiters="false" />
</xs:appinfo>
</xs:annotation>
...
</xs:element>
<xs:element name="GRSD">
<xs:annotation>
<xs:appinfo>
<b:recordInfo structure="positional" tag_name="GRSD" tag_offset="0" sequence_number="1" preserve_delimiter_for_empty_data="true" suppress_trailing_delimiters="false" />
</xs:appinfo>
</xs:annotation>
...
</xs:element>
</xs:choice>
它在第三行失败:
GROS ...
GRSD ...
GRSD ...
有什么建议么? 我的脑袋疼。
给定一个看起来像的有效载荷
GROS1234567890 CR LF
GRSD1234567890 CR LF
GRSD1234567890 CR LF
以下架构将很高兴地通过标签然后通过位置解析
<?xml version="1.0" encoding="utf-16"?>
<xs:schema xmlns="http://Scratch.FlatFileSchema40516683" xmlns:b="http://schemas.microsoft.com/BizTalk/2003" targetNamespace="http://Scratch.FlatFileSchema40516683" 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="Root" />
</xs:appinfo>
</xs:annotation>
<xs:element name="Root">
<xs:annotation>
<xs:appinfo>
<recordInfo sequence_number="1" structure="delimited" preserve_delimiter_for_empty_data="true" suppress_trailing_delimiters="false" xmlns="http://schemas.microsoft.com/BizTalk/2003" />
</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:choice minOccurs="0" maxOccurs="unbounded">
<xs:annotation>
<xs:appinfo>
<groupInfo sequence_number="1" xmlns="http://schemas.microsoft.com/BizTalk/2003" />
</xs:appinfo>
</xs:annotation>
<xs:element name="GROS">
<xs:annotation>
<xs:appinfo>
<recordInfo sequence_number="1" structure="delimited" preserve_delimiter_for_empty_data="true" suppress_trailing_delimiters="false" tag_name="GROS" child_order="postfix" child_delimiter_type="hex" child_delimiter="0x0D 0x0A" xmlns="http://schemas.microsoft.com/BizTalk/2003" />
</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="Fields">
<xs:annotation>
<xs:appinfo>
<recordInfo sequence_number="1" structure="positional" preserve_delimiter_for_empty_data="true" suppress_trailing_delimiters="false" xmlns="http://schemas.microsoft.com/BizTalk/2003" />
</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="Field" type="xs:string">
<xs:annotation>
<xs:appinfo>
<fieldInfo sequence_number="1" justification="left" pos_length="5" xmlns="http://schemas.microsoft.com/BizTalk/2003" />
</xs:appinfo>
</xs:annotation>
</xs:element>
<xs:element name="Field2" type="xs:string">
<xs:annotation>
<xs:appinfo>
<fieldInfo sequence_number="2" justification="left" pos_length="5" xmlns="http://schemas.microsoft.com/BizTalk/2003" />
</xs:appinfo>
</xs:annotation>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="GRSD">
<xs:annotation>
<xs:appinfo>
<recordInfo sequence_number="2" structure="delimited" preserve_delimiter_for_empty_data="true" suppress_trailing_delimiters="false" child_delimiter_type="hex" child_delimiter="0x0D 0x0A" child_order="postfix" tag_name="GRSD" xmlns="http://schemas.microsoft.com/BizTalk/2003" />
</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="Fields">
<xs:annotation>
<xs:appinfo>
<recordInfo structure="positional" preserve_delimiter_for_empty_data="true" suppress_trailing_delimiters="false" sequence_number="1" xmlns="http://schemas.microsoft.com/BizTalk/2003" />
</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="Field" type="xs:string">
<xs:annotation>
<xs:appinfo>
<fieldInfo sequence_number="1" justification="left" pos_length="5" xmlns="http://schemas.microsoft.com/BizTalk/2003" />
</xs:appinfo>
</xs:annotation>
</xs:element>
<xs:element name="Field2" type="xs:string">
<xs:annotation>
<xs:appinfo>
<fieldInfo sequence_number="2" justification="left" pos_length="5" xmlns="http://schemas.microsoft.com/BizTalk/2003" />
</xs:appinfo>
</xs:annotation>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:choice>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
输出量
<Root xmlns="http://Scratch.FlatFileSchema40516683">
<GROS xmlns="">
<Fields>
<Field>12345</Field>
<Field2>67890</Field2>
</Fields>
</GROS>
<GRSD xmlns="">
<Fields>
<Field>12345</Field>
<Field2>67890</Field2>
</Fields>
</GRSD>
<GRSD xmlns="">
<Fields>
<Field>12345</Field>
<Field2>67890</Field2>
</Fields>
</GRSD>
</Root>
主要区别在于,我已将Fields记录(位置)放在加标签的记录(由CR LF分隔)下方。
请注意,这仅在所有记录都以CR LF结尾的情况下才有效,因为定界符被定义为Postfix(请在此定界符之后)。
我终于能够通过横向操作使其正常工作。 我修改了现有节点,并用“ TagIdentifier”字符串字段替换了记录标识标签。 这就满足了以不同组合使用多种类型节点的需求。 我修改了地图以测试字符串字段的内容,以确定接收到哪种记录类型。
这只会起作用,因为否则两条记录是相同的。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.