Author |
Message
|
kr.danda |
Posted: Tue Apr 08, 2014 9:46 pm Post subject: XML to CSV converter |
|
|
Novice
Joined: 08 Apr 2014 Posts: 15
|
Hi Every One,
Iam the new to Programing for ESQL could please help ,
how convert XML to CSV.Please provide Logic Implementation in ESQL .
Thanking You Advance,
Regards,
D.Karuna |
|
Back to top |
|
 |
kr.danda |
Posted: Tue Apr 08, 2014 9:47 pm Post subject: Re: XML to CSV converter |
|
|
Novice
Joined: 08 Apr 2014 Posts: 15
|
kr.danda wrote: |
Hi Every One,
Iam the new to Programing for ESQL could please help ,
how convert XML to CSV.Please provide Logic Implementation in ESQL .
Thanking You Advance,
Regards,
D.Karuna |
 |
|
Back to top |
|
 |
smdavies99 |
Posted: Tue Apr 08, 2014 10:45 pm Post subject: |
|
|
 Jedi Council
Joined: 10 Feb 2003 Posts: 6076 Location: Somewhere over the Rainbow this side of Never-never land.
|
Welcome to this fourm. Sadly you have broken a golden rule already.
You waited just 1 minute before adding 'Help' to your post and at 05:49 in the morning.
Not many people who regularly post here would be online at that time so some degree of patience is required before prompting us for help again.
You don't tell us what you have done to investigate your problem yourself. This really helps us give to pointers/hints in areas that you have not tried yourself.
The answer to your problem is actually contained in at least one of the Sample Flows. Go on, take a look at them. They don't bite. _________________ 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: Wed Apr 09, 2014 12:21 am Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
Why do you need to know? _________________ 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 |
|
 |
mqsiuser |
Posted: Wed Apr 09, 2014 12:36 am Post subject: Re: XML to CSV converter |
|
|
 Yatiri
Joined: 15 Apr 2008 Posts: 637 Location: Germany
|
|
Back to top |
|
 |
kimbert |
Posted: Wed Apr 09, 2014 12:42 am Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
@mqsiuser : Why are you advising kr.danda to use Java to parse the XML?
When talking to a new user it would make a lot more sense to recommend using the product's built-in parsers to perform this conversion. _________________ 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 |
|
 |
mqsiuser |
Posted: Wed Apr 09, 2014 12:44 am Post subject: |
|
|
 Yatiri
Joined: 15 Apr 2008 Posts: 637 Location: Germany
|
There is no build in support for that
except creating msg sets
which is more reliable, btw.
But I am not aware of a node (or) nodes which do tree2csv or csv2tree
Which is doable (from a theoretical standpoint)
RFE ? _________________ Just use REFERENCEs |
|
Back to top |
|
 |
zpat |
Posted: Wed Apr 09, 2014 1:19 am Post subject: |
|
|
 Jedi Council
Joined: 19 May 2001 Posts: 5866 Location: UK
|
Internally all data is represented as a tree.
Surely you just use the XML parser on the input node and a message set for the output? Possibly using mapping nodes in-between.
ESQL is not necessarily required. Let alone Java.
WMB is a product designed to reduce or eliminate programming as such, if you don't use WMB features - don't use WMB.
Don't use Java other than as a last resort. _________________ Well, I don't think there is any question about it. It can only be attributable to human error. This sort of thing has cropped up before, and it has always been due to human error. |
|
Back to top |
|
 |
mqsiuser |
Posted: Wed Apr 09, 2014 2:40 am Post subject: |
|
|
 Yatiri
Joined: 15 Apr 2008 Posts: 637 Location: Germany
|
zpat wrote: |
Internally all data is represented as a tree. |
And not CSV
zpat wrote: |
Surely you just use the XML parser on the input node and a message set for the output? |
@OP: That is what you have to do: use/create a msg set
And use XMLNSC (for XML) or MRM (for flat files) or DFDL
On the rest (that zpat writes):
You require proper support, like ESQL gives you.
Broker's Java also gives you that (like any of the languages) within Broker.
It is "Broker's Java": A special Java API !
IBM would say "you may use Java if you are a Java programmer or if you like it."
I say Java is ~20% slower than ESQL (which is not really worth mentioning, it is not really bad: It is okay).
Message Broker Developers love ESQL because it seems to be most targeted/focused on the problem domain.
And sorry, IBM wouldn't approve on that "Broker is a tool to relieve you from programming" _________________ Just use REFERENCEs
Last edited by mqsiuser on Wed Apr 09, 2014 2:56 am; edited 1 time in total |
|
Back to top |
|
 |
zpat |
Posted: Wed Apr 09, 2014 2:55 am Post subject: |
|
|
 Jedi Council
Joined: 19 May 2001 Posts: 5866 Location: UK
|
Why do you need to code anything if you have a mapping node?
As mentioned many, many times on here, once you encourage Java - developers start using it inappropriately.
I would tell them not to code any lines of code at all. _________________ Well, I don't think there is any question about it. It can only be attributable to human error. This sort of thing has cropped up before, and it has always been due to human error. |
|
Back to top |
|
 |
mqsiuser |
Posted: Wed Apr 09, 2014 3:02 am Post subject: |
|
|
 Yatiri
Joined: 15 Apr 2008 Posts: 637 Location: Germany
|
The mapping node seems to work for you and your project
I (and others) think that it has limitations, and sorry if you don't understand them ("structural transformations"... which require the use of a hash map or "{...}" in ESQL).
mqjeff will approve on that ( or he say "oh I just use ESQL and not the mapping node and I am fine"... he just (always) does the right thing )
@zpat: And he uses "{...}" WHAT is the equivalent within the mapping node ? _________________ Just use REFERENCEs |
|
Back to top |
|
 |
kimbert |
Posted: Wed Apr 09, 2014 3:15 am Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
kr.danda must be somewhat confused by all of that.
The recommended way to do this is:
a) Use the CSV wizard in the toolkit to create a DFDL schema for your CSV format.
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
If using v7, then a) will need to change to:
a) Create a message set for the CSV format, using the CSV sample as a guide. _________________ 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 |
|
 |
Vitor |
Posted: Wed Apr 09, 2014 5:23 am Post subject: |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
mqsiuser wrote: |
I (and others) think that it has limitations |
Of course it does (though the v9 one has far fewer). That's why IBM provided other transformation tools.
The point here is the the OP's question doesn't require any transformation in any language, and certainly not the examples you posted to github (nice page format by the way). The product does this out of the box, and new users especially should be encouraged to use the product, not pretend it's WAS & code Java for every problem. _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
mqsiuser |
Posted: Wed Apr 09, 2014 9:14 am Post subject: |
|
|
 Yatiri
Joined: 15 Apr 2008 Posts: 637 Location: Germany
|
Vitor wrote: |
mqsiuser wrote: |
I (and others) think that it has limitations |
Of course it does (though the v9 one has far fewer). That's why IBM provided other transformation tools. |
zpat does not see (any) limitation (of the mapping node) on his project(s)
Which I agree is possible
Vitor wrote: |
The point here is the the OP's question doesn't require any transformation in any language, and certainly not the examples you posted to github. |
It's exactly what he wants
It's something I have been missing in Broker again and again
Something where I can just say "tick check box" and Broker converts a tree into CSV and thats it (no msg set)
So I am providing it now. Sorry that it is in Java.
Port it to c or to ESQL - and ofc I understand that this is not trivial (not a no-brainer)
Vitor wrote: |
nice page format by the way |
You are Vitor, you have an incredible magnitude of more posts (than me) and a far bigger reach on mqseries.net
And you are very good with Tim Kimber ... with which my suggestions and ideas sometimes collide (just seem to... actually)
Sorry, it's all about the subject matter, never something personal, but I can see there is also personal interaction
Is my style-sheet (my 3 lines of CSS ) wrong? The layout on www.use-the-tree.com is intended to be simple and functional (but not kind of wrong or so). And I have no control of the layout on github!
Vitor wrote: |
The product does this out of the box, and new users especially should be encouraged to use the product, not pretend it's WAS & code Java for every problem. |
What Vitor means is: Do like kimbert says (use a msg set ... wow there is a wizard, this is a breeze!)
@IBM: You can walk a tree and flatten it without a message set (reliably). Internally all data is represented as a tree.... almost... there are also BLOBs. _________________ Just use REFERENCEs |
|
Back to top |
|
 |
Vitor |
Posted: Wed Apr 09, 2014 9:46 am Post subject: |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
mqsiuser wrote: |
Vitor wrote: |
mqsiuser wrote: |
I (and others) think that it has limitations |
Of course it does (though the v9 one has far fewer). That's why IBM provided other transformation tools. |
zpat does not see (any) limitation (of the mapping node) on his project(s)
Which I agree is possible |
It's his view and if it works for him then all is good. I personally don't see the mapping node as the only transformation you'll ever need, personally prefer to write ESQL, but that doesn't stop me using the mapping node for simple stuff nor pointing less experienced developers at it.
The right tool for the right use case.
mqsiuser wrote: |
Vitor wrote: |
The point here is the the OP's question doesn't require any transformation in any language, and certainly not the examples you posted to github. |
It's exactly what he wants |
It's exactly what he asked for but it's not what he wants. Inexperienced people cannot be expected to know all the options & look to us for advice.
And the 1 line of ESQL offered by my most worthy associate exactly fits the OP's request for "Implementation in ESQL"
mqsiuser wrote: |
It's something I have been missing in Broker again and again
Something where I can just say "tick check box" and Broker converts a tree into CSV and thats it (no msg set) |
Really? Given how easy it is to do involving a generated message set (i.e. from the wizard)? Can't say it's something I've seen missing.
mqsiuser wrote: |
So I am providing it now. Sorry that it is in Java. |
Lots of people tell me it's a nice language, and it's great to code in. I give them design documents & go back to my ESQL.
mqsiuser wrote: |
Vitor wrote: |
nice page format by the way |
You are Vitor, you have an incredible magnitude of more posts (than me) and a far bigger reach on mqseries.net
And you are very good with Tim Kimber ... with which my suggestions and ideas sometimes collide (just seem to... actually)
Sorry, it's all about the subject matter, never something personal, but I can see there is also personal interaction
Is my style-sheet (my 3 lines of CSS ) wrong? The layout on www.use-the-tree.com is intended to be simple and functional (but not kind of wrong or so). And I have no control of the layout on github! |
Defensive much?
mqsiuser wrote: |
What Vitor means is: Do like kimbert says (use a msg set ... wow there is a wizard, this is a breeze!) |
Yes. It is. _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
|