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
See information about the latest product version
Setting and moving message elements using a PHPCompute node
You can transform elements in the message as it passes through a PHPCompute node in the message flow.
The following sections show the methods that you can use to modify, move, and remove elements:
The PHP API reference information provides details about each of the methods used in the following sections.
Setting information about an element
Use these methods to set information about the referenced element:
- setName()
- Sets the name of the current element
- setValue()
- Sets the value of the current element
- setType()
- Sets the specific type of the current element. For a full list of type values, see:
- setNamespace()
- Sets the namespace URI of the current element
You can also set the value of an element by using the assignment operator. For example, $element = 'text'; is equivalent to $element.setValue('text');.
Moving elements
Use a PHPCompute node to copy or
detach an element from a message tree by using the following methods:
- detach()
- Detaches the current element from the tree
- detachAllChildren()
- Detaches all children of the current element from the tree
Use one of the following methods to attach
an element or subtree that you have copied on to another tree:
- addElement(element)
- Adds an element as the last child (by default) of the current element
- addAttribute(attribute)
- Adds an attribute to the current element
Removing elements
Use these methods to remove elements from the message tree:
- detach()
- Detaches the current element from the tree
- detachAllChildren()
- Detaches all children of the current element from the tree
You can also remove elements from the message tree
by using the PHP unset() function. For example:
unset($output_assembly->XMLNSC->doc->folder->item);
$output_assembly->XMLNSC->doc->folder->item->detach();