Author |
Message
|
CHF |
Posted: Mon Feb 28, 2005 6:41 am Post subject: Accessing XML elements with namespace |
|
|
 Master
Joined: 16 Dec 2003 Posts: 297
|
We have a generic message flow which looks for a xml field value and based on the value it forwards the message to respective queue.
The problem I am facing is that, I want it to be generic (dynamic).
The XML have namespace, and the namespace can be anything... so how can I access the xml field without hardcoding the namespace.
XML can be anything
<abc:field1 xmlns:abc = "http://schemas.com/abc/">
<abc:sub-field1>value1</adc:sub-field1>
</abc:field1>
<def:field1 xmlns:def = "http://schemas.com/abc/">
<def:sub-field1>value1</def:sub-field1>
</def:field1>
I don't want to hard code something like
InputRoot.XML."abc:field1" .............
Is there a way to access the xml element... I am using WMQI 2.1
Any ideas?? _________________ CHF  |
|
Back to top |
|
 |
jefflowrey |
Posted: Mon Feb 28, 2005 6:48 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
2.1 doesn't really support namespaces properly anyway.
So treat it as a BLOB message, and use POSITION and SUBSTRING to find and extract what you want.
Or read about anonymous field references and FIELDNAME. _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
CHF |
Posted: Mon Feb 28, 2005 6:55 am Post subject: |
|
|
 Master
Joined: 16 Dec 2003 Posts: 297
|
I am also thinking abt reading as a BLOB and look for the element....
What about WBIMB5, can I do anything on WBIMB5 _________________ CHF  |
|
Back to top |
|
 |
jefflowrey |
Posted: Mon Feb 28, 2005 7:48 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
CHF wrote: |
What about WBIMB5, can I do anything on WBIMB5 |
You said you were using 2.1. But if you also have v5 available, then use that.
There was a posting here a few months ago about creating a dynamic namespace qualifier based on the namespace in the message. I don't recall how to do it, but a search should bring something up. Then you could hardcode your path using the qualifier like abcd, but not have a hardcoded value for what abcd maps to. _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
CHF |
Posted: Mon Feb 28, 2005 8:24 am Post subject: |
|
|
 Master
Joined: 16 Dec 2003 Posts: 297
|
Thanks Jeff _________________ CHF  |
|
Back to top |
|
 |
|