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 » IIB9 | Mapping Node - Output Looping

Post new topic  Reply to topic
 IIB9 | Mapping Node - Output Looping « View previous topic :: View next topic » 
Author Message
abcnil
PostPosted: Wed Jul 06, 2016 6:33 am    Post subject: IIB9 | Mapping Node - Output Looping Reply with quote

Apprentice

Joined: 29 Mar 2012
Posts: 36

I have restriction to use only Mapping node

I am having this requirement:
We have comma separated String coming in and loop it over in output

Input Message:
Code:
<Input>
<String>A,B,C</String>
</Input>



Output Message:
Code:
<Output>
<Loop>
  <Code>A</Code>
</Loop>
<Loop>
  <Code>B</Code>
</Loop>
<Loop>
  <Code>C</Code>
</Loop>
</Output>



Can we somehow achieve this in Mapping node may using XPath?

Tried using fn:tokenize to split the string but not sure how we can loop it over the Output element.

What would be the best options to do this in mapping node if any?
Back to top
View user's profile Send private message
abcnil
PostPosted: Wed Jul 06, 2016 9:44 am    Post subject: Reply with quote

Apprentice

Joined: 29 Mar 2012
Posts: 36

Done with Custom Java

Code:


   public static MbElement mbElMove(MbElement inString) throws MbException {
      String string = inString.getValueAsString();
      String[] array = string.split(",");
      MbElement root = inString.copy();
      MbElement loop = root.createElementAsFirstChild(MbElement.TYPE_NAME,"Loop", null);
      try {
         for (int i = 0; i < array.length; i++) {

            MbElement code = loop.createElementAsLastChild(
                  MbElement.TYPE_NAME, "Code", null);
            code.setValue(array[i]);
         }

      } catch (MbException e) {
         throw (new RuntimeException(e));
      }
      return loop;
   }

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 » IIB9 | Mapping Node - Output Looping
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.