ASG
IBM
Zystems
Cressida
Icon
Netflexity
 
  MQSeries.net
Search  Search       Tech Exchange      Education      Certifications      Library      Info Center      SupportPacs      LinkedIn  Search  Search                                                                   FAQ  FAQ   Usergroups  Usergroups
 
Register  ::  Log in Log in to check your private messages
 
RSS Feed - WebSphere MQ Support RSS Feed - Message Broker Support

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » Sequential processing of an XML

Post new topic  Reply to topic
 Sequential processing of an XML « View previous topic :: View next topic » 
Author Message
deepeshk79
PostPosted: Sun Dec 27, 2009 3:55 pm    Post subject: Sequential processing of an XML Reply with quote

Apprentice

Joined: 25 Mar 2007
Posts: 45
Location: Los Angeles

Hi,

I have the below simple code to navigate through an XML sequentially

Code:

   CREATE PROCEDURE navigate (IN root REFERENCE)
      BEGIN
         DECLARE cursor REFERENCE TO root;
         DECLARE cursorname CHARACTER '';
         SET cursorname = FIELDNAME(cursor);
         MOVE cursor FIRSTCHILD;
         WHILE LASTMOVE(cursor) DO
            CALL navigate(cursor);
            MOVE cursor NEXTSIBLING;
            SET cursorname = FIELDNAME(cursor);
         END WHILE;         
      END;


My input file looks like below
Code:

<Task a='1' b='2'>
<print>test</print>
</Task>


My confusion here is that when my cursor is pointing at the attribute 'b' of Task tag, my NEXTSIBLING and FIRSTCHILD both should fail and the logic should throw me out of loop but it continues processing and gets me great results. Not sure how this works...

Any thoughts ?

Deepesh
Back to top
View user's profile Send private message AIM Address
Vitor
PostPosted: Sun Dec 27, 2009 5:48 pm    Post subject: Re: Sequential processing of an XML Reply with quote

Grand High Poobah

Joined: 11 Nov 2005
Posts: 26093
Location: Texas, USA

deepeshk79 wrote:
My confusion here is that when my cursor is pointing at the attribute 'b' of Task tag, my NEXTSIBLING and FIRSTCHILD both should fail and the logic should throw me out of loop but it continues processing and gets me great results. Not sure how this works...


Why?

deepeshk79 wrote:
Any thoughts ?


Have another look at the structure of your XML.
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Sun Dec 27, 2009 10:43 pm    Post subject: Reply with quote

Grand High Poobah

Joined: 18 Nov 2003
Posts: 20756
Location: LI,NY

Working as designed. If you wanted to be thrown out of the loop you would need logic to check the fieldtype against the previous fieldtype...
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
imakash
PostPosted: Sun Dec 27, 2009 11:15 pm    Post subject: Reply with quote

Newbie

Joined: 22 Dec 2009
Posts: 7

<Print> is NEXT SIBLING of b
Back to top
View user's profile Send private message
mqjeff
PostPosted: Mon Dec 28, 2009 7:26 am    Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

fjb_saper wrote:
Working as designed. If you wanted to be thrown out of the loop you would need logic to check the fieldtype against the previous fieldtype...


Or adjust the move statement
Back to top
View user's profile Send private message
deepeshk79
PostPosted: Mon Dec 28, 2009 3:24 pm    Post subject: Reply with quote

Apprentice

Joined: 25 Mar 2007
Posts: 45
Location: Los Angeles

I just wonder sometimes that how can <print> be next sibling to the attribute 'b'. Basically attribute 'b' is within element <Task> and its not having any siblings. <Print> is a child of <Task> of type element.
Back to top
View user's profile Send private message AIM Address
mqjeff
PostPosted: Mon Dec 28, 2009 4:05 pm    Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

Using a trace node would stop your wondering.
Back to top
View user's profile Send private message
Vitor
PostPosted: Mon Dec 28, 2009 6:28 pm    Post subject: Reply with quote

Grand High Poobah

Joined: 11 Nov 2005
Posts: 26093
Location: Texas, USA

deepeshk79 wrote:
I just wonder sometimes that how can <print> be next sibling to the attribute 'b'.


I just wonder how you can ask such a thing. Assuming you've read anything on XML. Even if not, a brief examination of the parsed message tree will yield an explaination. Or the XML after it's been through any parser.
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » Sequential processing of an XML
Jump to:  



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
Protected by Anti-Spam ACP
 
 


Theme by Dustin Baccetti
Powered by phpBB © 2001, 2002 phpBB Group

Copyright © MQSeries.net. All rights reserved.