|
RSS Feed - WebSphere MQ Support
|
RSS Feed - Message Broker Support
|
 |
|
NamespacePrefixMap |
« View previous topic :: View next topic » |
Author |
Message
|
Esa |
Posted: Wed Jan 25, 2012 7:52 am Post subject: NamespacePrefixMap |
|
|
 Grand Master
Joined: 22 May 2008 Posts: 1387 Location: Finland
|
In Message Broker Java API (V8 ) and in Message Flow API (V7), Node class has methods addNsmapping(), removeNsmapping() and getNsmappingtables(). Used for adding, removing and listing NamespacePrefixMap objects associated with the Node.
Obviously NamespacePrefixMap objects are used for replacing default or generated namespace prefixes. But the documentation does not tell how the nodes are making use of them and how, or which nodes are actually making use of them.
Are they used by compute nodes to override what has been set with DECLARE NAMESPACE? I doupt that.
The only use i could think of is an output node telling the (XMLNSC) parser to replace generated namespace prefixes with the mapped in the serialized output message.
Could not find any examples. The documentation of NamespacePrefixMap represents a standard entry in these javadocs - many of the classes I have checked have almost the same description.
By the way, NamespacePrefixMap has these methods:
getnamespace()
getNsPrefix()
setNamespace()
setNsPrefix()
I hope/fear that getnamespace() will in the future be deprecated and replaced with getNamespace()...
There is similar inconsistency in naming accross the javadoc, that has not been corrected in V8. It seems that not very many customers are actually using these APIs (which are designed to be used for modifying generated pattern instances, not for implementing message transformations or similar runtime functionality).
But I would like to remind that it would be much easier to correct these things now than later when customers have started using them.
In fact, I was examining something else when this come up as a typical example of the quality of the API documentation. |
|
Back to top |
|
 |
kimbert |
Posted: Wed Jan 25, 2012 2:35 pm Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
Quote: |
Are they used by compute nodes to override what has been set with DECLARE NAMESPACE? I doupt that. |
Quite rightly. That's not the answer
Quote: |
The only use i could think of is an output node telling the (XMLNSC) parser to replace generated namespace prefixes with the mapped in the serialized output message. |
Ingenious, and a perfectly rational guess, but also incorrect
The answer is more subtle than that. Here is the clue in the JavaDoc for NamespacePrefixMap
Quote: |
As of V7.0.0.2, it only possible to manipulate message flows within the context of a Pattern Authoring Project. MessageFlow instances are provided to user-defined classes as a result of a pattern being instantiated. |
Here's the chain of reasoning:
- Some nodes allow paths to be specified.
- Those paths are XPath expressions ( OK, they are allowed to be ESQL paths too in most cases, but that's not relevant to your question ).
- XPath expressions specify namespaces using QNames. A QName has the form prefix:localName.
- The 'prefix:' part needs a namespace declaration to say what it means. Otherwise the XPath processor won't know which namespace to use.
To put it more succinctly, the node needs to execute an XPath expression, so it needs a map of namespace prefixes to namespace URLs.
So these methods are for people who are customising ( certain types of ) nodes as part of Pattern authoring. There is currently ( in WMB v8.0 ) no other valid usage for them. |
|
Back to top |
|
 |
Esa |
Posted: Thu Jan 26, 2012 12:03 am Post subject: |
|
|
 Grand Master
Joined: 22 May 2008 Posts: 1387 Location: Finland
|
Thanks, kimbert.
That's very useful information.
Btw, it's a pity the javadocs are not indexed with the rest of the InfoCenter. That would help the detective work when learning the API. |
|
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
|
|
|
|