|
RSS Feed - WebSphere MQ Support
|
RSS Feed - Message Broker Support
|
 |
|
How can I get XML format string from MBElement Object |
« View previous topic :: View next topic » |
Author |
Message
|
tonytang |
Posted: Sun Nov 06, 2011 6:28 pm Post subject: How can I get XML format string from MBElement Object |
|
|
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 |
|
 |
fjb_saper |
Posted: Sun Nov 06, 2011 6:35 pm Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
Looked for an asbitstream function/method?  _________________ MQ & Broker admin |
|
Back to top |
|
 |
tonytang |
Posted: Sun Nov 06, 2011 6:52 pm Post subject: |
|
|
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 |
|
 |
|
|
 |
|
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
|
|
|
|