Author |
Message
|
Gama |
Posted: Thu Nov 11, 2010 3:09 am Post subject: remove default namespace |
|
|
 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 |
|
 |
Vitor |
Posted: Thu Nov 11, 2010 3:45 am Post subject: Re: remove default namespace |
|
|
 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 |
|
 |
Gama |
Posted: Thu Nov 11, 2010 3:51 am Post subject: |
|
|
 Centurion
Joined: 11 Jan 2005 Posts: 103 Location: Portugal
|
Yes Vitor,
Is that i really want.
Thanks. |
|
Back to top |
|
 |
mqjeff |
Posted: Thu Nov 11, 2010 4:07 am Post subject: |
|
|
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 |
|
 |
Gama |
Posted: Thu Nov 11, 2010 4:17 am Post subject: |
|
|
 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 |
|
 |
mgk |
Posted: Thu Nov 11, 2010 4:28 am Post subject: |
|
|
 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 |
|
 |
Gama |
Posted: Thu Nov 11, 2010 4:40 am Post subject: |
|
|
 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 |
|
 |
mqjeff |
Posted: Thu Nov 11, 2010 5:26 am Post subject: |
|
|
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 |
|
 |
Gama |
Posted: Thu Nov 11, 2010 5:57 am Post subject: |
|
|
 Centurion
Joined: 11 Jan 2005 Posts: 103 Location: Portugal
|
|
Back to top |
|
 |
|