|
RSS Feed - WebSphere MQ Support
|
RSS Feed - Message Broker Support
|
 |
|
MbXPath with namespaces in WMB 7 |
« View previous topic :: View next topic » |
Author |
Message
|
oli |
Posted: Fri Feb 05, 2010 6:15 am Post subject: MbXPath with namespaces in WMB 7 |
|
|
Acolyte
Joined: 14 Jul 2006 Posts: 68 Location: Germany
|
Hi all,
at the moment we are using WMB 6.1 and we want to migrate to WMB 7. We have java nodes that use MbXPath. As the XPath is dynamically set we do not use
Code: |
MbXPath xp= new MbXPath("XMLNSC/Data/ns1:Application[1]", xPathMessage.getRootElement());
xp.addNamespacePrefix("ns1", "http://com.test.www/2009/TestNSA");
|
but instead we do the following (single quotes around the namespace)
Code: |
MbXPath xp = new MbXPath("XMLNSC/Data/'http://com.test.www/2009/TestNSA':Application[1]", xPathMessage.getRootElement());
|
In WMB 6.1 that works fine whereas in WMB 7 an exception is thrown:
Code: |
com.ibm.broker.plugin.MbRecoverableException class:JNI method:ImbXPathEngine::substituteNamespace source:BIPmsgs key:4359
|
Isn't it possible in WMB 7 to use namespaces in that way?
Thanks in advance,
Oli |
|
Back to top |
|
 |
mqjeff |
Posted: Fri Feb 05, 2010 7:00 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
Well, BIP4359 says
Quote: |
BIP4359
XPath query <insert_1> has an undefined namespace prefix <insert_2>
Severity
20 : Error
Explanation
All namespace prefixes in an XPath expression must be mapped to a namespace URI. The prefix quoted in the error message is not mapped.
Response
If you created the XPath expression using the XPath Expression Builder in the Toolkit:
- Open the XPath Expression Builder.
- Expand the 'Namespace Settings' section.
- Add the prefix and its URI to the list.
- Redeploy the message flow.
If you supplied the XPath expression in a monitoring profile through a configurable service:
- Add a 'prefixMapping' element to the monitoring profile.
- Update the configurable service that contains the monitoring profile. |
So it seems vaguely like the v7 engine is interpreting your hardcoded namespace as a namespace prefix instead.
I'm not sure that you need the single quotes on the namespace in the xpath expression, either.
Also the full exception text should have included an indicator of what namespace prefix was failing. Was there further information on the exception object, or available if you allowed that exception to propagate out of the JCN? |
|
Back to top |
|
 |
kimbert |
Posted: Fri Feb 05, 2010 12:26 pm Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
I asked an expert...
This person found a loophole that has been tightened. What he was doing in V6.1 certainly is in violation of the XPath 1.0 spec, and what is more, our docs explain the alternative syntax that would be required if you don't map the prefix to URI properly...
http://publib.boulder.ibm.com/infocenter/wmbhelp/v7r0m0/topic/com.ibm.etools.mft.doc/ak64760_.htm
Quote: |
Without the use of namespace prefixes to URI mapping data in this table, the runtime would be forced to resort to a less desirable approach, where portable but verbose XPath expressions would be required by it in order to provide namespace matching support.
The previous expression:
/b:a/b:c/b2:d/b2:e
would take the form:
/*[namespace-uri()='xyz' and local-name()='a']/*[namespace-uri()='xyz'
and local-name()='c']/*[namespace-uri()='qrs' and
local-name()='d']/*[namespace-uri()='qrs' and local-name()='e'] |
|
|
Back to top |
|
 |
oli |
Posted: Mon Feb 08, 2010 4:25 am Post subject: |
|
|
Acolyte
Joined: 14 Jul 2006 Posts: 68 Location: Germany
|
Hi kimbert,
thanks for your help.
Replacing the
Code: |
"XMLNSC/Data/'http://com.test.www/2009/TestNSA':Application[1]" |
with
Code: |
"XMLNS/Data/*[namespace-uri()='http://com.test.www/2009/TestNSA' and local-name()='Application'][1]" |
seems to work
Oli |
|
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
|
|
|
|