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 » Converting XML to Text - ESQL

Post new topic  Reply to topic
 Converting XML to Text - ESQL « View previous topic :: View next topic » 
Author Message
aoff
PostPosted: Wed Jun 17, 2015 9:36 am    Post subject: Converting XML to Text - ESQL Reply with quote

Newbie

Joined: 17 Jun 2015
Posts: 3

Hello guys,

I'm facing some troubles trying to convert a XML message to a text format. Here's what I'm trying.

I have de following message as example:

Code:
<?xml version="1.0" encoding="UTF-8"?>
<credit_limits credit_limit_number="999" processing_date="16052014-08:00:00" status="01" error_msg="9999">
    <credit_limit>
        <cnpj_agent>99.999.999/0001-99</cnpj_agent>
        <agent_name>AAAAAAAAAAAAAA</agent_name>
        <action_type>01</action_type>
        <first_liquidation_date>16052014</first_liquidation_date>
        <status>01</status>
        <inconsistence_type>01</inconsistence_type>
        <code_error>9999</code_error>
    </credit_limit>
</credit_limits>


I need to set every line into a list of string[1..*] like:

My first line of the XML is <?xml version="1.0" encoding="UTF-8"?> so the first element of the list will be "<?xml version="1.0" encoding="UTF-8"?>".

I have 13 lines considering that a line ends with a ">", so the list will contain 13 elements.

I'm trying to use ASBISTREAM Function to convert the XMLNSC to a BLOB, them convert the BLOB to a CHAR, but is not working.

Does anyone knows a better way to do this?

Thanks a lot!
Back to top
View user's profile Send private message
nelson
PostPosted: Wed Jun 17, 2015 9:40 am    Post subject: Reply with quote

Partisan

Joined: 02 Oct 2012
Posts: 313

What will be your serialized output? why do you need to split your XML in that way?
Back to top
View user's profile Send private message
mqjeff
PostPosted: Wed Jun 17, 2015 9:50 am    Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

Why do you need to pretty-print the XML document?

If some other parser reads it again, it will end up including mixed-content (the line endings).

This is probably not ideal.
Back to top
View user's profile Send private message
aoff
PostPosted: Wed Jun 17, 2015 10:09 am    Post subject: Reply with quote

Newbie

Joined: 17 Jun 2015
Posts: 3

I need to do this because I'll request a service that will encrypt the list line by line and return me a list of Base64 data type. I do not agree with this, but i have to follow orders

Basically what I need to do is put line by line of the XML into position by positon of a string list.

I thougth that would be simple convert all the XML message into CHAR then split line by line using a Substring function with CRLF as parameter.
Back to top
View user's profile Send private message
mqjeff
PostPosted: Wed Jun 17, 2015 10:19 am    Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

You can do the SUBSTITUTE on the blob itself.
Back to top
View user's profile Send private message
aoff
PostPosted: Wed Jun 17, 2015 11:02 am    Post subject: Reply with quote

Newbie

Joined: 17 Jun 2015
Posts: 3

mqjeff wrote:
You can do the SUBSTITUTE on the blob itself.


What do you mean with SUBSTITUTE?
Back to top
View user's profile Send private message
mqjeff
PostPosted: Wed Jun 17, 2015 11:03 am    Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

aoff wrote:
mqjeff wrote:
You can do the SUBSTITUTE on the blob itself.


What do you mean with SUBSTITUTE?


a typo. Substring/etc. There's a replace or something?
Back to top
View user's profile Send private message
inMo
PostPosted: Wed Jun 17, 2015 12:07 pm    Post subject: Reply with quote

Master

Joined: 27 Jun 2009
Posts: 216
Location: NY

Please see below for solution from fjb_saper.

Last edited by inMo on Wed Jun 17, 2015 12:23 pm; edited 2 times in total
Back to top
View user's profile Send private message
inMo
PostPosted: Wed Jun 17, 2015 12:13 pm    Post subject: Reply with quote

Master

Joined: 27 Jun 2009
Posts: 216
Location: NY

aoff wrote:
I need to do this because I'll request a service that will encrypt the list line by line and return me a list of Base64 data type. I do not agree with this, but i have to follow orders


Just curious

1. What do a bunch of encrypted lines buy that a single encrypted line does not?
2. Is the encryption actually base64 or is base64 applied against an actually encrypted string?
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Wed Jun 17, 2015 12:15 pm    Post subject: Reply with quote

Grand High Poobah

Joined: 18 Nov 2003
Posts: 20756
Location: LI,NY

Simpler....
Replace all "><" with ">{CRLF}<" You'll be missing the correct indentation for the pretty print but the result should have every line ...
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » Converting XML to Text - ESQL
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.