Posted: Thu May 10, 2018 5:47 am Post subject: navigate tree and copy to Output
Newbie
Joined: 10 May 2018 Posts: 2
Hi, I'm trying to copy a message tree by changing the namespace, to do this I use a recursive function that works, until I try to go to the next sibling of the father , when the OutputReference loose the syncrony and start creating child in bad places.
This is the code im using for:
Code:
CREATE PROCEDURE navigate (IN root REFERENCE, INOUT Output REFERENCE)
BEGIN
DECLARE cursor REFERENCE TO root;
DECLARE cursorOut REFERENCE TO Output;
MOVE cursor FIRSTCHILD;
IF LASTMOVE(cursor) THEN
CREATE FIRSTCHILD OF cursorOut NAMESPACE nsT NAME FIELDNAME(cursor) VALUE FIELDVALUE(cursor);
MOVE cursorOut FIRSTCHILD;
ELSE
MOVE cursor NEXTSIBLING;
IF LASTMOVE(cursor) THEN
CREATE NEXTSIBLING OF cursorOut NAMESPACE nsT NAME FIELDNAME(cursor) VALUE FIELDVALUE(cursor);
END IF;
MOVE cursorOut NEXTSIBLING;
END IF;
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