Websphere Message Broker: Accessing XML elements in ESQL



Websphere Message Broker: File in File out example. I have an XML file with repeating element structure. How can I access and modify value of a particular element in ESQL. I worte following code..



CREATE PROCEDURE CopyEntireMessage() BEGIN
--SET OutputRoot = InputRoot;
DECLARE I INTEGER 1;
DECLARE J INTEGER;
SET J = CARDINALITY(OutputRoot.*[]);
WHILE I < J DO
SET OutputRoot = InputRoot;
SET OutputRoot.XMLNS.student[I].name = 'XYZ';
SET I = I + 1;
END WHILE;
END;


But its not working. Picking up the file from input folder but i cannot see anything in Output folder. But if I comment



SET OutputRoot.XMLNS.student[I].name = 'XYZ';


then file is available in output folder as it is without any change.


My XML file is as below



<person>
<student>
<name>ABC</name>
<age>20</age>
<address>city1</address>
</student>
<student>
<name>PQR</name>
<age>20</age>
<address>city2</address>
</student>
</person>


can anybody help me on this?


No comments:

Post a Comment