Author |
Message
|
angka |
Posted: Tue Apr 29, 2008 12:08 am Post subject: Parse Message body in flow |
|
|
Chevalier
Joined: 20 Sep 2005 Posts: 406
|
Hi,
How do I parse InputBody to XML in compute node? The message has no MQRFH2 header or any other header and Input node nothing set. So when i debug thru, the message body is in BLOB.
From the document, it states:
"the message body is parsed when you refer to Root.XML.Field (or InputRoot.XML.Field in the Compute node) or Root.MRM.Field"
But i try to access e.g. SET AA = InputRoot.XML.A.B.C, AA has no value.
Thanks |
|
Back to top |
|
 |
kimbert |
Posted: Tue Apr 29, 2008 12:16 am Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
Use a ResetContentDescriptor node |
|
Back to top |
|
 |
angka |
Posted: Tue Apr 29, 2008 12:21 am Post subject: |
|
|
Chevalier
Joined: 20 Sep 2005 Posts: 406
|
Hi,
But then why did the document states
"the message body is parsed when you refer to Root.XML.Field (or InputRoot.XML.Field in the Compute node) or Root.MRM.Field" ?
Thanks |
|
Back to top |
|
 |
mgk |
Posted: Tue Apr 29, 2008 12:33 am Post subject: |
|
|
 Padawan
Joined: 31 Jul 2003 Posts: 1642
|
You need to associate a parser with the incoming bitstream. If a msg has an RFH2 with the right information in it then the MQInput node will automatically try and choose the right parser for you. If there is no RFH2 then the node uses the parser options set on the node. Therefore, if you have an XML message you should choose XMLNSC (v6.1) or XMLNS (v6) on the node to associate the right parser with the message. If no parser is chosen, then BLOB is used. (And if you have a BLOB you can also use an RCD node to associate as parser with the bitstream as Tim said). However this process only associates the parser with the bitstream, it does not cause parsing to happen immediately. Actual parsing only happens when you "touch" (index into) the message in a node, such as a compute node with syntax like
Code: |
SET AA = InputRoot.XMLNSC.A.B.C |
This is called lazy parsing. You can override this behaviour on an input node to force "immediate parsing" but most of the time this lazy parsing is what most people need for best performance.
Regards, _________________ 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 |
|
 |
angka |
Posted: Tue Apr 29, 2008 12:47 am Post subject: |
|
|
Chevalier
Joined: 20 Sep 2005 Posts: 406
|
Hi,
Ya it is for best performance. my flow will not read all incoming message body that is why i wanna parse it in code level. so there is no way u can get it parse from BLOB to XML in compute node?
Thanks |
|
Back to top |
|
 |
Vitor |
Posted: Tue Apr 29, 2008 12:50 am Post subject: |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
angka wrote: |
so there is no way u can get it parse from BLOB to XML in compute node? |
I would have though the example mgk quoted was probably in a compute node......
The clue seems to be:
mgk wrote: |
Actual parsing only happens when you "touch" (index into) the message in a node, such as a compute node |
 _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
jefflowrey |
Posted: Tue Apr 29, 2008 1:32 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
Create Field has a PARSE clause.
This likely isn't what you actually want, however.
And it's not clear why you think it's "better" to parse inside the compute node than it is to parse 'outside'.
Remember that the lazy parsing is still going to require that it parses everything that appears before the element you want. So if you touch InputBody.A.B.C.D, then it's going to parse everything necessary to find A, everythng necessary to find A.B, everything necessary to find A.B.C and etc. _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
angka |
Posted: Tue Apr 29, 2008 2:08 am Post subject: |
|
|
Chevalier
Joined: 20 Sep 2005 Posts: 406
|
Hi Vitor,
I know tt mgk are refering to compute node. What i meant is tt after i validate whether to parse the message body, I will need to add a RCD node and den a compute node to do the rest. If it can be parsed using esql i will only need a compute node.
Hi jefflowrey,
Ya I know it will parse the whole message body but the incoming message may not be in xml so i cant set it in the input node. And not all incoming messages i will need to read its message body so for performance reason i decide to parse it after the input node.
Thanks |
|
Back to top |
|
 |
Vitor |
Posted: Tue Apr 29, 2008 2:19 am Post subject: |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
angka wrote: |
If it can be parsed using esql i will only need a compute node. |
mgk has already said that you must associate a parser with the message before it can be parsed.
angka wrote: |
but the incoming message may not be in xml so i cant set it in the input node. |
That's not what you said in your original post...!  _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
angka |
Posted: Tue Apr 29, 2008 3:25 am Post subject: |
|
|
Chevalier
Joined: 20 Sep 2005 Posts: 406
|
Hi,
"associate a parser with the message" means using RCD right? What I meant is it may be xml or cwf format.
Thanks |
|
Back to top |
|
 |
Vitor |
Posted: Tue Apr 29, 2008 3:29 am Post subject: |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
angka wrote: |
What I meant is it may be xml or cwf format.
|
And what I meant was you only mentioned XML in your very first post. _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
angka |
Posted: Tue Apr 29, 2008 5:00 am Post subject: |
|
|
Chevalier
Joined: 20 Sep 2005 Posts: 406
|
Hi,
Oh Sorry I din elaborate. =) |
|
Back to top |
|
 |
|