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 » xml to csv space and quote

Post new topic  Reply to topic
 xml to csv space and quote « View previous topic :: View next topic » 
Author Message
prasannanb
PostPosted: Wed Mar 13, 2013 2:25 am    Post subject: xml to csv space and quote Reply with quote

Apprentice

Joined: 17 Apr 2009
Posts: 35

Hi,

I am converting xml to CSV using Message set.

Input
<Employee>
<name>John</name>
<empno></empno>
<location>US</location>
</Employee>

Expected Output:
"John"," ","US"

Note that for the empty xml tags(empno), I need to create output with a space in between quote.

How can I achieve this? Please help
Back to top
View user's profile Send private message
kimbert
PostPosted: Wed Mar 13, 2013 3:37 am    Post subject: Reply with quote

Jedi Council

Joined: 29 Jul 2003
Posts: 5542
Location: Southampton

Your post is not very clear. Do you mean
a):
Code:
<empno></empno>
or b):
Code:
<empno> </empno>

Code tags are very useful when posting formatted data because they make the data easy to read.

The MRM parser will output whatever value is in the message tree, so if you mean a) then you will need to use some ESQL ( or Java/PHP/.Net/Mapping node) to modify the message tree and replace each occurrence of an empty string with exactly one space.
Back to top
View user's profile Send private message
prasannanb
PostPosted: Wed Mar 13, 2013 4:19 am    Post subject: Reply with quote

Apprentice

Joined: 17 Apr 2009
Posts: 35

I meant a)
<empno></empno>

I was looking if there is any other efficient way than coding in ESQL for each tag
Back to top
View user's profile Send private message
tekt9
PostPosted: Wed Mar 13, 2013 4:25 am    Post subject: User Message definition Reply with quote

Novice

Joined: 13 Aug 2012
Posts: 15

Hi...

I belive you can set the default value in your message definition to " ". When you then convert to csv, missing elements will get converted to space.
Back to top
View user's profile Send private message
Vitor
PostPosted: Wed Mar 13, 2013 4:32 am    Post subject: Re: User Message definition Reply with quote

Grand High Poobah

Joined: 11 Nov 2005
Posts: 26093
Location: Texas, USA

tekt9 wrote:
I belive you can set the default value in your message definition to " ". When you then convert to csv, missing elements will get converted to space.


In the example quoted, is empno missing? Empty? Null?

WMB does not react the same way to all 3 cases.
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
kimbert
PostPosted: Wed Mar 13, 2013 7:05 am    Post subject: Reply with quote

Jedi Council

Joined: 29 Jul 2003
Posts: 5542
Location: Southampton

tekt9 is correct - you can exploit standard XML Schema defaulting to do this automatically.
1. In the xsd for the *input* XML, ensure that you set the default value to " " ( a single space ) for every element that you want to treat in this way.
2. In your input node. set Validation to 'Content and Value'. Otherwise XMLNSC will not bother to look at the xsd, and will not therefore pick up the default values.
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 » xml to csv space and quote
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.