|
RSS Feed - WebSphere MQ Support
|
RSS Feed - Message Broker Support
|
 |
|
getting tree reference from a procedure |
« View previous topic :: View next topic » |
Author |
Message
|
sat_in_field |
Posted: Thu Dec 02, 2004 4:04 am Post subject: getting tree reference from a procedure |
|
|
Novice
Joined: 23 Jan 2003 Posts: 20
|
Hello,
I found some code by Craig B to navigate recursivly through an unknown xml tree to find a tag, http://www.mqseries.net/phpBB2/viewtopic.php?t=10065&highlight=lastmove+procedure. I have changed this a little to search for specific content of a tag in an unknown tree. The trace shows that this is working. However I need to return the reference from the procedure so that I can continue processing the data(parse the embedded swift). So far I have not been able to do this, does anyone have a possible solution? My code is below, please note that at present to quicky validate the success/failure i am just testing the FIELDNAME of the reference.
Many Thanks
Code: |
DECLARE foundMatch BOOLEAN FALSE;
DECLARE OutboundMsg REFERENCE TO InputRoot.XML.TPCIMessage.OutboundMessage;
CALL navigate (OutboundMsg, foundMatch, '{1:');
IF foundMatch = TRUE THEN
SET OutputRoot.XML.TPCIMessage.Tag = FIELDNAME(OutboundMsg);
END IF;
CREATE PROCEDURE navigate (INOUT OutboundMsg REFERENCE, INOUT foundMatch BOOLEAN, IN searchText CHAR)
BEGIN
DECLARE MatchingPattern CHARACTER;
DECLARE cursor REFERENCE TO OutboundMsg;
SET MatchingPattern = SUBSTRING(OutboundMsg FROM 1 FOR 3);
MOVE cursor FIRSTCHILD;
IF LASTMOVE(cursor) THEN
ELSE
IF MatchingPattern = searchText THEN
SET foundMatch = TRUE;
END IF;
END IF;
WHILE LASTMOVE(cursor) AND (foundMatch = FALSE) DO
CALL navigate(cursor, foundMatch, searchText);
MOVE cursor NEXTSIBLING;
END WHILE;
END;
|
|
|
Back to top |
|
 |
kirani |
Posted: Thu Dec 02, 2004 11:45 pm Post subject: |
|
|
Jedi Knight
Joined: 05 Sep 2001 Posts: 3779 Location: Torrance, CA, USA
|
|
Back to top |
|
 |
|
|
 |
|
Page 1 of 1 |
|
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
|
|
|
|