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 IndexWebSphere Message Broker (ACE) Supportremove default namespace

Post new topicReply to topic
remove default namespace View previous topic :: View next topic
Author Message
Gama
PostPosted: Thu Nov 11, 2010 3:09 am Post subject: remove default namespace Reply with quote

Centurion

Joined: 11 Jan 2005
Posts: 103
Location: Portugal

Hi,
I need to remove the default namespace created automatically.
I use the follow code to create the sample message on WMB6.1.0.8 :

Quote:
BEGIN
CALL CopyMessageHeaders();
-- CALL CopyEntireMessage();

DECLARE sp1 NAMESPACE 'http://www.ibm.com/space1';
DECLARE sp2 NAMESPACE 'http://www.ibm.com/space2';
DECLARE sp3 NAMESPACE 'http://www.ibm.com/space3';

-- Namespace declaration for prefix 'space1'
SET OutputRoot.XMLNSC.message.(XMLNSC.NamespaceDecl)xmlns:space1 = 'http://www.ibm.com/space1';
SET OutputRoot.XMLNSC.message.sp1:data1 = 'Hello!';

-- Default namespace declaration (empty prefix)
SET OutputRoot.XMLNSC.message.sp2:data2.(XMLNSC.NamespaceDecl)xmlns = 'http://www.ibm.com/space2';
SET OutputRoot.XMLNSC.message.sp2:data2.sp2:subData1 = 'Hola!';
SET OutputRoot.XMLNSC.message.sp2:data2.sp2:subData2 = 'Guten Tag!';
SET OutputRoot.XMLNSC.message.sp3:data3 = 'Bonjour!';
RETURN TRUE;
END;


And the output message is that:

Quote:
<message xmlns:space1="http://www.ibm.com/space1">
<space1:data1>Hello!</space1:data1>
<data2 xmlns="http://www.ibm.com/space2">
<subData1>Hola!</subData1>
<subData2>Guten Tag!</subData2>
</data2>
<NS1:data3 xmlns:NS1="http://www.ibm.com/space3">Bonjour!</NS1:data3>
</message>


The expected message is that:

Quote:
<message xmlns:space1="http://www.ibm.com/space1">
<space1:data1>Hello!</space1:data1>
<data2 xmlns="http://www.ibm.com/space2">
<subData1>Hola!</subData1>
<subData2>Guten Tag!</subData2>
</data2>
<data3 xmlns="http://www.ibm.com/space3">Bonjour!</data3>
</message>


My question is how to remove the default namespace “NS1”?
Is that possible?
I already read about that but without any success.
Many thanks.
Back to top
View user's profile Send private message
Vitor
PostPosted: Thu Nov 11, 2010 3:45 am Post subject: Re: remove default namespace Reply with quote

Grand High Poobah

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

Gama wrote:
My question is how to remove the default namespace “NS1”?
Is that possible?


No, because the element is namespaced so broker is providing one in the absense of a declared one. It's possible to set a default namespace for the document, which will remove the prefix on default namespace elements. I suspect that's what you mean.
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
Gama
PostPosted: Thu Nov 11, 2010 3:51 am Post subject: Reply with quote

Centurion

Joined: 11 Jan 2005
Posts: 103
Location: Portugal

Yes Vitor,

Is that i really want.

Thanks.
Back to top
View user's profile Send private message
mqjeff
PostPosted: Thu Nov 11, 2010 4:07 am Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

What it appears you want is to declare a blank namespace prefix rather than having the namespace prefix be NS3.

You don't appear to want to remove the namespace, just remove the namespace prefix.
Back to top
View user's profile Send private message
Gama
PostPosted: Thu Nov 11, 2010 4:17 am Post subject: Reply with quote

Centurion

Joined: 11 Jan 2005
Posts: 103
Location: Portugal

mqjeff wrote:
What it appears you want is to declare a blank namespace prefix rather than having the namespace prefix be NS3.

You don't appear to want to remove the namespace, just remove the namespace prefix.


Yes, I just want to remove the third namespace.
Back to top
View user's profile Send private message
mgk
PostPosted: Thu Nov 11, 2010 4:28 am Post subject: Reply with quote

Padawan

Joined: 31 Jul 2003
Posts: 1642

So what is wrong with:

Code:

...
SET OutputRoot.XMLNSC.message.sp3:data3.(XMLNSC.NamespaceDecl)xmlns = 'http://www.ibm.com/space3';
SET OutputRoot.XMLNSC.message.sp3:data3 = 'Bonjour!';


?

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
Gama
PostPosted: Thu Nov 11, 2010 4:40 am Post subject: Reply with quote

Centurion

Joined: 11 Jan 2005
Posts: 103
Location: Portugal

mgk wrote:
So what is wrong with:

Code:

...
SET OutputRoot.XMLNSC.message.sp3:data3.(XMLNSC.NamespaceDecl)xmlns = 'http://www.ibm.com/space3';
SET OutputRoot.XMLNSC.message.sp3:data3 = 'Bonjour!';


?

Regards,


Nothing wrong, if i hadn't forgotten to write that:
SET OutputRoot.XMLNSC.message.sp3:data3.(XMLNSC.NamespaceDecl)xmlns = 'http://www.ibm.com/space3';

Many thanks
Is done.
Back to top
View user's profile Send private message
mqjeff
PostPosted: Thu Nov 11, 2010 5:26 am Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

Gama wrote:
mqjeff wrote:
What it appears you want is to declare a blank namespace prefix rather than having the namespace prefix be NS3.

You don't appear to want to remove the namespace, just remove the namespace prefix.


Yes, I just want to remove the third namespace.


NO.

You want to remove the namespace PREFIX.

Please make note of this difference.
Back to top
View user's profile Send private message
Gama
PostPosted: Thu Nov 11, 2010 5:57 am Post subject: Reply with quote

Centurion

Joined: 11 Jan 2005
Posts: 103
Location: Portugal

Thanks mqjeff.
Back to top
View user's profile Send private message
Display posts from previous:
Post new topicReply to topic Page 1 of 1

MQSeries.net Forum IndexWebSphere Message Broker (ACE) Supportremove default namespace
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.