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 » WBIMB v6.0 - remove default namespaces in XMLNS domain

Post new topic  Reply to topic
 WBIMB v6.0 - remove default namespaces in XMLNS domain « View previous topic :: View next topic » 
Author Message
csdenis
PostPosted: Wed Jun 28, 2006 5:38 pm    Post subject: WBIMB v6.0 - remove default namespaces in XMLNS domain Reply with quote

Novice

Joined: 06 Oct 2002
Posts: 24

Hi,

I am using WBIMB 6.0 to pass XML message with namespaces to backend, I used XMLNS domain for MQInput Node.

By requirement, I need to remove all the namespaces before passing it to one of my legacy backend. I use the following code:


DECLARE BodyRefPtr REFERENCE TO OutputRoot.XMLNS;
CALL StripNamespaces(BodyRefPtr);


CREATE PROCEDURE StripNamespaces(IN StartRefPtr REFERENCE)
BEGIN

DECLARE FieldRefPtr REFERENCE TO StartRefPtr;

MOVE FieldRefPtr FIRSTCHILD;
IF LASTMOVE(FieldRefPtr) THEN
IF FIELDTYPE(FieldRefPtr) IN (0x01000000, 0x03000000) THEN
SET FieldRefPtr.(XML.NamespaceDecl)* = NULL;
SET FieldRefPtr NAMESPACE = '';
END IF;
END IF;

WHILE LASTMOVE(FieldRefPtr) DO
CALL StripNamespaces(FieldRefPtr);
IF FIELDTYPE(FieldRefPtr) IN (0x01000000, 0x03000000) THEN
SET FieldRefPtr.(XML.NamespaceDecl)* = NULL;
SET FieldRefPtr NAMESPACE = '';
END IF;
MOVE FieldRefPtr NEXTSIBLING;
END WHILE;
END;



The code work well for all my XML messages. However, if the input XML contains default namespaces, it fail to remove the namespaces and event worse is that, it throw the exception 'Element must have a namespace specified if there is a default namespace in scope' when sending out via MQOutput Node. Below is the sample of the XML message with default namespaces:

<?xml version="1.0" encoding="UTF-8"?><RootTag xmlns:a="http://something" xmlns:b="http://something2" xmlns:c="http://something3" xmlns="http://something4"><a:tag1>0</a:tag1><b:tag2>body</b:tag2></RootTag>


Any idea for that?
Back to top
View user's profile Send private message
elvis_gn
PostPosted: Wed Jun 28, 2006 6:54 pm    Post subject: Reply with quote

Padawan

Joined: 08 Oct 2004
Posts: 1905
Location: Dubai

Hi csdenis,

Removing namespaces has been discussed before...you should try a search.

But if your backend is expecting something else, why don't you map this input message to that output structure and send.....removing each and every namespace does not sound very pleasing....thats only my opinion ofcourse...

Regards.
Back to top
View user's profile Send private message Send e-mail
csdenis
PostPosted: Wed Jun 28, 2006 9:30 pm    Post subject: Reply with quote

Novice

Joined: 06 Oct 2002
Posts: 24

Thanks for your reply.

Actually I have already search for the previous discussion, even the coding to remove namespaces is copied from there! But I fail to locate the topic about "default namespaces".

I'm still looking for alternative to overcome this issue. But in parallel I also interest in the error I encountered. Why my coding fail if the XML contains "Default namespaces", is it a bug or I still miss something?
Back to top
View user's profile Send private message
elvis_gn
PostPosted: Wed Jun 28, 2006 9:47 pm    Post subject: Reply with quote

Padawan

Joined: 08 Oct 2004
Posts: 1905
Location: Dubai

Hi csdenis,

I've never tried this before, but I guess if your creating an OutputRoot.XMLNS then the parser will expect the default namespaces....Maybe you can try making the domain XML...

Also, simply removing the namespaces will not do, the prefix infront of the elements will also need to be removed...

Regards.
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » WBIMB v6.0 - remove default namespaces in XMLNS domain
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.