Business Integration Connect 使用验证映射来验证 RosettaNet 消息的服务内容。 这些验证映射定义了有效消息的结构,并定义了消息中各元素的基数、格式和有效值(枚举)。 在各个 PIP 文档流包中,Business Integration Connect 提供验证映射,如 GuidelineMaps 目录中的 XSD 文件。
因为 RosettaNet 指定 PIP 消息的格式,所以通常您无需定制验证映射。 但是,如果您需要这样做,请参阅创建 PIP 文档流包, 了解对验证消息所用 XSD 文件进行升级需要执行的步骤,以及如何创建定制 PIP 文档流包。
基数决定特定元素在消息中可以或必须出现的次数。 在验证映射中,minOccurs 和 maxOccurs 属性决定下面示例(来自 BCG_5C4RegistrationStatusNotification_V01.02.xsd)中属性的基数:
<xsd:element name="GeographicRegion" type="GeographicRegionType" minOccurs="0"/>
如果 Business Integration Connect 不需要检查元素的基数,则验证映射中元素的 minOccurs 和 maxOccurs 属性的值分别为“0”和“unbounded”,如下面的示例所示:
<xsd:element name="DesignRegistrationIdentification" type="DesignRegistrationIdentificationType2" minOccurs="0" maxOccurs="unbounded"/>
格式决定某类元素的数据安排或布局。 在验证映射中,类型有一个或多个限制,如以下示例所示;
示例 1:
<xsd:simpleType name="_common_LineNumber_R"> <xsd:restriction base="xsd:string"> <xsd:minLength value="1" /> <xsd:maxLength value="6" /> </xsd:restriction> </xsd:simpleType>
消息中所有 _common_LineNumber_R 类型的元素都必须是字符串, 并且长度必须是 1 到 6 个字符。
示例 2:
<xsd:simpleType name="_GlobalLocationIdentifier"> <xsd:restriction base="xsd:string"> <xsd:pattern value="[0-9]{9}.{1,4}" /> </xsd:restriction> </xsd:simpleType>
消息中所有 _GlobalLocationIdentifier 类型的元素都必须是字符串, 并且必须有 9 个数字数据,而且其后还必须有 1 到 4 个字母数字数据。因此,它的最小长度为 10 个字符,最大长度为 13。
示例 3:
<xsd:element name="DayOfMonth"> <xsd:simpleType> <xsd:restriction base="xsd:positiveInteger"> <xsd:totalDigits value="2" /> <xsd:minInclusive value="1" /> <xsd:maxInclusive value="31" /> </xsd:restriction> </xsd:simpleType> </xsd:element>
消息中的所有 _GlobalLocationIdentifier 类型的元素必须是 1 到 2 位的正整数,并且值必须在 1 到 31 之间。
枚举决定元素的有效值。 在验证映射中,元素的类型有一个或多个枚举限制,如下面的示例所示:
<xsd:simpleType name="_local_GlobalDesignRegistrationNotificationCode"> <xsd:restriction base="xsd:string"> <xsd:enumeration value="Initial" /> <xsd:enumeration value="Update" /> </xsd:restriction> </xsd:simpleType>
消息中所有 _local_GlobalDesignRegistrationNotificationCode 类型的元素都只能用“Initial”或“Update”作为它们的值。