Author |
Message
|
DanielSonFocus |
Posted: Mon Jun 13, 2005 10:38 am Post subject: String Evaluation |
|
|
 Apprentice
Joined: 05 Jun 2005 Posts: 35 Location: Louisville, Kentucky
|
Input XML:
------------
<xml>
<a>apple</a>
<b></b>
<c>cat</c>
</xml>
My expected Reply XML:
----------------------------
<xml>
<a>apple</a>
<c>cat</c>
</xml>
Given the input XML above i've written the following ESQL.. the string comparison does not get rid of the blank tag.. any ideas?
DECLARE a REFERENCE TO InutRoot.XML."xml".a
DECLARE b REFERENCE TO InutRoot.XML."xml".b
DECLARE c REFERENCE TO InutRoot.XML."xml".c
DECLARE aVal CHAR TRIM(BOTH ' ' FROM a);
DECLARE bVal CHAR TRIM(BOTH ' ' FROM b);
DECLARE cVal CHAR TRIM(BOTH ' ' FROM c);
IF aVal IS NOT NULL or aVal <> '' THEN
SET OutputRoot.XML."xml".aVal = aVal;
END IF;
IF bVal IS NOT NULL or bVal <> '' THEN
SET OutputRoot.XML."xml".bVal = bVal;
END IF;
IF c IS NOT NULL or cVal <> '' THEN
SET OutputRoot.XML."xml".cVal = cVal;
END IF;
This code keeps returning this:
<xml>
<a>apple</a>
<b></b>
<c>cat</c>
</xml>
Any help would be greatly appreciated... |
|
Back to top |
|
 |
mayur2378 |
Posted: Mon Jun 13, 2005 11:23 am Post subject: |
|
|
Apprentice
Joined: 26 May 2004 Posts: 47
|
It might be silly and you probably must have done it but Just wanted to make sure u have the Copy MessageHeader procedure uncommented and not the Copy Entire Message
Mayur |
|
Back to top |
|
 |
DanielSonFocus |
Posted: Mon Jun 13, 2005 11:40 am Post subject: |
|
|
 Apprentice
Joined: 05 Jun 2005 Posts: 35 Location: Louisville, Kentucky
|
I don't need to set use CopyEntireMessage because i have "ALL" not just "Message" being passed through the node. |
|
Back to top |
|
 |
EddieA |
Posted: Mon Jun 13, 2005 3:02 pm Post subject: |
|
|
 Jedi
Joined: 28 Jun 2001 Posts: 2453 Location: Los Angeles
|
The question was not about the Node Properties. It was about the ESQL inside the Compute.
Cheers, _________________ Eddie Atherton
IBM Certified Solution Developer - WebSphere Message Broker V6.1
IBM Certified Solution Developer - WebSphere Message Broker V7.0 |
|
Back to top |
|
 |
jefflowrey |
Posted: Tue Jun 14, 2005 3:15 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
EddieA wrote: |
The question was not about the Node Properties. It was about the ESQL inside the Compute. |
And the two are mostly unrelated. _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
mgk |
Posted: Tue Jun 14, 2005 4:57 am Post subject: |
|
|
 Padawan
Joined: 31 Jul 2003 Posts: 1642
|
Hi,
You logic is wrong in the IF test. Use AND not OR, as in:
Code: |
IF bVal IS NOT NULL AND bVal <> '' THEN |
rather than:
Code: |
IF bVal IS NOT NULL OR bVal <> '' THEN |
Cheers, _________________ MGK
The postings I make on this site are my own and don't necessarily represent IBM's positions, strategies or opinions. |
|
Back to top |
|
 |
|