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 » Recursive XML Parsing

Post new topic  Reply to topic
 Recursive XML Parsing « View previous topic :: View next topic » 
Author Message
RAJESHRAMAKRISHNAN
PostPosted: Sat Oct 26, 2013 10:25 pm    Post subject: Recursive XML Parsing Reply with quote

Voyager

Joined: 01 May 2004
Posts: 96

Hello All

Have a requirement where I need to traverse through an XML that would be nested at each level. I need to traverse through all the levels. Have written a simple recursive procedure and it works fine. But I am afraid that a recursive logic can result in stack exception when parsing through an XML when the depth is high.

Can some one please point to alternate methods of achieving the same? Would like to do it in ESQL rather than Java.

Regards
Rajesh
Back to top
View user's profile Send private message
Simbu
PostPosted: Sun Oct 27, 2013 12:02 am    Post subject: Reply with quote

Master

Joined: 17 Jun 2011
Posts: 289
Location: Tamil Nadu, India

dogorsy wrote:
kimbert wrote:
Check out the namespace sample - it contains some code that allows you to recursively walk a message tree and add/remove namespaces.


Interesting sample, but there is an esql example that I like a lot better ( it is a recursive function ) and navigates the whole tree, the starting point is decided on the 1st call to it. Needs some changing to alter/add/remove namespaces, but nothing to complicated
The function is Navigate, can be found under CREATE PROCEDURE statement, esql example 2
Back to top
View user's profile Send private message
mqsiuser
PostPosted: Sun Oct 27, 2013 2:16 pm    Post subject: Re: Recursive XML Parsing Reply with quote

Yatiri

Joined: 15 Apr 2008
Posts: 637
Location: Germany

Think about what a (recursive) function-call gives you:

It gives you the ability to pass in parameters as IN and INOUT and get a return OUT.

If you manage that yourself, then you will avoid the overhead that a function call creates and also the abend, that might occur when the function callstack becomes too deep (somewhere between 100 and 1000).

Just use loops and "move first child"

Use simple variables (e.g. recDepth) and use the Environment/Input/Output-Trees for complex data.

For performance "implement your own recursion" (and don't (nessesarily) use function-call recursion). Consider function call recursion as an option (with drawbacks) and use and walk the message trees to base your processing on.
_________________
Just use REFERENCEs
Back to top
View user's profile Send private message
dogorsy
PostPosted: Mon Oct 28, 2013 12:42 am    Post subject: Reply with quote

Knight

Joined: 13 Mar 2013
Posts: 553
Location: Home Office

There is a recursive ESQL function documented in the control centre. look at CREATE procedure ESQL example 2
the function is called navigate.
Back to top
View user's profile Send private message
mqjeff
PostPosted: Mon Oct 28, 2013 1:46 am    Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

Here's the thing, though.

Tree walking only uses as much stack as the depth of the tree you're walking.

I've never seen an XML message that was very deep. Certainly very *wide*, lots of children all at the same level.

But I've never seen an XML message with, say, even 50 nested levels of child elements. Or, really, more than 10.

So unless you know for a fact that as your messages get bigger, they get more nested layers, you're probably okay using recursion.
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 » Recursive XML Parsing
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.