|
RSS Feed - WebSphere MQ Support
|
RSS Feed - Message Broker Support
|
 |
|
Graphical Mapping - Filter unexistant elements |
« View previous topic :: View next topic » |
Author |
Message
|
Sovesky |
Posted: Fri Nov 29, 2013 9:57 am Post subject: Graphical Mapping - Filter unexistant elements |
|
|
Novice
Joined: 30 Aug 2013 Posts: 17
|
Hello all,
I'm using MB 8.0.0.2 and I'm having a problem using graphical mapping and xpath.
Imagine I want to map a text element to the leaf of the following tree (Level3):
Level1.Level2.Level3
The problem is that sometimes my service does not receive that text input. When that happens the graphical tool creates the following in my root:
Level1.Level2, where the leaf (Level2) is empty.
I want to use an xpath condition to prevent this from happening, therefore I used as a condition: $variable[not(node())] to stop that tree from being created.
Unfortunately this does not work, and the tree is still being created!
Am I missing something here? Using other approaches (ESQL, Java, etc) is not an option in my situation.
EDIT:
People shouldn't make post when they're tired. Solved with just $variable. |
|
Back to top |
|
 |
Simbu |
Posted: Sun Dec 01, 2013 10:21 pm Post subject: |
|
|
 Master
Joined: 17 Jun 2011 Posts: 289 Location: Tamil Nadu, India
|
Please provide us much more information on what is the input and expected output message and how you are performing the mapping.
There is a mapping functions to check the existence of a field like ESQL EXISTS but before that you may have to check your mapping whether it is actually required. |
|
Back to top |
|
 |
martinb |
Posted: Fri Dec 13, 2013 9:20 am Post subject: |
|
|
Master
Joined: 09 Nov 2006 Posts: 210 Location: UK
|
Just to add you can also use the following XPath functions to implement conditional processing for mapping missing elements or the XML NULL value:
fn:empty tests whether an element has an empty value. The logical data tree NULL value is considered to be empty.
fn:nilled tests whether an XML element has the xsi:nil attribute set.
fn:exists tests whether an element is present. An XML element that has the xsi:nil attribute set is considered to be present.
By using the "Local map" (or submap) mapping construct at the high-level folder to folder would mean that if the input folder is not present the nested sub mappings of the leaf nodes will not be entered into.
Additionally the Mapping node will itself take into consideration the optionally of the source and target elements as defined in the message schema (minOccurs) when performing unconditional Move of leaf elements, so it will not always be necessary to explicitly add conditions. |
|
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
|
|
|
|