您可以按照访问元素的已知的多次出现和访问元素的未知的多次出现中给定的指导访问 MRM 域元素。在这个主题中提供进一步的 MRM 域消息的特定信息。
考虑以下语句:
DECLARE brw NAMESPACE 'http://www.ibm.com/Borrowed'; SET OutputRoot.MRM.brw:Borrowed[1].VideoTitle = 'MRM Greatest Hits Volume 1'; SET OutputRoot.MRM.brw:Borrowed[2].VideoTitle = 'MRM Greatest Hits Volume 2';
以上 SET 语句在元素 Borrowed 的两个出现上操作。 每个语句设置子代 VideoTitle 的值。数组下标表明您感兴趣的重复元素的出现。
当您在消息集中定义复杂类型(其 Composition 属性设置为 Sequence)的子元素时,可多次将同一元素添加到复杂类型中。这些实例不需要是相连的,但您必须使用同一方法(数组符号)来在 ESQL 中引用它们。
例如,如果您创建一个复杂类型,其 Composition 为 Sequence,且包含以下元素:
StringElement1 IntegerElement1 StringElement1
使用以下 ESQL 设置 StringElement1 的值:
SET OutputRoot.MRM.StringElement1[1] = 'This is the first occurrence of StringElement1'; SET OutputRoot.MRM.StringElement1[2] = 'This is the second occurrence of StringElement1';
您还可使用箭头符号(大于号“>”和小于号“<”)来表明搜索的方向和要指定的索引:
SET OutputRoot.MRM.StringElement1[>] = 'This is the first occurrence of StringElement1'; SET OutputRoot.MRM.StringElement1[<2] = 'This is the last but one occurrence of StringElement1'; SET OutputRoot.MRM.StringElement1[<1] = 'This is the last occurrence of StringElement1';
有关其他详细信息,请参阅访问元素的已知的多次出现和访问元素的未知的多次出现。