|
RSS Feed - WebSphere MQ Support
|
RSS Feed - Message Broker Support
|
 |
|
Multi Line CSV File To XML Conversion |
« View previous topic :: View next topic » |
Author |
Message
|
nanubhukta |
Posted: Sat Nov 27, 2004 3:21 am Post subject: Multi Line CSV File To XML Conversion |
|
|
Newbie
Joined: 27 Nov 2004 Posts: 1
|
Hello Friends:
I have a File Like This
FirstName,LastName,Email,Location
FirstName,LastName,Email,Location
FirstName,LastName,Email,Location
(Basically MultiLine...)
I am a Biginer in WMQI Stuff..
Please Help me in Developing a MessageSet for the above
using TDS or CWF..(I prefer TDS...)
My Output Must Be in XML
<contacts>
<person>
<firstname></firstname>
<lastname></lastname>
<email></email>
</person>
<person>
<firstname></firstname>
<lastname></lastname>
<email></email>
</person>
<person>
<firstname></firstname>
<lastname></lastname>
<email></email>
</person>
</contacts
I am Also Trying my Best to Do by Myself.....But any Help is Greatly Appericiated..
Bye, Nagendra |
|
Back to top |
|
 |
kirani |
Posted: Sat Nov 27, 2004 11:44 am Post subject: |
|
|
Jedi Knight
Joined: 05 Sep 2001 Posts: 3779 Location: Torrance, CA, USA
|
Basically, you need to define your message set using TDS format. You can define your compound type as "All Elements Delimited" with , delimiter. You need to say this compound element (Group) occurs multiple times and set the group Repeat seprator to <CR><LF>.
Within your compute node you need to loop thru your input records (parsed by TDS) and then transform it into XML output format.
Please refer to WMQI manuals for more details. _________________ Kiran
IBM Cert. Solution Designer & System Administrator - WBIMB V5
IBM Cert. Solutions Expert - WMQI
IBM Cert. Specialist - WMQI, MQSeries
IBM Cert. Developer - MQSeries
|
|
Back to top |
|
 |
javaforvivek |
Posted: Sun Nov 28, 2004 9:54 pm Post subject: |
|
|
 Master
Joined: 14 Jun 2002 Posts: 282 Location: Pune,India
|
This question is asked by many people (including myself- when I was newbe..!! )
NanuBhukta, I am taking your message as an example:
Let me describe a procedure to create a message set for mulitline CSV message.
1. Create a Message Set Project,viz., CSVMsgSetProject.
2. Create a Message Set, viz., CSVMsgSet. While creating this message set, create it with one TDS Physical Format and One XML physical format.
3. Now Create a Message Def file CSVMsgDef.
4. In Elements and Attributes section, add six global elements:
Contacts,Person,FirstName,LastName,Email,Location.
5. In Types section, create a Complex Type called Person.
Add Element References for FirstName,LastName,Email,Location to this type.
6. In properties panel for Type Person, Set Physical Properties for TDS1-Complex Type as:
Data Element Separation = All Elements Delimited
Delimiter = ,
7. In overview panel, in Elements and Attributes section, change Type of Element Person from String to Person.
8. In Types section, Create a new complex type called Contacts.
Add Element reference for Person to this type. Set Max Occurrence for this reference to -1.
9. Now, in Properties panel for this element reference Person, set TDS1 Element Reference - Repeating Element Delimiter = <CR><LF>
10. Now, in Properties panel for Type Contacts, Set Physical Properties for TDS1-Complex Type as:
Data Element Separation = All Elements Delimited
Delimiter = # (assuming that # will never appear anywhere in your message).
11. In overview panel, In Elements and Attribute Section, change Type of Element Contacts from string to Contacts.
12. Now go to Messages Section. Right Click on Messages. Select Add Message from Global Elements. And then select 'Contacts'.
Now develop your Message Flow as per your requirements. Use a compute node as Kiran has suggested.
Also Refer to Video Sample for how to convert it ot XML format.
Hope this helps you and many other people how have similar requirements.
All experts, please correct anything that's wrong in this procedure...  _________________ Vivek
------------------------------------------------------
...when you have eliminated the impossible, whatever remains, however improbable, must be the truth. |
|
Back to top |
|
 |
kimbert |
Posted: Tue Nov 30, 2004 1:14 am Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
There's no need for a loop in your Compute node - just copy the message headers, and then
Code: |
SET OutputRoot.Properties.MessageFormat = "XML1" |
(or whatever you called your XML physical format). |
|
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
|
|
|
|