|
RSS Feed - WebSphere MQ Support
|
RSS Feed - Message Broker Support
|
 |
|
WBIMB v6.0 - remove default namespaces in XMLNS domain |
« View previous topic :: View next topic » |
Author |
Message
|
csdenis |
Posted: Wed Jun 28, 2006 5:38 pm Post subject: WBIMB v6.0 - remove default namespaces in XMLNS domain |
|
|
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 |
|
 |
elvis_gn |
Posted: Wed Jun 28, 2006 6:54 pm Post subject: |
|
|
 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 |
|
 |
csdenis |
Posted: Wed Jun 28, 2006 9:30 pm Post subject: |
|
|
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 |
|
 |
elvis_gn |
Posted: Wed Jun 28, 2006 9:47 pm Post subject: |
|
|
 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 |
|
 |
|
|
 |
|
Page 1 of 1 |
|
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
|
|
|
|