The prefix "xsi" is the namespace prefix used by convention for the XML Schema
namespace for instances. XML documents can contain elements that have
an xsi:type attribute. This provides an explicit data type for the element.
The MRM XML parser in sensitive to xsi:type attributes in the XML document.
It modifies the data type of the element accordingly and adds the xsi:type
attribute into the message tree.
The MRM XML writer is sensitive to xsi:type attributes in the message tree.
It outputs xsi:type attributes according to XML Wire Format message set property Output
policy for xsi:type attributes. For example, xsi:type attributes
can be removed, output on all elements or output according to rules specified
in the SOAP standard.
If validation is enabled for a WebSphere Message Broker message
flow, the validation logic is sensitive to xsi:type attributes and uses them
to modify the validation of the element. It will also validate the values
of xsi:type attributes using the rules described in XML Schema Part 1: Structures on the World Wide Web
Consortium (W3C) Web site.
There are several important points to remember when parsing and writing
XML documents that contain xsi:type attributes.
- In order to detect and use xsi:type attributes, the message set must be
namespace-enabled. To make a message set namespace-enabled, check the message
set property Use namespaces.
- If the value of the xsi:type attribute contains a namespace prefix, the
prefix will be expanded into a fully-qualified URI by the MRM XML parser.
If the same xsi:type attribute is output later by the MRM XML writer, the
same prefix will not automatically be used for the value. You can control
the prefixes used on output using the Namespace settings list
in the XML Wire Format message set properties. If no prefix is supplied, the
XML writer will assign a default prefix.
- If the xsi:type attribute of an element does not resolve to a type in
the model, then the behaviour depends on whether MRM validation is enabled.
If not validating, the MRM will assume the type of the element is that declared
in the model, and continue. If validating, a validation exception will be
thrown.
- If MRM validation is enabled, any required xsi:type attributes must be
present in the message tree at the point when validation is performed. An
xsi:type attribute is required when its value is different from the data type
of the element as defined in the message model (this most commonly occurs
when using XML Schema type derivation).
- If validation is being performed on an input message, then the MRM XML
parser ensures that xsi:type attributes appear in the message tree, as described
above.
- If validation is being performed on an output message you must ensure
that the correct xsi:type attributes appear in the message tree. You should
ensure that any required xsi:type attributes are copied from input message
tree to output message tree, or are explicitly created in the output message
tree.
- If you are using simple types that are xsd:unions then an xsi:type attribute
can be used to direct the MRM XML parser when resolving the union.
- If you are using WebSphere Message Broker Version 6.0 and have
migrated from an earlier version which was not sensitive to xsi:type attributes,
you might notice some changes of behavior. For example, in WebSphere Message Broker Version 6.0,
xsi:type attributes are no longer treated as self-defining attributes, so
they appear in the message tree with the name ‘type’ instead of ‘@type’.
If your message flow logic is sensitive to xsi:type attributes in the message
tree, you are recommended to change your message flow to comply with the new
behavior. If you want to retain logic from an earlier version of WebSphere Message Broker in
your message flows, this is described in Message flow migration notes.
For more information about xsi:type attributes, see XML Schema Part
0: Primer on the World Wide Web Consortium (W3C) Web site.