Author |
Message
|
ayanc |
Posted: Wed Jan 03, 2007 1:23 pm Post subject: Using Wildcards in Namespace v5.0 |
|
|
Voyager
Joined: 15 Nov 2004 Posts: 88
|
Hi All,
I have a requirement to create a generic flow that will extract a particular segment from the incoming XML message that is using namespace. However the domain being used is currently XML.
Due to the generic nature of the subflow I will not be able to hard code the namespace which would be different for different message flows. So, I have tried to use wildcard characters to address the segment. However things are not running as expected.
For eg:
<Library:Library> -Root Element
<Library:Segment1> - First level Elements
<Library:Segment2>
..............................
...............................
<Library:SegmentN>
In order to access a particular segment at the first level I have tried the following:
DECLARE RF_Seg REFERENCE TO InputRoot.XML.(XML.Element)[1]."*:Segment5";
But the above code did not work. Replacing "*:Segment5" in various other combinations like the following:
{'*' || ':Segment5'}, {'*:Segment5'}, {*}:Segment5, '*:Segment5', etc. did not work for any of them.
I looked at the following link in the online help:
http://publib.boulder.ibm.com/infocenter/wmbhelp/v6r0m0/index.jsp?topic=/com.ibm.etools.mft.doc/ak04861_.htm
Quote: |
* :NameId, *:NameId[..], (..)*:NameId, (..)*:NameId[..]
All these forms specify a name but no namespace. The target field is located by name and also by type and index where appropriate.
|
As per the above the syntax for specifying a wildcard NAMESPACE is using *:NAME. I also searched this forum and found the following topic relevant to this issue:
http://www.mqseries.net/phpBB2/viewtopic.php?t=18963
However things are not working that way. I will not be able to change the domain to XMLNS.
I am using WBIMB 5.0 CSD 05
Can any one suggest me a solution?
Thanx. |
|
Back to top |
|
 |
jefflowrey |
Posted: Wed Jan 03, 2007 1:25 pm Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
You can't use Namespaces with the XML domain.
Use the XMLNS domain. _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
ayanc |
Posted: Wed Jan 03, 2007 1:53 pm Post subject: |
|
|
Voyager
Joined: 15 Nov 2004 Posts: 88
|
Hi Jeff,
Thanx for the response.
Agree with you on that. XML domain may not be able to understand NAMESPACES. However I am not using namespace features either.
So, if we approach the problem in a way that "Prefix:Name" is actually a simple element name having a ":" as a Special character.
In other words is there a workaround ... by using wildcards ?
Thanx. |
|
Back to top |
|
 |
jefflowrey |
Posted: Wed Jan 03, 2007 1:56 pm Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
You can use an asterix to mean "any namespace".
But not with the XML domain. _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
kimbert |
Posted: Thu Jan 04, 2007 2:13 am Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
Hi ayanc,
Jeff is correct. Use the XMLNS domain. I know that means changing all of the paths, but you have to change your ESQL anyway. Handling namespaces using the XML domain is going to be complicated and unreliable. You might as well take the hit and do the job properly. |
|
Back to top |
|
 |
ayanc |
Posted: Thu Jan 04, 2007 12:31 pm Post subject: |
|
|
Voyager
Joined: 15 Nov 2004 Posts: 88
|
Hi Jeff & Kimbert,
Thanx a lot for your help.
Sorry about persisting on this issue ... I could not get the permission to change the existing code ... seems like the changes would go into "major changes category" ....
I hate to do it this way. But for poor folks like us ...
Code: |
DECLARE RF_InputRoot REFERENCE TO InputRoot.XML.(XML.Element)[1];
SET CH_RootField = FIELDNAME(RF_InputRoot);
SET IN_ColonPos = POSITION(':' IN CH_RootField);
SET CH_NameSpace= SUBSTRING(CH_RootField FROM 1 FOR (IN_ColonPos - 1));
DECLARE RF_InputSegment REFERENCE TO InputRoot.XML.(XML.Element)[1].{CH_NameSpace || ':Segment5'};
|
A very crude way indeed.
Thanx. |
|
Back to top |
|
 |
jefflowrey |
Posted: Thu Jan 04, 2007 12:43 pm Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
If this is part of a migration from 2.1, you should really force the issue on XMLNS instead of XML.
The XML domain is deprecated as of version 5. _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
|