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 » Parsing XML without knowing the first tag name

Post new topic  Reply to topic
 Parsing XML without knowing the first tag name « View previous topic :: View next topic » 
Author Message
KSkelton
PostPosted: Wed Apr 16, 2003 5:32 am    Post subject: Parsing XML without knowing the first tag name Reply with quote

Apprentice

Joined: 28 Oct 2001
Posts: 45

Is there a way to access a tag value from XML without knowing the name of the top-most tag?

For instance, say I have a message flow which receives various forms of XML which have to be routed based on the second tag:

<input1><route_label>high</route_label></input1>
<input2><route_label>low</route_label></input2>
<input3><route_label>mid</route_label></input3>

Normally I would set the local environment request variable with:
Set stuff = InputRoot.XML.Input.route_label.

However, I cannot do this since the first tag name is unknown (input#).
Is there a way to access the route_label tag without referencing the input tag?
I've tried XML.Element[1] etc... No luck?
Back to top
View user's profile Send private message Visit poster's website
jefflowrey
PostPosted: Wed Apr 16, 2003 6:48 am    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

You don't say what version of WMQI you are using. If you are using 2.1, you can use a reference to do this.
Code:
declare aRef reference to InputRoot.XML;
move aRef FIRSTCHILD;
if aRef.route_label = 'high' then
    --set routing for high
end if;


If your document has DOCTYPE decls or other processing instructions, you should replace FIRSTCHILD with LASTCHILD, as that's where the root tag will be.

Or you can try
Code:
InputRoot.XML.*[1].route_label
or
Code:
InputRoot.XML.*[LAST].route_label
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 » Parsing XML without knowing the first tag name
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.