Author |
Message
|
dhimanha |
Posted: Mon Jan 02, 2012 11:46 pm Post subject: Convert Text Format file to XML format using ESQL code. |
|
|
Novice
Joined: 02 Jan 2012 Posts: 10
|
Hi All,
I want to convert the text file delimeted with (,) to XML format by using ESQL code. Could anyone pls help mr on the same.
I have explored the Forum but did'nt get the answer. Any tutorial /code already availble pls share.
Regards |
|
Back to top |
|
 |
smdavies99 |
Posted: Tue Jan 03, 2012 12:33 am Post subject: |
|
|
 Jedi Council
Joined: 10 Feb 2003 Posts: 6076 Location: Somewhere over the Rainbow this side of Never-never land.
|
There is at least one sample flow included with Broker that shows you how to do this.
I'd start with the one strangely enough called
Comma Separated Value (CSV) Sample
All you need to do is change the MQInput to a FIileInput node. _________________ WMQ User since 1999
MQSI/WBI/WMB/'Thingy' User since 2002
Linux user since 1995
Every time you reinvent the wheel the more square it gets (anon). If in doubt think and investigate before you ask silly questions. |
|
Back to top |
|
 |
kimbert |
Posted: Tue Jan 03, 2012 8:10 am Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
smdavies99 is correct. And if you look at the sample. you will see that ESQL is not the way to solve this. You should be using the MRM parser to parse the comma-separated values, and XMLNSC to output the XML. |
|
Back to top |
|
 |
Vitor |
Posted: Tue Jan 03, 2012 8:12 am Post subject: |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
kimbert wrote: |
smdavies99 is correct. And if you look at the sample. you will see that ESQL is not the way to solve this. You should be using the MRM parser to parse the comma-separated values, and XMLNSC to output the XML. |
Assuming there's no intermediate conversion required (numeric or date formating for example).
Which the OP has not indicated is the case. So it should be as simple as changing the messge domain. _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
kimbert |
Posted: Tue Jan 03, 2012 8:23 am Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
I see what you mean. The flow may well need some ESQL for doing transformation logic. But the conversion from comma-separated format to XML should not be done using ESQL. |
|
Back to top |
|
 |
Vitor |
Posted: Tue Jan 03, 2012 8:59 am Post subject: |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
kimbert wrote: |
But the conversion from comma-separated format to XML should not be done using ESQL. |
Again, there's nothing in the OP to indicate there's any transformation needed apart from the format. So no apparent need for ESQL. _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
kash3338 |
Posted: Wed Jan 04, 2012 9:29 am Post subject: |
|
|
Shaman
Joined: 08 Feb 2009 Posts: 709 Location: Chennai, India
|
Vitor wrote: |
Again, there's nothing in the OP to indicate there's any transformation needed apart from the format. So no apparent need for ESQL. |
But to set the Output Message Format you have to use ESQL rite? RCD is not a right option to use in a flow if I am not wrong? |
|
Back to top |
|
 |
fjb_saper |
Posted: Wed Jan 04, 2012 11:38 am Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
kash3338 wrote: |
Vitor wrote: |
Again, there's nothing in the OP to indicate there's any transformation needed apart from the format. So no apparent need for ESQL. |
But to set the Output Message Format you have to use ESQL rite? RCD is not a right option to use in a flow if I am not wrong? |
What's wrong with using an RCD node? Once the input is parsed and you have the message tree, go for the RCD and change the message format...
Have fun  _________________ MQ & Broker admin |
|
Back to top |
|
 |
kash3338 |
Posted: Wed Jan 04, 2012 6:33 pm Post subject: |
|
|
Shaman
Joined: 08 Feb 2009 Posts: 709 Location: Chennai, India
|
fjb_saper wrote: |
What's wrong with using an RCD node? Once the input is parsed and you have the message tree, go for the RCD and change the message format...
|
I read this statement in an IBM best practices site,
Quote: |
Avoid using Reset Content Descriptor nodes. An RCD node is intended to change the message domain which actually parses the complete message tree. This is both memory and CPU intensive activity. |
http://www.ibm.com/developerworks/websphere/library/techarticles/0809_kudikala/0809_kudikala.html |
|
Back to top |
|
 |
fjb_saper |
Posted: Wed Jan 04, 2012 9:25 pm Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
kash3338 wrote: |
fjb_saper wrote: |
What's wrong with using an RCD node? Once the input is parsed and you have the message tree, go for the RCD and change the message format...
|
I read this statement in an IBM best practices site,
Quote: |
Avoid using Reset Content Descriptor nodes. An RCD node is intended to change the message domain which actually parses the complete message tree. This is both memory and CPU intensive activity. |
http://www.ibm.com/developerworks/websphere/library/techarticles/0809_kudikala/0809_kudikala.html |
I happen to completely agree with the statement. However you can say that in this case you need to parse the complete message tree...
Even if you do the change in ESQL, the full message tree will be parsed at least at serialization when writing the output... So this is a case where it is recommended that you use an RCD node as not using one would not gain you any advantage...
Have fun  _________________ MQ & Broker admin |
|
Back to top |
|
 |
|