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 » XML Field Lookup Using ESQL

Post new topic  Reply to topic
 XML Field Lookup Using ESQL « View previous topic :: View next topic » 
Author Message
samgn123
PostPosted: Wed Nov 05, 2008 1:08 am    Post subject: XML Field Lookup Using ESQL Reply with quote

Newbie

Joined: 04 Nov 2008
Posts: 8

Hi All,
I am new to message broker . Please help me in this task, which seems to be simple but yet tricky.
I want to lookup for a particular XML Element/Attribute to check whether is present in the Input Message .
I tried treating the whole XML as String and using POSITION. But that seems to be a improper way to do so. Please help me in this regard

Thanks,
Samgn
Back to top
View user's profile Send private message
Gaya3
PostPosted: Wed Nov 05, 2008 1:59 am    Post subject: Reply with quote

Jedi

Joined: 12 Sep 2006
Posts: 2493
Location: Boston, US

you can easily do by checking that attribute/element is NULL or not

there is no need to make it as a string and do the same.
_________________
Regards
Gayathri
-----------------------------------------------
Do Something Before you Die
Back to top
View user's profile Send private message
kimbert
PostPosted: Wed Nov 05, 2008 2:30 am    Post subject: Reply with quote

Jedi Council

Joined: 29 Jul 2003
Posts: 5542
Location: Southampton

Quote:
I tried treating the whole XML as String and using POSITION. But that seems to be a improper way to do so
I would not say 'improper'. That approach is inaccurate, unmaintainable, and as far from 'best practice' as I can imagine. You should never parse any kind of message using ESQL unless your message format is trivially simple. Parsing XML using ESQL is just an awful idea.

You need to
- Set the Domain to XMLNSC on the input node
- Do what Gaya3 suggested

I strongly recommend that you get some training in how to use the product, or else work through the Samples Gallery and do some self-training.
Back to top
View user's profile Send private message
samgn123
PostPosted: Wed Nov 05, 2008 9:40 pm    Post subject: Reply with quote

Newbie

Joined: 04 Nov 2008
Posts: 8

Thanks for the response. Will try to do the same. But what if I have to lookup for an element which does not have a full path attached to that, just like "Firstname" . You do not know where it is and have to lookup in the whole XML.
Back to top
View user's profile Send private message
Vitor
PostPosted: Thu Nov 06, 2008 2:25 am    Post subject: Reply with quote

Grand High Poobah

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

samgn123 wrote:
But what if I have to lookup for an element which does not have a full path attached to that, just like "Firstname" . You do not know where it is and have to lookup in the whole XML.


All XML elements have a path, even if it's the root!

If you put the message on the XMLNSC Domain you'll get a fully parsed message tree and you can traverse it with any technique you like. Any of these will be easier to manage & maintain than trying to chop up a string.
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
kimbert
PostPosted: Thu Nov 06, 2008 3:06 pm    Post subject: Reply with quote

Jedi Council

Joined: 29 Jul 2003
Posts: 5542
Location: Southampton

You could always use the XPath query '//FirstName'. The JavaCompute node supports XPath. But before you do that, ask yourself the following questions:
- Do you really need to check the entire message? I'll bet that 'FirstName' only appears in a limited number of places in the message. There must be some definition of the input XML, possibly in a DTD or XML Schema.
- What do you want to do if 'FirstName' is in the message? If you need to change the message content in any way, you will need to parse it anyway.
Back to top
View user's profile Send private message
samgn123
PostPosted: Wed Nov 19, 2008 2:21 am    Post subject: Reply with quote

Newbie

Joined: 04 Nov 2008
Posts: 8

Hi ,
Thanks for the reply. The problem is solved by using the XPATH. Now i am able to search and Element/Attribute for a corresponding value , even if no full path specified
Thanks again
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 » XML Field Lookup Using ESQL
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.