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 » How to put out an MbElement as String

Post new topic  Reply to topic
 How to put out an MbElement as String « View previous topic :: View next topic » 
Author Message
kiodder
PostPosted: Sat Jun 07, 2008 3:08 am    Post subject: How to put out an MbElement as String Reply with quote

Newbie

Joined: 07 Jun 2008
Posts: 2

Hi,

i'm from germany, so please excuse my bad english.

i want to put an MbElement as String into a CDATA_VALUE Element.

in result it should look like this:

<![CDATA[<message><chapter>example</chapter></message>]]>

i searched for solutions in this forum, but there are only examples in ESQL, but i need it in JAVA.

cdata.setValue(input.toString()); //doesn't work...

I hope you can help me. thank you in advance!
Back to top
View user's profile Send private message
ydsk
PostPosted: Wed Jun 11, 2008 9:37 am    Post subject: Reply with quote

Chevalier

Joined: 23 May 2005
Posts: 410

Hey,

Can you post this in the message broker forum, and remove it from here ?

Thank you.
ydsk.
Back to top
View user's profile Send private message
mgk
PostPosted: Wed Jun 11, 2008 10:49 am    Post subject: Reply with quote

Padawan

Joined: 31 Jul 2003
Posts: 1642

Hi.

Have you set the type of the element to CDATA? If you have can you post a little more of your code and the parser you are using...

Regards,


MGK
_________________
MGK
The postings I make on this site are my own and don't necessarily represent IBM's positions, strategies or opinions.
Back to top
View user's profile Send private message
kiodder
PostPosted: Wed Jun 11, 2008 12:07 pm    Post subject: Reply with quote

Newbie

Joined: 07 Jun 2008
Posts: 2

Hi thank you for your reply,

the parser is set to XMLNSC. here you see the main part of the code. maybe it's a little confusing.

Code:

MbElement root = outAssembly.getMessage().getRootElement();
MbElement input = root.getLastChild().getFirstChild().getNextSibling();

MbElement neu = input.createElementAsFirstChild(MbElement.TYPE_NAME,"storeData",null);
         
neu.setNamespace("/");

neu.createElementAsFirstChild(MbXMLNSC.ATTRIBUTE, "xmlns:xsi", "http://www.w3.org/2001/XMLSchema-instance");
         
MbElement var = input.createElementAsFirstChild(MbElement.TYPE_NAME,"in0", null);
         
var.createElementAsFirstChild(MbXMLNSC.ATTRIBUTE, "type", "string");
         
var.detach();
         
neu.addAsFirstChild(var);
                     
neu.detach();
         
input.addBefore(neu);
         
input.detach();
         
MbElement cdata = var.createElementAsFirstChild(MbElement.TYPE_NAME, "cdata", null);

cdata.setSpecificType(MbXMLNSC.CDATA_VALUE);
         
//now the input Message-Tree should be integrated here:
cdata.setValue(input.toString()); //doesn't work


the message is send to a web service which only can receive String.

Thank you,

Sebastian
Back to top
View user's profile Send private message
mgk
PostPosted: Thu Jun 12, 2008 11:40 am    Post subject: Reply with quote

Padawan

Joined: 31 Jul 2003
Posts: 1642

Quote:
maybe it's a little confusing


You're right it's a little odd

Can you simplify the code to just show the problem. Remove all other code so you can create the problem with the smallest amount of code.

This lets you see more clearly what the problem is (then paste this code).

And can you show the output of a trace node showing the output that was created with this code? Also lookup CDATA_FIELD as you may actually want that type rather than CDATA_VALUE (or at least try both so you can be sure).


Regards,
_________________
MGK
The postings I make on this site are my own and don't necessarily represent IBM's positions, strategies or opinions.
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 » How to put out an MbElement as String
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.