我目前正在创建一个平面文件模式来实现一种名为 Tradacoms 的旧英国 EDI 格式。我已经复制了我正在处理的部分模式所需的内容,它通常工作正常。但是,由于架构中有很多可选项目,我需要将解析器优化更改为复杂性。
为了轻松解释这个问题,我将这个问题复制到一个更小的模式(实际上与 Tradacoms 无关)。
<?xml version="1.0" encoding="utf-16"?>
<xs:schema xmlns="http://Bidvest.Integration.Supplier.Schemas.TestSchema" xmlns:b="http://schemas.microsoft.com/BizTalk/2003" targetNamespace="http://Bidvest.Integration.Supplier.Schemas.TestSchema" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:annotation>
<xs:appinfo>
<b:schemaInfo standard="Flat File" root_reference="Root" 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="false" early_terminate_optional_fields="false" allow_message_breakup_of_infix_root="false" compile_parse_tables="false" />
<schemaEditorExtension:schemaInfo namespaceAlias="b" extensionClass="Microsoft.BizTalk.FlatFileExtension.FlatFileExtension" standardName="Flat File" xmlns:schemaEditorExtension="http://schemas.microsoft.com/BizTalk/2003/SchemaEditorExtensions" />
</xs:appinfo>
</xs:annotation>
<xs:element name="Root">
<xs:annotation>
<xs:appinfo>
<b:recordInfo structure="delimited" preserve_delimiter_for_empty_data="true" suppress_trailing_delimiters="false" sequence_number="1" child_order="infix" child_delimiter_type="char" child_delimiter="+" />
</xs:appinfo>
</xs:annotation>
<xs:complexType>
<xs:sequence>
<xs:annotation>
<xs:appinfo>
<b:groupInfo sequence_number="0" />
</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 minOccurs="0" name="Address">
<xs:annotation>
<xs:appinfo>
<b:recordInfo sequence_number="2" structure="delimited" preserve_delimiter_for_empty_data="false" suppress_trailing_delimiters="false" child_order="infix" child_delimiter_type="char" child_delimiter=":" />
</xs:appinfo>
</xs:annotation>
<xs:complexType>
<xs:sequence>
<xs:annotation>
<xs:appinfo>
<b:groupInfo sequence_number="0" />
</xs:appinfo>
</xs:annotation>
<xs:element minOccurs="0" name="Line1" type="xs:string">
<xs:annotation>
<xs:appinfo>
<b:fieldInfo justification="left" sequence_number="1" />
</xs:appinfo>
</xs:annotation>
</xs:element>
<xs:element minOccurs="0" name="Line2" type="xs:string">
<xs:annotation>
<xs:appinfo>
<b:fieldInfo justification="left" sequence_number="2" />
</xs:appinfo>
</xs:annotation>
</xs:element>
<xs:element minOccurs="0" name="Line3" type="xs:string">
<xs:annotation>
<xs:appinfo>
<b:fieldInfo justification="left" sequence_number="3" />
</xs:appinfo>
</xs:annotation>
</xs:element>
<xs:element minOccurs="0" name="Line4" type="xs:string">
<xs:annotation>
<xs:appinfo>
<b:fieldInfo justification="left" sequence_number="4" />
</xs:appinfo>
</xs:annotation>
</xs:element>
<xs:element minOccurs="0" name="Line5" type="xs:string">
<xs:annotation>
<xs:appinfo>
<b:fieldInfo justification="left" sequence_number="5" />
</xs:appinfo>
</xs:annotation>
</xs:element>
<xs:element minOccurs="0" name="PostCode" type="xs:string">
<xs:annotation>
<xs:appinfo>
<b:fieldInfo justification="left" sequence_number="6" />
</xs:appinfo>
</xs:annotation>
</xs:element>
<xs:element minOccurs="0" name="Country" type="xs:string">
<xs:annotation>
<xs:appinfo>
<b:fieldInfo sequence_number="7" justification="left" />
</xs:appinfo>
</xs:annotation>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
该模式包含一个名称元素和一个地址记录,该记录本身具有许多可选元素。
如果我使用下面的测试文件验证一个实例(右键单击架构等)
DAve+Line1:Line2:Line3:Line4:Line5:PostCode:Country
然后我按预期得到下面的输出
<Root xmlns="http://Bidvest.Integration.Supplier.Schemas.TestSchema">
<Name xmlns="">DAve</Name>
<Address xmlns="">
<Line1>Line1</Line1>
<Line2>Line2</Line2>
<Line3>Line3</Line3>
<Line4>Line4</Line4>
<Line5>Line5</Line5>
<PostCode>PostCode</PostCode>
<Country>Country</Country>
</Address>
</Root>
如果我使用如下非常简单的消息验证实例
DAve+Line1
然后我得到以下输出
<Root xmlns="http://Bidvest.Integration.Supplier.Schemas.TestSchema">
<Name xmlns="">DAve</Name>
<Address xmlns="">
<Line4>Line1</Line4>
</Address>
</Root>
可以看到 Line1 已经放在了 Line4 元素中。由于上面的示例消息将文本“Line1”作为分隔符之前的第一个值,我原以为上面的 XML 是 Line1。
这里正在发生一些非常奇怪的事情。任何人都可以帮忙吗?我在 BizTalk 2013 (CU3) 和 BizTalk 2013 R2 中有这个问题。