WebSphere Message Broker, Version 8.0.0.7 Operating Systems: AIX, HP-Itanium, Linux, Solaris, Windows, z/OS

See information about the latest product version

MbsMessage

The MbsMessage class represents one of the logical trees that make up the message assembly.

The MbsMessage class provides the API methods shown in the following table. The parameters in square brackets are optional:

Method Description
Constructor([MbsMessage $msg]) Instantiates a new message object, which is a copy of the msg parameter (optional). If no parameter is supplied, a new empty message is created.
int getType() Returns the specific type of the root element.
array xpath(string $expression [, array $namespace]) Evaluates the XPath expression by using the last child of root (body element) as the context node. It returns the result as either a string, double, boolean, or a nodeset as an array of MbsElement objects. The optional namespace parameter is an associative array with namespace prefixes as the keys and namespace URIs as the values.
MbsElement getChild(string $name [, int $occurrence]) Returns the first child of the root element whose name is given by the first parameter. The nth occurrence of that child can be returned by specifying the second optional parameter.
array getChildren([string $namespace]) Returns all the child elements of the root element as an array of MbsElements. If the namespace parameter is specified, the array contains only the child elements with that namespace URI.
MbsElement getFirstChild() Returns the first child of the root element.
MbsElement getLastChild() Returns the last child of the root element.
MbsElement addElement(string $name, object $value [, string $namespace [, int $type [, int $position]]]) Creates an element as last child (by default) of the root element. The optional type parameter is the parser-specific type of the new node, which defaults to XML element type for XML parsers. The optional position parameter can be one of the following values:
  • MB_FIRST_CHILD
  • MB_LAST_CHILD
  • MB_NEXT_SIBLING
  • MB_PREVIOUS_SIBLING
MbsElement addDomainElement(string $domainName) Creates a domain element.
void detachAllChildren() Detaches all child elements of the root element.
string asBitstream([array $options]) Serializes the element tree to produce a bit stream. When using the MRM parser (and other parsers), the options array must be populated with the following key/value pairs:
array ('set' => '<MessageSet>', 
'type' => '<MessageType>',
'format' => '<MessageFormat>',
'encoding' => '<encoding>',
'ccsid' => '<ccsid>')
void addElementFromBitstream(string $bitstream [, array $options]) Creates an element tree from the supplied bit stream. Without options supplied, the bit stream is parsed by the parser of the root element and attached as its last child (no domain element is created in this case). If options is supplied, it must contain the key/value pair 'domain' => '<parserDomain>' plus any of the additional options for the MRM parser (see asBitstream()). In this case, a parser element is created at the head of the new subtree and attached as the last child of the root element.
Notices | Trademarks | Downloads | Library | Support | Feedback

Copyright IBM Corporation 1999, 2016Copyright IBM Corporation 1999, 2016.

        
        Last updated:
        
        Last updated: 2016-05-23 14:46:34


Reference topicReference topic | Version 8.0.0.7 | ac69023_