复杂全局类型定义和命名
在 BizTalk 编辑器中,定义复杂全局类型的第一步是将第一个出现的复杂类型转换为全局类型后,在使用该全局类型的位置之一进行定义。 现在,以地址示例继续进行说明,在架构中定义发货地址时,定义复杂地址类型。
在定义复杂类型后,您可以通过为其指定类型名称来将其转换为全局复杂类型。 为此,请选择与复杂类型相对应(通常为 Record 节点)的节点,然后在该节点 的“数据结构类型 ”属性中键入新的类型名称。 尽管在为此属性命名 ((如 GlobalAddrType)时架构树中不会发生任何可见的更改,如以下示例) ,但如果检查架构的基础 XSD 表示形式中发生的情况,则会看到以下 (缩写) 更改。
以前,在 ShippingAddress 元素的上下文中首次定义地址结构时,发生了以下情况。
<xs:schema>
<xs:element name="Root">
<xs:complexType>
<xs:sequence>
<xs:element name="ShippingAddress">
[address structure initially defined here.]
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
在 ShippingAddress 节点在其 “数据结构类型” 属性中被赋予唯一名称后,导致该节点作为复杂的全局类型可用,并且要在架构中的多个位置重复使用,则会发生以下情况。
<xs:schema>
<xs:element name="Root">
<xs:complexType>
<xs:sequence>
<xs:element name="ShippingAddress" type="GlobalAddrType" />
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:complexType name="GlobalAddrType">
[address structure now defined globally here.]
</xs:complexType>
</xs:schema>