Author |
Message
|
Kool-Aid |
Posted: Wed Jul 14, 2004 12:42 pm Post subject: CONVERTING BLOB TO XML USING STRING MANIPULATION |
|
|
 Novice
Joined: 22 Apr 2004 Posts: 22
|
Hypothetical Situation:
An application is sending XML Data that contains a return line feed at the beginning of each message using the integrator 2.1. When the XML parser tries to read this message it naturally fails because the first field as the parser sees it is a "." For example the incoming message looks like this:
.<ROOT><FIRSTCHILD><SECONDCHILD>
All I need is to remove the first field and this message will parse. The message needs to look like this in order for it to work:
<ROOT><FIRSTCHILD><SECONDCHILD>.
What I would like to do is read in the data as a BLOB and remove the first field. I would then like to reset its Content and pass it along as XML and continue processing. That is all it should be that simple.
My questions are...
1. Do you need to build a MRM for this task?
2. Is there any feature in which you can do an evaluation on a starting point of data to the EOM (end of message)?
3. Or is there an easier way to do this? |
|
Back to top |
|
 |
kirani |
Posted: Wed Jul 14, 2004 12:51 pm Post subject: |
|
|
Jedi Knight
Joined: 05 Sep 2001 Posts: 3779 Location: Torrance, CA, USA
|
Please post WMQI related question in WMQI Forum.
[Moving this thread to WMQI Forum] _________________ Kiran
IBM Cert. Solution Designer & System Administrator - WBIMB V5
IBM Cert. Solutions Expert - WMQI
IBM Cert. Specialist - WMQI, MQSeries
IBM Cert. Developer - MQSeries
|
|
Back to top |
|
 |
kirani |
Posted: Wed Jul 14, 2004 1:02 pm Post subject: |
|
|
Jedi Knight
Joined: 05 Sep 2001 Posts: 3779 Location: Torrance, CA, USA
|
Kool-Aid wrote: |
1. Do you need to build a MRM for this task?
|
No.
Kool-Aid wrote: |
2. Is there any feature in which you can do an evaluation on a starting point of data to the EOM (end of message)?
|
Please explain.
Kool-Aid wrote: |
3. Or is there an easier way to do this?
|
I believe your approach is correct. _________________ Kiran
IBM Cert. Solution Designer & System Administrator - WBIMB V5
IBM Cert. Solutions Expert - WMQI
IBM Cert. Specialist - WMQI, MQSeries
IBM Cert. Developer - MQSeries
|
|
Back to top |
|
 |
Kool-Aid |
Posted: Tue Jul 20, 2004 6:00 am Post subject: |
|
|
 Novice
Joined: 22 Apr 2004 Posts: 22
|
Just to clarify what I was trying to accomplish.
I will recieve a BLOB of data that will vary in length every time. For example it could be 10 bytes or a million. The one thing that will remain a constant is I will always want to remove the first byte. All I want to do is strip off the the first byte and pass the remainder of the message to another node.
Examples
MSG 1 (I want to remove the period)
.abcdefghij
I want to see abcdefghij
MSG 2 (I want to remove the period)
.hijklmno
I want to see hijklmno |
|
Back to top |
|
 |
JT |
Posted: Tue Jul 20, 2004 6:17 am Post subject: |
|
|
Padawan
Joined: 27 Mar 2003 Posts: 1564 Location: Hartford, CT.
|
Code: |
DECLARE tempBLOB BLOB;
SET tempBLOB = SUBSTRING(InputRoot."BLOB"."BLOB" from 2);
CREATE FIRSTCHILD OF OutputRoot Domain('XML') PARSE(tempBLOB); |
|
|
Back to top |
|
 |
kirani |
Posted: Tue Jul 20, 2004 8:16 am Post subject: |
|
|
Jedi Knight
Joined: 05 Sep 2001 Posts: 3779 Location: Torrance, CA, USA
|
Well, if you use XML parser to parse these messages then you will get parsing errors. All you need is this,
Code: |
SET OutputRoot."BLOB"."BLOB" = SUBSTRING(InputRoot."BLOB"."BLOB" FROM 2 );
|
_________________ Kiran
IBM Cert. Solution Designer & System Administrator - WBIMB V5
IBM Cert. Solutions Expert - WMQI
IBM Cert. Specialist - WMQI, MQSeries
IBM Cert. Developer - MQSeries
|
|
Back to top |
|
 |
Michael Dag |
Posted: Tue Jul 20, 2004 1:28 pm Post subject: |
|
|
 Jedi Knight
Joined: 13 Jun 2002 Posts: 2607 Location: The Netherlands (Amsterdam)
|
Kool-Aid wrote: |
I will recieve a BLOB of data that will vary in length every time. For example it could be 10 bytes or a million. The one thing that will remain a constant is I will always want to remove the first byte. All I want to do is strip off the the first byte and pass the remainder of the message to another node. |
Can't you just contact the owner of the application sending the '.' infront of the XML ??? (assuming the . is not 'normal' XML behaviour... ) _________________ Michael
MQSystems Facebook page |
|
Back to top |
|
 |
|