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 BLOB conversion

Post new topic  Reply to topic
 XML to BLOB conversion « View previous topic :: View next topic » 
Author Message
EnOne
PostPosted: Thu Oct 11, 2007 2:54 pm    Post subject: XML to BLOB conversion Reply with quote

Centurion

Joined: 09 Oct 2002
Posts: 100
Location: Kansas City

I have XML input that looks like this (simplified example)
Code:
<parent>
   <child1>  line 1 </child1>
   <child2>  line 2 </child2>
</parent>

and I need it to format like this
Code:
%3Cparent%3E%3Cchild1%3E++line+1+%3C%2Fchild1%3E%3Cchild2%3E++line+2+%3C%2Fchild2%3E%3C/parent%3E

I'm using a BITSTREAM function to move them into one line
Code:
BITSTREAM(OutputRoot.XML)

then using a CAST to get it back to CHAR
Code:
CAST(InStream AS CHAR CCSID 437);

i've tried CCSID's of 437, 819, 1208
Code:
<parent><child1>  line 1 </child1><child2>  line 2 </child2></parent>

then using four concurrent REPLACE calls <, >, , / to %3C, %3E, +, %2F
Code:
      SET Stream = REPLACE(Stream, '<' , '%3C');   
      SET Stream = REPLACE(Stream, '>' , '%3E');   
      SET Stream = REPLACE(Stream, '/' , '%2F');   
      SET Stream = REPLACE(Stream, ' ' , '+');

is there a CCSID or other simpler function that does the same thing?
Back to top
View user's profile Send private message
EnOne
PostPosted: Thu Oct 11, 2007 2:57 pm    Post subject: Reply with quote

Centurion

Joined: 09 Oct 2002
Posts: 100
Location: Kansas City

I may have this in the wrong forum I think it needs to go to

WebSphere Business Integration Support (WBI/WMQI/WMB/MQSI)
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Thu Oct 11, 2007 3:23 pm    Post subject: Reply with quote

Grand High Poobah

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

So Moved...
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
asudhakar
PostPosted: Thu Oct 11, 2007 10:56 pm    Post subject: Reply with quote

Centurion

Joined: 12 May 2007
Posts: 116
Location: Bangalore

EnOne wrote:
I may have this in the wrong forum I think it needs to go to

WebSphere Business Integration Support (WBI/WMQI/WMB/MQSI)


Hi EnOne................... We are in WebSphere Business Integration Support (WBI/WMQI/WMB/MQSI)[/quote] Forum only. wat r u doing here.
_________________
WebSphere MQ, MB Support and Admin
Back to top
View user's profile Send private message Send e-mail
jefflowrey
PostPosted: Fri Oct 12, 2007 1:53 am    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

the thread got moved.

EnOne - There isn't an "entity replace" function.. Your REPLACE is about as good as you're going to get.

Also, you should be using ASBITSTREAM and not BITSTREAM.
_________________
I am *not* the model of the modern major general.
Back to top
View user's profile Send private message
EnOne
PostPosted: Fri Oct 12, 2007 6:43 am    Post subject: Reply with quote

Centurion

Joined: 09 Oct 2002
Posts: 100
Location: Kansas City

I hadn't noticed that BITSTREAM was being deprecated. I'll change it to ASBITSTREAM. I was hoping that one of the CCSID's would not use symbols.

If I'm not going to use BITSTREAM how would I use ASBISTREAM for the same result?
Code:
ASBITSTREAM(OutputRoot.XML)
Back to top
View user's profile Send private message
jefflowrey
PostPosted: Fri Oct 12, 2007 7:48 am    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

It's documented.

Also, don't use XML. Use XMLNS or XMLNSC.
_________________
I am *not* the model of the modern major general.
Back to top
View user's profile Send private message
EnOne
PostPosted: Fri Oct 12, 2007 10:12 am    Post subject: Reply with quote

Centurion

Joined: 09 Oct 2002
Posts: 100
Location: Kansas City

what's documented is this
http://publib.boulder.ibm.com/infocenter/wmbhelp/v6r0m0/index.jsp?topic=/com.ibm.etools.mft.doc/ak05510_.htm
Code:
      DECLARE options INTEGER BITOR(FolderBitStream, ValidateContent,
                                    ValidateValue);
      SET result = ASBITSTREAM(cursor OPTIONS options CCSID 1208);
      SET Result = ASBITSTREAM(Environment.Variables.MQRFH2.Data,,1208
                               ,,,,options);

the answer to how to convert BITSTREAM to ASBITSTREAM is
before
Code:
BITSTREAM(OutputRoot.XML)

after
Code:
ASBITSTREAM(OutputRoot.XML,785, 437);

I'm still working on the differences between OutputRoot.XML, OutputRoot.XMLNS or OutputRoot.XMLNSC.
Back to top
View user's profile Send private message
jefflowrey
PostPosted: Fri Oct 12, 2007 10:27 am    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

If you're doing the whole message (OutputRoot.XMLNS), you can just use "ASBITSTREAM(OutputRoot.XMLNS)".

The various options give you different kinds of controls over different kinds of things.

The difference between OutputRoot.XML and OutputRoot.XMLNS/OutputRoot.XMLNSC is that OutputRoot.XML has never and will never support XML with Name Spaces in it.

And is deprecated.
_________________
I am *not* the model of the modern major general.
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 BLOB conversion
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.