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 can I get XML format string from MBElement Object

Post new topic  Reply to topic
 How can I get XML format string from MBElement Object « View previous topic :: View next topic » 
Author Message
tonytang
PostPosted: Sun Nov 06, 2011 6:28 pm    Post subject: How can I get XML format string from MBElement Object Reply with quote

Newbie

Joined: 01 Nov 2011
Posts: 7

I have I question about How to get the entire XML message(I means the string value as XML format) in Java compute node.
This is the message I send to MQ:
Code:

<?xml version="1.0" encoding="UTF-8"?>
<trade>
   <type>Buy</type>
   <brokername>Broadridge</brokername>
   <stockname>IBM</stockname>
   <number>200</number>
   <price>17.5</price>
</trade>


This is my code:
Code:

   public void evaluate(MbMessageAssembly contact admin) throws MbException {
      // other code
      MbElement root = contact admin.getMessage().getRootElement();
      MbElement xmlDeclaration = root.getFirstElementByPath("XMLNSC").getFirstChild();
      MbElement messageBody = xmlDeclaration.getNextSibling(); // How to pare the body MBElement to String value?
      // other code
   }


Currently I can get all the sub element and the value.
But How can can I get the entire XML String?
I do not want to parse node one by one and get the value, than assembly as a string.
is there any other method to get the entire XML string value?

Thanks very much!!!
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Sun Nov 06, 2011 6:35 pm    Post subject: Reply with quote

Grand High Poobah

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

Looked for an asbitstream function/method?
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
tonytang
PostPosted: Sun Nov 06, 2011 6:52 pm    Post subject: Reply with quote

Newbie

Joined: 01 Nov 2011
Posts: 7

fjb_saper wrote:
Looked for an asbitstream function/method?


Yes I got it :
use toBitstream(null, null, "XMLNSC", 0, 0, 0);
Than I get the xml .

Thanks!
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 can I get XML format string from MBElement Object
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.