The element Product occurs only once while the element Position occurs many times (up to 800).
Now, in the while loop responsible of the Position elements, I have tried to use a REFERENCE variable instead of OutputRoot.XML.Position[i] but I have some problems after the creation of the first occurence of the Position element. I have looked at many posts in this forum and tried many different instructions but with no success. Here is my code:
Code:
-- header >> Product
CREATE FIRSTCHILD OF OutputRoot.XML.Product;
DECLARE prod REFERENCE TO OutputRoot.XML.Product;
SET prod.idProduct = codProdotto;
etc etc
-- /header >> Product
SET cont = LENGTH(msgResiduo) / 236;
SET i = 1;
WHILE (i <= cont) DO
CREATE FIELD OutputRoot.XML.Position;
--CREATE NEXTSIBLING OF OutputRoot.XML NAME 'Position';
DECLARE pos REFERENCE TO OutputRoot.XML.Position[i];
SET body = SUBSTRING(msgResiduo FROM 1 FOR 236);
-- body >> Position
SET pos.idProduct = codProdotto;
etc etc
-- /body >> Position
SET msgResiduo = SUBSTRING(msgResiduo FROM 237);
SET i = i + 1;
END WHILE;
Once in the WHILE loop, the instruction "CREATE FIELD OutputRoot.XML.Position" does not create the second element Position in the OutputRoot.XML tree; consequently, all the elements created with the "pos" reference are added to the OutputRoot.XML tree but not under any Position element.
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum