|
RSS Feed - WebSphere MQ Support
|
RSS Feed - Message Broker Support
|
 |
|
How to put out an MbElement as String |
« View previous topic :: View next topic » |
Author |
Message
|
kiodder |
Posted: Sat Jun 07, 2008 3:08 am Post subject: How to put out an MbElement as String |
|
|
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 |
|
 |
ydsk |
Posted: Wed Jun 11, 2008 9:37 am Post subject: |
|
|
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 |
|
 |
mgk |
Posted: Wed Jun 11, 2008 10:49 am Post subject: |
|
|
 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 |
|
 |
kiodder |
Posted: Wed Jun 11, 2008 12:07 pm Post subject: |
|
|
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 |
|
 |
mgk |
Posted: Thu Jun 12, 2008 11:40 am Post subject: |
|
|
 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 |
|
 |
|
|
 |
|
Page 1 of 1 |
|
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
|
|
|
|