ASG
IBM
Zystems
Cressida
Icon
Netflexity
 
  MQSeries.net
Search  Search       Tech Exchange      Education      Certifications      Library      Info Center      SupportPacs      LinkedIn  Search  Search                                                                   FAQ  FAQ   Usergroups  Usergroups
 
Register  ::  Log in Log in to check your private messages
 
RSS Feed - WebSphere MQ Support RSS Feed - Message Broker Support

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » CSV to XML Convertion

Post new topic  Reply to topic
 CSV to XML Convertion « View previous topic :: View next topic » 
Author Message
MB Developer
PostPosted: Mon Apr 21, 2014 1:43 am    Post subject: CSV to XML Convertion Reply with quote

Disciple

Joined: 03 Feb 2014
Posts: 179

Hi All,

I want to convert CSV to XML .

I know how to convert XML to CSV.

The recommended way to do this is:
a) Create a message set for the CSV format, using the CSV sample as a guide.
b) Parse the input document using XMLNSC
c) In a Compute node ( or a Mapping node, if you prefer ) copy InputRoot.XMLNSC to Output.DFDL .

Message Set is already created.

I want to take FileInput,Compute and FileOutput nodes.

For XML to CSV conversion in Compute node I wrote code like below


SET OutputRoot.DFDL.CSV_MessageSet.header.Year = 'Year';

SET OutputRoot.DFDL.CSV_MessageSet.record[I].Year = InputRoot.XMLNSC.SubTotals.sub.Year;



but I don't know how to write code for CSV to XML please help me....


For XML to CSV conversion in Compute node I write code like below


SET OutputRoot.XMLNSC.CSV2XML_DFDL.header.firstname = 'firstname';

i dnt write code for record ... please help me....

and I already search for this and read in info center but I am not understand...

Thanks in Advance,
Suresh K
Back to top
View user's profile Send private message
kimbert
PostPosted: Mon Apr 21, 2014 2:13 am    Post subject: Reply with quote

Jedi Council

Joined: 29 Jul 2003
Posts: 5542
Location: Southampton

a) Did you get the sample working?
b) Did you manage to change the sample to write your CSV format?

If you can *write* your format using DFDL then it should be trivial to *parse* the same format.
_________________
Before you criticize someone, walk a mile in their shoes. That way you're a mile away, and you have their shoes too.
Back to top
View user's profile Send private message
MB Developer
PostPosted: Mon Apr 21, 2014 2:26 am    Post subject: Reply with quote

Disciple

Joined: 03 Feb 2014
Posts: 179

kimbert wrote:
a) Did you get the sample working?
b) Did you manage to change the sample to write your CSV format?

If you can *write* your format using DFDL then it should be trivial to *parse* the same format.


Hi kimbert,
Yes I already see samples in

http://pic.dhe.ibm.com/infocenter/wmbhelp/v8r0m0/index.jsp?topic=%2Fcom.ibm.dfdl.editor.messagebroker.doc%2Fdf20071_.html

Comma Separated Value (CSV) sample

but in this sample they can use mapping..


I want to write code in compute node for all records...
Back to top
View user's profile Send private message
kimbert
PostPosted: Mon Apr 21, 2014 3:04 am    Post subject: Reply with quote

Jedi Council

Joined: 29 Jul 2003
Posts: 5542
Location: Southampton

Quote:
I want to write code in compute node for all records...
OK - so you want help with writing some ESQL. Is that correct?
Please quote the code that you have tried, and tell us what is wrong with the results that it produces.
_________________
Before you criticize someone, walk a mile in their shoes. That way you're a mile away, and you have their shoes too.
Back to top
View user's profile Send private message
mqsiuser
PostPosted: Mon Apr 21, 2014 3:24 am    Post subject: Re: CSV to XML Convertion Reply with quote

Yatiri

Joined: 15 Apr 2008
Posts: 637
Location: Germany

MB Developer wrote:
but I don't know how to write code for CSV to XML please help me...

For Broker a CSV file is a flat file with an element-delimiter (which is ",") (and a line delimiter, e.g. <CR> or <CR><LF>)

So you create a message set to parse that flat file.

Which is really easy, since a CSV file is a simple flat file format

When reading-in Broker parser that into a "logical" message tree and put it under e.g. InputRoot.XMLNSC. ...

You can just output (write-out) that tree "as XML" (with e.g. XMLNSC) or ...

you can change the structure of that tree (e.g. with ESQL) and then output it as XML.
_________________
Just use REFERENCEs
Back to top
View user's profile Send private message
kimbert
PostPosted: Mon Apr 21, 2014 1:12 pm    Post subject: Reply with quote

Jedi Council

Joined: 29 Jul 2003
Posts: 5542
Location: Southampton

mqsiuser said:
Quote:
For Broker a CSV file is a flat file with an element-delimiter (which is ",") (and a line delimiter, e.g. <CR> or <CR><LF>)
Not just Broker. That definition is a pretty standard definition of 'a CSV file'. Some countries use | ( pipe ) instead of comma, which the DFDL CSV wizard supports. Sometimes the newline is different, which the DFDL wizard also supports.

mqsiuser said:
Quote:
So you create a message set to parse that flat file
Only if you're using message broker v7. From v8 onwards it would be better to create a DFDL schema using the CSV wizard.
_________________
Before you criticize someone, walk a mile in their shoes. That way you're a mile away, and you have their shoes too.
Back to top
View user's profile Send private message
mqsiuser
PostPosted: Mon Apr 21, 2014 3:16 pm    Post subject: Reply with quote

Yatiri

Joined: 15 Apr 2008
Posts: 637
Location: Germany

Whatever. SOA just vanished and nobody is missing it.

Why? There is no problem. There never was a problem.

WHAT is the problem?

Systems interchange msgs and the structure is different (and we must change it)

But thats it, everything else (routing, codepage convertion, reading&writing and (tree-)parsing, encryption, etc....): Everybody (language/platform) can do that and does that... Broker does it (a bit) better?

Everything else: You may (also) do it (or not): "GBO", "ASBO", "CBOM" (not so technology dependent, but who cares anyway (today) about that (any more)?)
_________________
Just use REFERENCEs
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » CSV to XML Convertion
Jump to:  



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
Protected by Anti-Spam ACP
 
 


Theme by Dustin Baccetti
Powered by phpBB © 2001, 2002 phpBB Group

Copyright © MQSeries.net. All rights reserved.