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 » how to check namespace declaration in message

Post new topic  Reply to topic
 how to check namespace declaration in message « View previous topic :: View next topic » 
Author Message
a.murphy
PostPosted: Fri Oct 04, 2013 2:46 am    Post subject: how to check namespace declaration in message Reply with quote

Newbie

Joined: 15 Jul 2013
Posts: 5

Hello

So i need to perform a check on a message to see if a namespace exists or not. So if it doesnt exist, add it, if it does exist do nothing.

So the code I have at the min is:

IF OutputRoot.XMLNSC.cst:Customer.(XMLNSC.NamespaceDecl)xmlns:loc IS NULL OR
OutputRoot.XMLNSC.cst:Customer.(XMLNSC.NamespaceDecl)xmlns:loc = NULL THEN

SET OutputRoot.XMLNSC.cst:Customer.(XMLNSC.NamespaceDecl)xmlns:loc = loc;
END IF;

So Im checking whether it is null but regardless if its there or not, it still jumps into the if statement and sets the namespace.

Can anyone please advise me where I am going wrong
Back to top
View user's profile Send private message
lancelotlinc
PostPosted: Fri Oct 04, 2013 3:41 am    Post subject: Reply with quote

Jedi Knight

Joined: 22 Mar 2010
Posts: 4941
Location: Bloomington, IL USA

Mods please move to WMB forum.

Why mess with an IF statement? As my favorite tee vee oven host says, "just set it and forget it."

Don't forget to treat InputRoot as immutable (read-only). This implies that you build your own OutputRoot.
_________________
http://leanpub.com/IIB_Tips_and_Tricks
Save $20: Coupon Code: MQSERIES_READER
Back to top
View user's profile Send private message Send e-mail
mqjeff
PostPosted: Fri Oct 04, 2013 4:32 am    Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

You're writing an If Statement that asks if there is a NAMESPACE DECLARATION.

This is not the same thing as asking if an element BELONGS TO A NAMESPACE.

You need to make sure all your elements belong to the right namespaces. You don't need to declare your namespaces all over the place.
Back to top
View user's profile Send private message
kimbert
PostPosted: Fri Oct 04, 2013 10:19 am    Post subject: Reply with quote

Jedi Council

Joined: 29 Jul 2003
Posts: 5542
Location: Southampton

Check out the namespace sample - it contains some code that allows you to recursively walk a message tree and add/remove namespaces.
_________________
Before you criticize someone, walk a mile in their shoes. That way you're a mile away, and you have their shoes too.
Back to top
View user's profile Send private message
dogorsy
PostPosted: Sat Oct 05, 2013 12:39 am    Post subject: Reply with quote

Knight

Joined: 13 Mar 2013
Posts: 553
Location: Home Office

kimbert wrote:
Check out the namespace sample - it contains some code that allows you to recursively walk a message tree and add/remove namespaces.


Interesting sample, but there is an esql example that I like a lot better ( it is a recursive function ) and navigates the whole tree, the starting point is decided on the 1st call to it. Needs some changing to alter/add/remove namespaces, but nothing to complicated
The function is Navigate, can be found under CREATE PROCEDURE statement, esql example 2
Back to top
View user's profile Send private message
mqceries
PostPosted: Mon Oct 07, 2013 6:40 am    Post subject: Reply with quote

Acolyte

Joined: 02 Dec 2011
Posts: 70

sorry to jump in, seems like a interesting topic. If you have solved the issue kindly please leave us a snippet so that it will help us in the future.

thanks.
Back to top
View user's profile Send private message
kimbert
PostPosted: Mon Oct 07, 2013 6:50 am    Post subject: Reply with quote

Jedi Council

Joined: 29 Jul 2003
Posts: 5542
Location: Southampton

I agree with dogorsy - the recursive tree walk in the namespaces sample is not particuarly elegant. The one in the other topic looks a lot better, but the usual advice applies here : don't just copy and paste the code. Read it, understand how it works, and only then trust it to do the job.
_________________
Before you criticize someone, walk a mile in their shoes. That way you're a mile away, and you have their shoes too.
Back to top
View user's profile Send private message
dogorsy
PostPosted: Mon Oct 07, 2013 7:28 am    Post subject: Reply with quote

Knight

Joined: 13 Mar 2013
Posts: 553
Location: Home Office

mqceries wrote:
sorry to jump in, seems like a interesting topic. If you have solved the issue kindly please leave us a snippet so that it will help us in the future.

thanks.


if you read the comments you will find where to find the sample code. As kimbert says in the previous post, you will need to read the code , understand it and modify it to your needs. Code in the IBM documentation is normally tested and if it does not work you can raise a doc PMR, whilst code given in this forum is not guaranteed.
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 » how to check namespace declaration in message
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.