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 » WMB JAVA, iterate through an array

Post new topic  Reply to topic
 WMB JAVA, iterate through an array « View previous topic :: View next topic » 
Author Message
bobbee
PostPosted: Sun Mar 03, 2013 4:42 pm    Post subject: WMB JAVA, iterate through an array Reply with quote

Knight

Joined: 20 Sep 2001
Posts: 545
Location: Tampa

If I have an XMLNSC structure:
<INFOBLOCK>
<Error>
<errorcode>1234</errorcode>
<errordesc>bad</errordesc>
</Error>
<Error>
<errorcode>1234</errorcode>
<errordesc>bad</errordesc>
</Error>
<Error>
<errorcode>1234</errorcode>
<errordesc>bad</errordesc>
</Error>
</INFOBLOCK>


In a java compute node how do I iterate through the repeating elements
Back to top
View user's profile Send private message Send e-mail AIM Address
McueMart
PostPosted: Mon Mar 04, 2013 1:26 am    Post subject: Reply with quote

Chevalier

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

Show us the code you have, and what you have tried, and i'm certain someone will help you. But you are unlikely to find someone who will write all the code for you.
Back to top
View user's profile Send private message
nukalas2010
PostPosted: Mon Mar 04, 2013 1:50 am    Post subject: Reply with quote

Master

Joined: 04 Oct 2010
Posts: 220
Location: Somewhere in the World....

You can try something like this...

Code:
MbElement oReqRoot   = contact admin.getMessage().getRootElement();
MbElement oInfoBlock = oReqRoot.getFirstElementByPath("/XMLNSC/INFOBLOCK/Error");
String errcode = null;

while(oInfoBlock !=null)
{
      errocode = oInfoBlock.getFirstElementByPath("errorcode").getValueAsString();

   ---- etc etc
   oInfoBlock = oInfoBlock.getNextSibling();
}
Back to top
View user's profile Send private message
bobbee
PostPosted: Mon Mar 04, 2013 6:22 am    Post subject: Reply with quote

Knight

Joined: 20 Sep 2001
Posts: 545
Location: Tampa

Thanks for the sample. That is what I was looking for. The InfoCenter had nothing and searching Google produced nothing. Probably my search parms as I would have thought this was a 'given'. I don't normally post if I can find it. This was one of those times. Have a great day, I will now. Thanks for help.
Back to top
View user's profile Send private message Send e-mail AIM Address
kimbert
PostPosted: Mon Mar 04, 2013 6:26 am    Post subject: Reply with quote

Jedi Council

Joined: 29 Jul 2003
Posts: 5542
Location: Southampton

v8 users may find it easier to generate JAXB classes from their xsds, as described here: http://publib.boulder.ibm.com/infocenter/wmbhelp/v8r0m0/topic/com.ibm.etools.mft.doc/ac49010_.htm
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 » WMB JAVA, iterate through an array
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.