Try OpenEdge Now
skip to main content
BPM Events User's Guide
XML messages : New syntax for iteration
 

New syntax for iteration

Although there are slight syntax differences, it is possible to use the following do from statement to enumerate elements.
namespace po = "http://example.com/po";
val xml = …;
do {
  f(item1.a, item2.b);
}from
  item1 of xml *~ "po:a/po:b/po:c[@d > 100]",
  item2 of xml *~ "po:a/po:b[@x = ‘aa’]/po:e"
where
  item1.a > item2.b;
Although this will work, this syntax is difficult to understand because items are declared in the last part of the statement. In such cases, another syntax—foreach—, which has a syntax similar to that of for can be used.
* Foreach syntax for iteration