Author |
Message
|
tony_f |
Posted: Fri Apr 13, 2012 3:24 am Post subject: Question regarding namespace stripping code |
|
|
Novice
Joined: 30 Sep 2011 Posts: 19
|
Hi
I found this code posted on this forum - I believe by Kimbert.
Code: |
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; |
It works really well and does exactly what I wanted. The question is regarding the hex representation of the FIELDTYPE values. How can I identify what the hex values are for a specific fieldtype and is it possible that the hex value could change in future releases? |
|
Back to top |
|
 |
kimbert |
Posted: Fri Apr 13, 2012 4:06 am Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
Not actually my code - although I may well have commented on that thread.
This code will only work for the XMLNS domain. It will not work with XMLNSC. If this code is working for you, then you must be working on an old message flow that uses XMLNS. Or else you are purposely using XMLNS in a new message flow, and you can tell us why
I'm discounting the possibility that you are using the deprecated 'XML' domain.
The values of the field type constants will not change - if IBM changed that sort of thing it would break a lot of message flows. |
|
Back to top |
|
 |
mqjeff |
Posted: Fri Apr 13, 2012 4:08 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
kimbert wrote: |
Not actually my code |
It did appear to refer to the XMl domain, so I was sure it was at least *very old*.
kimbert wrote: |
The values of the field type constants will not change - if IBM changed that sort of thing it would break a lot of message flows. |
but you should still use the names instead of the literal values, for readability. |
|
Back to top |
|
 |
tony_f |
Posted: Fri Apr 13, 2012 4:23 am Post subject: |
|
|
Novice
Joined: 30 Sep 2011 Posts: 19
|
kimbert wrote: |
This code will only work for the XMLNS domain. It will not work with XMLNSC. If this code is working for you, then you must be working on an old message flow that uses XMLNS. Or else you are purposely using XMLNS in a new message flow, and you can tell us why
. |
Hmmm, interesting. The message set that I am removing the namespaces from is actually XMLNSC. |
|
Back to top |
|
 |
kimbert |
Posted: Fri Apr 13, 2012 5:08 am Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
|
Back to top |
|
 |
tony_f |
Posted: Fri Apr 13, 2012 5:13 am Post subject: |
|
|
Novice
Joined: 30 Sep 2011 Posts: 19
|
kimbert wrote: |
Then your code is working by pure luck. You should change to using XMLNSC.NamespaceDecl as soon as possible.
. |
A lot of my code works that way
Many thanks Kimbert, I'll change that code right away. Thanks for the link as well. |
|
Back to top |
|
 |
|