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 » How to create an xml output tree (sub tree) dynamically

Post new topic  Reply to topic
 How to create an xml output tree (sub tree) dynamically « View previous topic :: View next topic » 
Author Message
vdharanikota
PostPosted: Fri Jul 25, 2014 2:23 am    Post subject: How to create an xml output tree (sub tree) dynamically Reply with quote

Novice

Joined: 07 Jul 2014
Posts: 18

hi
I'm new to wmb. My input and output tree are as follows :
input tree:
Code:
<root>
   <people>
      <person>
         <fname>1</name>
         <lname>2</name>
      </person>
      <person>
         <fname>1</name>
         <lname>2</name>
      </person>
   </people>
</root>


output tree:
Code:
<root2>
   <people>
      <nnick>
         <nickname></nickname>
         <nickname2></nickname2>
      </nnick>
   </people>
</root2>

I'm using Compute node for transformation....
My problem is to create a child dynamically basing on the condition-- if cardinality of <person>sub tree in input tree is 2 then <nnick> sub tree in outputtree has to be created 2 times.
if cardinality of <person>sub tree in input tree is 4 then <nnick> sub tree in output tree has to be created 4 times. plz help me
Back to top
View user's profile Send private message
Vitor
PostPosted: Fri Jul 25, 2014 4:31 am    Post subject: Re: How to create an xml output tree (sub tree) dynamically Reply with quote

Grand High Poobah

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

vdharanikota wrote:
if cardinality of <person>sub tree in input tree is 2 then <nnick> sub tree in outputtree has to be created 2 times.
if cardinality of <person>sub tree in input tree is 4 then <nnick> sub tree in output tree has to be created 4 times. plz help me


Help with what? You've correctly identified that you need to generate one <nnick> stanza for each input <person>; so what are you stuck on? There's no conceptual difference in ESQL (you mention Compute so I assume ESQL) between creating a single stanza and 1-n stanzas.

If you can explain your problem in a bit more detail, you might get some more detailed advice.
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
McueMart
PostPosted: Fri Jul 25, 2014 9:13 am    Post subject: Reply with quote

Chevalier

Joined: 29 Nov 2011
Posts: 490
Location: UK...somewhere

Code:
DECLARE count INTEGER 0;

FOR person AS InputRoot.XMLNSC.root.people.person[] DO
    CREATE LASTCHILD OF OutputRoot.XMLNSC.root2.people.nnick NAME 'nickname' || CAST(count AS CHARACTER) VALUE 'Blokey' ||person.fname;
    SET count = count + 1;
END FOR;


I think this will do what you are after (well almost!) - but this is pretty basic - in future please try yourself , and ask question only if you have problems.
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 » How to create an xml output tree (sub tree) dynamically
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.