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 » Need to replace some value in XML

Post new topic  Reply to topic
 Need to replace some value in XML « View previous topic :: View next topic » 
Author Message
Laaziya
PostPosted: Tue Mar 11, 2014 6:03 am    Post subject: Need to replace some value in XML Reply with quote

Novice

Joined: 05 Mar 2014
Posts: 13

Hi every one,
I have inserted an Xml in CLOB field. I need to retrive those Xml and I need to replace with some values (these values are fetched from the Table) to the Xml.
Eg:
<4000A>
<2900>
<ABC>
<01>A</01>
<02>B</02>
</ABC>
</2900>
</4000A>
Here i need to replace the value of <02></02> element. Is this possible through esql
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Tue Mar 11, 2014 7:05 am    Post subject: Reply with quote

Grand High Poobah

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

Yes it is possible.
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
sandman147
PostPosted: Tue Mar 11, 2014 11:15 am    Post subject: Reply with quote

Apprentice

Joined: 01 Sep 2013
Posts: 42

cast input as char. Declare variables to find POSITION of <2> and </2> .

Declare another character variable . Use substring to retrieve value between the above to positions and then finally REPLACE.
Back to top
View user's profile Send private message
kimbert
PostPosted: Tue Mar 11, 2014 1:58 pm    Post subject: Reply with quote

Jedi Council

Joined: 29 Jul 2003
Posts: 5542
Location: Southampton

sandman147's solution might be OK if you are only changing one tag in the XML. Otherwise, the correct approach is
- use CREATE...PARSE to convert your CLOB into an XMLNSC message tree ( you may need to use the ESQL CAST function to turn it into a BLOB first ).
- Use standard message tree transformation techniques to modify the message tree. ESQL is OK. So is a Mapping node, or Java.
- Either propagate the message tree to an output node, where it will be automatically converted to a bitstream OR use ASBITSTREAM to convert the modified message tree back to a BLOB. And CAST to turn the BLOB into a CLOB.
_________________
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
View user's profile Send private message
Tibor
PostPosted: Wed Mar 12, 2014 1:26 am    Post subject: Reply with quote

Grand Master

Joined: 20 May 2001
Posts: 1033
Location: Hungary

e.g. in ESQL, if your parser is XMLNSC:
Code:
SET OutputRoot.XMLNSC."4000A"."2900"."ABC"."02" = 'C';
Back to top
View user's profile Send private message
mqceries
PostPosted: Tue Mar 18, 2014 8:00 am    Post subject: Reply with quote

Acolyte

Joined: 02 Dec 2011
Posts: 70

Very nice and really appreciate all the replies in thread. This is one of few threads in forum..where user is not warned to check info center/ get some practical experience .. asking to do his job and all.

I do see the replies here are very helpful and get u started... feel free to let us know if you have any problem. A good idea always is to mention in thread if you find the solution and how it worked and all. I do missed this forum due to various issues.. but will try to follow now on.
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 » Need to replace some value in XML
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.