任务:由于上一节传递到OutQ和OutQ1中的地址仍为原来的形式,现需要修改成对应的文字,即把
<address>大连/上海</address>变成<address>大连</address>或<address>上海</address>的形式。
1.修改Compute节点的ESQL,增加修改输出XML的一句:
CREATE COMPUTE MODULE flow_Compute
CREATE FUNCTION Main() RETURNS BOOLEAN
BEGIN
DECLARE Address CHARACTER;
DECLARE Addresses CHARACTER InputRoot.XML.mail.address;
DECLARE I INTEGER 0;
DECLARE J INTEGER;
DECLARE LEN INTEGER LENGTH(Addresses);
WHILE (I<LEN) DO
SET OutputRoot = InputRoot;
SET J=I+1;
SET Address=SUBSTRING(Addresses FROM J FOR 2);
SET OutputRoot.XML.mail.address=Address;-- 修改输出的地址部分
SET OutputLocalEnvironment.Destination.RouterList.DestinationData[1].labelName = Address;
PROPAGATE;
SET I=J+2;
END WHILE;
RETURN FALSE;
END;
END MODULE;
2.下图显示了修改地址后的结果:
-The End-