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 » Changing Namespaces

Post new topic  Reply to topic
 Changing Namespaces « View previous topic :: View next topic » 
Author Message
wilsonjohn24
PostPosted: Fri Apr 10, 2009 6:10 am    Post subject: Changing Namespaces Reply with quote

Voyager

Joined: 02 Feb 2007
Posts: 93
Location: Scotland

Hi,

Basic scenario is I want to change a namespace from http://bob to http://sue.

I came up with a nice route to find NS declaration and reset it .

When I look at the tree the namspace has been changed, but the orginal definition prefixes have not changed despite me just replacing the namespace URL and not the prefix.

Broker seems to have magically readded the orginal and give it a new prefix. I am using xmlns domain.

Any nice routines to reset a namespace definition and not have it affect(effect) the elements? I appreciate this is likely prescribed behaviour as the tree has the full url not the prefix.


thanks

John
Back to top
View user's profile Send private message
mqjeff
PostPosted: Fri Apr 10, 2009 8:11 am    Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

There's a difference between the node in the logical tree that represents the XML namespace declaration and the node in the logical tree that represents the element that has a namespace on it...
Back to top
View user's profile Send private message
kimbert
PostPosted: Fri Apr 10, 2009 9:50 am    Post subject: Reply with quote

Jedi Council

Joined: 29 Jul 2003
Posts: 5542
Location: Southampton

http://www.mqseries.net/phpBB2/viewtopic.php?p=243094&sid=6c8e07c76abc4aa9fdd2e0514fcf71fc
Back to top
View user's profile Send private message
wilsonjohn24
PostPosted: Sun Apr 12, 2009 10:50 pm    Post subject: Reply with quote

Voyager

Joined: 02 Feb 2007
Posts: 93
Location: Scotland

Cheers for that...

I seen that post- but it does not work. If I have an anonoymous namespace it will not pick up this.


I am thinking of parsing the message as a blob and doing some string manipulating of the blob. Does this approach seem ok?


thanks


John
Back to top
View user's profile Send private message
kimbert
PostPosted: Mon Apr 13, 2009 1:06 am    Post subject: Reply with quote

Jedi Council

Joined: 29 Jul 2003
Posts: 5542
Location: Southampton

Quote:
I am thinking of parsing the message as a blob and doing some string manipulating of the blob. Does this approach seem ok?
No, that approach would be very bad practice. There is a straightforward solution to your problem. Just
a) set the correct namespace on every node in the message tree and
b) add namespace declarations into the message tree to obtain the prefixes ( or default namespaces ) that you want to see in your output.
Back to top
View user's profile Send private message
wilsonjohn24
PostPosted: Thu Apr 16, 2009 11:38 pm    Post subject: Reply with quote

Voyager

Joined: 02 Feb 2007
Posts: 93
Location: Scotland

I gathered it was not good to parse a mesage with two different parsers... It was the path of least resistence!

Anyway, coded it from code you reference thanks for that. For reference for anyone else ( the alogirithim is not mights but the nicely named procedure and variables are )

CREATE PROCEDURE changeAllNSReferences(IN StartRefPtr REFERENCE, IN ns1 CHAR,IN ns2 CHAR)
BEGIN

DECLARE FieldRefPtr REFERENCE TO StartRefPtr;

MOVE FieldRefPtr FIRSTCHILD;
IF LASTMOVE(FieldRefPtr) THEN
IF FIELDTYPE(FieldRefPtr) IN (0x01000000, 0x03000000) AND FIELDNAMESPACE( FieldRefPtr)= ns1 THEN
SET FieldRefPtr.(XML.NamespaceDecl) = NULL;
SET FieldRefPtr NAMESPACE = ns2;
END IF;
END IF;

WHILE LASTMOVE(FieldRefPtr) DO
CALL changeAllNSReferences(FieldRefPtr,ns1,ns2);
IF FIELDTYPE(FieldRefPtr) IN (0x01000000, 0x03000000) AND FIELDNAMESPACE( FieldRefPtr)= ns1 THEN
SET FieldRefPtr.(XML.NamespaceDecl) = NULL;
SET FieldRefPtr NAMESPACE = ns2;
END IF;
MOVE FieldRefPtr NEXTSIBLING;
END WHILE;

END;




cheers

john
Back to top
View user's profile Send private message
mqjeff
PostPosted: Fri Apr 17, 2009 1:33 am    Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

(XML.NamespaceDecl) only applies to the XMLNS parser.

Please use the XMLNSC parser instead, unless you are still on Broker v5.

If you are still on Broker v5, please upgrade to Broker 6.1.
Back to top
View user's profile Send private message
kimbert
PostPosted: Fri Apr 17, 2009 8:17 am    Post subject: Reply with quote

Jedi Council

Joined: 29 Jul 2003
Posts: 5542
Location: Southampton

Either you have described your problem wrongly above, or your code does not work.

You must SET the NAMESPACE on every single folder and field in the message tree ( apart from the namespace declarations / xsi:type attributes and other XML-related things ).
Your code is only changing the namespace declarations.
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 » Changing Namespaces
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.