This topic describes how the XML parser handles explicit nulls.
The XML domain does not have a concept of a null value in the message bit stream. There is no sequence of bytes in an XML message that leads to an explicit null value being created in the message tree by the XML parser. Although the parser does not create a message tree field with an explicit null value, you can code ESQL within a message flow that creates a field of this form.
When the XML parser constructs a new message bit stream from the message tree, it can encounter explicit null values and must be able to handle them. In this situation, an explicit null value is seen as "no characters to write" and the field is created as the empty tags.
In the XML domain, there are several values that lead to writing XML empty tags in the output XML message:
When these have been written as the empty tags in an XML message, if the XML message is subsequently parsed, it is not possible to distinguish between these three cases. When empty tags are parsed in XML, an XML message tree field is created that does not have a value. This is different from a message tree field that contains an explicit null value, and one that contains a zero length string.
Although the XML parser resolves these three different message tree field values to the same result in the message bit stream, other message tree operations can distinguish between them. Although the XML parser does not create fields that contain explicit nulls and zero length strings, you can perform operations in message flows that can.
Therefore, if a message flow is processing messages in the XML domain, the ESQL or Java must distinguish between an explicit null value, a zero length string, and a message tree field that does not have a value. Not even a field that contains the explicit null value is considered to be null when you code ESQL to query the value of the element.
The XML writing process can handle this condition, but other operations within ESQL do not treat this as a null value. The XML domain does not have a concept of null and the parser never creates a field that contains an explicit null value. Because the XML domain is a character-based domain, when the value of a field is queried, it returns the result as a character field. If you create an XML message tree field with an explicit null value, this is not seen as a null value for those ESQL routines that get the value of the message tree field.
What is returned is the character representation of the contents of the field, which in this case is the character string 'NULL'. For example, if you perform such comparisons with IS NULL, this never evaluates to a TRUE value. If you copy this message tree field to another message tree, the target message tree field is populated with the character string 'NULL'.