When you want to access the contents of a message, for reading or writing, use the structure and arrangement of the elements in the tree that the parser creates from the input bit stream. Follow the relevant parent and child relationships from the top of the tree downwards, until you reach the required element.
Java accessor from MbMessageAssembly | ESQL correlation name |
---|---|
getMessage().getRootElement() | InputRoot |
getMessage().getRootElement().getLastChild() | InputBody |
getLocalEnvironment().getRootElement() | InputLocalEnvironment |
getGlobalEnvironment().getRootElement() | Environment |
getExceptionList().getRootElement() | InputExceptionList |
The following example shows a simple XML message, and the logical tree that would be created from the message. The message has been sent using WebSphere MQ in this example. The logical tree diagram also shows the methods to call to navigate around the tree.
<document> <chapter title='Introduction'> Some text. </chapter> </document>
MbElement root = assembly.getMessage().getRootElement(); MbElement chapter = root.getLastChild().getFirstChild().getFirstChild();
Notices |
Trademarks |
Downloads |
Library |
Support |
Feedback
![]() ![]() |
ac30330_ |