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 » Access XML tag with the same prefix

Post new topic  Reply to topic
 Access XML tag with the same prefix « View previous topic :: View next topic » 
Author Message
KIT_INC
PostPosted: Fri Jun 04, 2010 9:09 am    Post subject: Access XML tag with the same prefix Reply with quote

Knight

Joined: 25 Aug 2006
Posts: 589

I have an Input XML which contains a variable number of tags all prefixed with AA , the xx, yy ww can be anything.

<TEST_MSG>
<DATA>
<AA_xx>nn</<AA_xx>
<AA_yy>qq</AA_yy>

:
<AA_ww>rr</AA_ww>
<BB/>
<CC/>
<DD/>
</DATA>
</TEST_MSG>

I need to access these AA* fileds to create the output message. IF I do a cardinality under TEST_MSG.DATA, I am counting the BB and the CCs also. One way I can think of is to get the total number of elements under DATA and get the fieldnames one by one and compare if it has the AA prefix. This seems too tedious because there can be hundreds of elements under DATA. Any suggestion on how I can get the count and the fieldnames names ?
Back to top
View user's profile Send private message
fatherjack
PostPosted: Fri Jun 04, 2010 9:17 am    Post subject: Re: Access XML tag with the same prefix Reply with quote

Knight

Joined: 14 Apr 2010
Posts: 522
Location: Craggy Island

KIT_INC wrote:
One way I can think of is to get the total number of elements under DATA and get the fieldnames one by one and compare if it has the AA prefix. This seems too tedious because there can be hundreds of elements under DATA.


But if you need the contents of those elements to construct your output message don't you have to access them one by one anyway?
_________________
Never let the facts get in the way of a good theory.
Back to top
View user's profile Send private message
KIT_INC
PostPosted: Fri Jun 04, 2010 10:26 am    Post subject: Reply with quote

Knight

Joined: 25 Aug 2006
Posts: 589

But all I need is the AA*, not the BBs and CCs which may may hundreds.
Back to top
View user's profile Send private message
mgk
PostPosted: Fri Jun 04, 2010 12:21 pm    Post subject: Reply with quote

Padawan

Joined: 31 Jul 2003
Posts: 1642

You go not need to count all the elements. You can either do the transform directly into the output message using a SELECT, or use a REFERENCE variable and move it over each element, testing its FIELDNAME and STARTSWITH('AA') until Lthe ASTMOVE returns FALSE...

Regards,
_________________
MGK
The postings I make on this site are my own and don't necessarily represent IBM's positions, strategies or opinions.
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 » Access XML tag with the same prefix
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.