|
RSS Feed - WebSphere MQ Support
|
RSS Feed - Message Broker Support
|
 |
|
Evaluating data type for xml element |
« View previous topic :: View next topic » |
Author |
Message
|
kicho |
Posted: Mon Oct 06, 2008 4:00 am Post subject: Evaluating data type for xml element |
|
|
Newbie
Joined: 20 Sep 2008 Posts: 4
|
Hi all,
i was wondering if someone could tell me how to evaluate xml element's data type in ESQL? For instance, in message
(0x01000000):DATA = (
(0x03000000):V1 = 2 (INTEGER)
(0x03000000):V2 = '12544' (CHARACTER)
(0x03000000):V3 = '12545' (CHARACTER)
(0x03000000):V4 = '20100' (CHARACTER)
(0x03000000):V5 = '20034' (CHARACTER)
(0x03000000):AGG1 = 53 (INTEGER)
(0x03000000):AGG2 = 53 (INTEGER)
)
V1 is integer.
In Java, there is an "instanceof" keyword that you can use to evaluate data type. Is there anything similar in ESQL?
How to write in ESQL "IF V1 instanceof Integer THEN..."?
Thanks in advance! |
|
Back to top |
|
 |
sridhsri |
Posted: Mon Oct 06, 2008 7:55 am Post subject: |
|
|
Master
Joined: 19 Jun 2008 Posts: 297
|
if you search this forum you will find ESQL code which will check if an element is numeric or alphanumeric. But that is as far as it will go. I don't think there is a function similar to "instanceof". You could however use a Java Compute Node and use "instanceof" |
|
Back to top |
|
 |
kicho |
Posted: Mon Oct 06, 2008 8:30 am Post subject: |
|
|
Newbie
Joined: 20 Sep 2008 Posts: 4
|
Thanks for the reply, i was hoping that there is something i could use. |
|
Back to top |
|
 |
kimbert |
Posted: Mon Oct 06, 2008 10:52 am Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
What's the objective here? Why do you need this? |
|
Back to top |
|
 |
kicho |
Posted: Tue Oct 07, 2008 4:16 am Post subject: |
|
|
Newbie
Joined: 20 Sep 2008 Posts: 4
|
I'm working on a semi generic compute node module that generates a batch insert sql string based on input message (XML).
For instance: input message has a following structure:
<Data>
<V1>1034</V1>
<V2>456</V2>
</Data>
<Data>
<V1>45645</V1>
<V2>7878</V2>
</Data>
...
...
...
...
As you can see i have a repeating element called Data that represents a single row returned from database.
For that input message i generate an insert string that looks like
insert into db2admin.table_name (V1,V2) values
(1034,456),
(45645,7878)...;
Now, if the values V1 and V2 are strings (characters), then i have to put literals in the values clauses like ('1034','456'). On the other hand, if the V1 and V2 are integers or something else, i do not need literals.
Input message is being generated as a result returned by a select query called somewhere before in my message flow. In that node i call different sql select queries and they all return different types and values.
I've developed an esql procedure that generates such sql batch insert string and the only problem is that i don't know what kind of data type is xml element in input message (if the V1 is a character, integer or whatever). So that i could know do i need to put literals or not to. |
|
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
|
|
|
|