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
XML support
The PHP capability in WebSphere® Message Broker provides support for XML.
XML namespaces
The path navigation syntax
in the PHPCompute node
is not namespace aware. As a result, the expression shown in the following
example navigates through the catalogue and entry elements regardless
of the namespace URI of the elements:
$ref->catalogue->entry
If
you generate an output message that requires namespace elements, set
the namespace URI after you create the path:
$table->entry = $ref->catalogue->entry;
$table->entry->setNamespace('http://www.ibm.com/namespaceURI');
Alternatively,
you can create the entry element by using the addElement API
method:$value = $ref->catalogue->entry;
$table->addElement('entry', $value, 'http://www.ibm.com/namespaceURI');
XML attributes
XML attributes are stored
in the element tree as MbsElements with a type value
that identifies them as attributes. The path syntax supports addressing
an attribute of an element, by using the array operator with the attribute
name as the key; therefore, attributes function as map arrays on the
element. For example, the following code returns the name attribute
of the folder element:
$attr = $input->XMLNSC->doc->folder['name']
You
can create attributes in a similar way; for example:
$output->XMLNSC->doc->folder['name'] = 'PHP';
This
example generates the following XML code:<doc>
<folder name='PHP'/>
</doc>