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 » Removing CDATA

Post new topic  Reply to topic
 Removing CDATA « View previous topic :: View next topic » 
Author Message
seeknee
PostPosted: Wed Jul 09, 2003 6:44 am    Post subject: Removing CDATA Reply with quote

Apprentice

Joined: 08 Aug 2002
Posts: 41
Location: Melbourne, Australia

Hi All

How do you remove CDATA from an XML element ???

I am receiving a XML message that has CDATA in one of the elements, I want to remove this.

Any help would be appreciated
Back to top
View user's profile Send private message
jefflowrey
PostPosted: Wed Jul 09, 2003 7:53 am    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

Do you want to remove the element entirely, or convert it from being a CDATA element to being a non-CDATA element?

The first should be something like
Code:
set OutputRoot.XML.Message.CDATAElement = NULL;


The second should be something like
Code:
set OutputRoot.XML.Message.NewElement = InputRoot.XML.Message.CDATAElement.(XML.CDataSection);
.
But if your CDATA element contains invalid XML data, your message will throw an error when you try and use that element, either within your ESQL or when you try to write the message to the output queue.
Back to top
View user's profile Send private message
basva
PostPosted: Wed May 19, 2004 9:30 am    Post subject: Reply with quote

Apprentice

Joined: 27 Nov 2002
Posts: 39

Hi Jeff,

I tried this to remove the CDATA but it is not working. Am I making any mistake here.

Code:
SET OutputRoot.XML.A.B = InputRoot.XML.A.B.(XML.CDataSection);



Input

<A><B><![CDATA[<C>cee</C>]]></B><Z>zee</Z></A>

Output

<A><Z>zee</Z></A>

Thanks
Satish


Last edited by basva on Wed May 19, 2004 11:23 am; edited 2 times in total
Back to top
View user's profile Send private message
JT
PostPosted: Wed May 19, 2004 11:06 am    Post subject: Reply with quote

Padawan

Joined: 27 Mar 2003
Posts: 1564
Location: Hartford, CT.

basva,

The following statement:
Code:
SET OutputRoot.XML.A.B.(XML.AsisElementContent) = InputRoot.XML.A.B.(XML.CDataSection);

produces this output message:
Code:
- <A>
  - <B>
      <C>cee</C>
    </B>
  </A>
Back to top
View user's profile Send private message
basva
PostPosted: Wed May 19, 2004 11:32 am    Post subject: Reply with quote

Apprentice

Joined: 27 Nov 2002
Posts: 39

Thanks JT. Thanks for your help. It is working great.

I have one more question. How to add CDATA. Here is my requirement.

I have

<A><B><C>cee</C><D>dee</D></B></A>

It should become

<A><B><![CDATA[<C>cee</C><D>dee</D>]]></B></A>

Thanks
Satish
Back to top
View user's profile Send private message
jefflowrey
PostPosted: Wed May 19, 2004 11:53 am    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

Basva -
To turn a nested tree into a flat string, which is what your example is asking to do, you have to use the ASBITSTREAM function. This function is documented in the readme for CSD04 or later of WMQI 2.1. If you are not running at least CSD04 of WMQI 2.1, then you can't really do this.

So you will have to do something like "Set OutputRoot.blah.(XML.CDATASection) = ASBITSTREAM(InputRoot.Blah.blah.blah..."

Also, please consider starting a new question instead of replying to an out of date question.
_________________
I am *not* the model of the modern major general.
Back to top
View user's profile Send private message
basva
PostPosted: Wed May 19, 2004 12:10 pm    Post subject: Reply with quote

Apprentice

Joined: 27 Nov 2002
Posts: 39

Thanks Jeff.

I did the following. But my output is in BLOB.

Code:
SET OutputRoot.XML.A.B.(XML.CDataSection) = ASBITSTREAM(InputRoot.XML.A.B);


Input
<A><B><C>cee</C></B></A>

Output

<A><B><![CDATA[3c433e6365653c2f433e]]></B></A>

Am I doing anything wrong here?

Thanks
Satish
Back to top
View user's profile Send private message
jefflowrey
PostPosted: Wed May 19, 2004 12:43 pm    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

Yes.

You are not reading the documentation for the ASBITSTREAM function...

Add the CCSID parameter, that will fix your problem.
_________________
I am *not* the model of the modern major general.
Back to top
View user's profile Send private message
basva
PostPosted: Thu May 20, 2004 5:54 am    Post subject: Reply with quote

Apprentice

Joined: 27 Nov 2002
Posts: 39

Thanks Jeff. I changed the code to following. It is working now. I am happy puppy now

Code:
CAST(ASBITSTREAM(InputRoot.XML.A.B OPTIONS FolderBitStream) AS CHAR CCSID InputRoot.MQMD.CodedCharSetId ENCODING InputRoot.MQMD.Encoding);
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 » Removing CDATA
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.