Message Sets: XML Null handling options

The XML Wire Format supports the handling of null values in messages. Encoding null properties for XML are set only on the message set, and apply to all the defined objects in the message set.

You can use the following two properties to represent the numeric and non-numeric encoding for NULL in the XML Wire Format:

  • Encoding Numeric Null
  • Encoding Non-Numeric Null

These properties represent the numeric and non-numeric encoding for NULL respectively.

  • The numeric data types are:
    • Decimal schema types: decimal, integer, negativeInteger, nonNegativeInteger, nonPositiveInteger, positiveInteger, unsignedLong
    • Float schema types: double, float
    • Integer schema types: byte, int, long, short, unsignedByte, unsignedInt, unsignedShort
  • The non-numeric data types are:
    • Binary schema types: base64Binary, hexBinary
    • Boolean schema types: Boolean
    • DateTime schema types: date, dateTime, gDay, gMonth, gMonthDay, gYear, gYearMonth, time
    • String schema types: anyURI, ENTITIES, ENTITY, ID, IDREF, IDREFS, language, Name, NCName, NMTOKEN, NMTOKENS, normalizedString, NOTATION, QName, string, token

Each of these encodings has the following enumerated values:

  • NULLEmpty (default)
  • NULLValue
  • NULLXMLSchema
  • NULLValueAttribute
  • NULLAttribute (deprecated)
  • NULLElement (deprecated)

You do not have to supply additional information for NULLEmpty, NULLXMLSchema, and NULLValueAttribute, but if you select NULLValue, NULLAttribute, or NULLElement, you must define further values to be assigned to represent the NULL condition in the Encoding Numeric Null Value and Encoding Non-Numeric Null Value message set properties.

The following table shows how each encoding works. For each encoding, the example XML causes the element myElem to be given a value NULL.

Encoding Numeric Null
Encoding Non-Numeric Null
Encoding Numeric Null Value
Encoding Non-Numeric Null Value
Example XML
NULLEmpty  
<myElem/>
<myElem></myElem>
NULLValue zzz <myElem>zzz</myElem>
NULLXMLSchema   <myElem xsi:nil='true'/>1 5
NULLValueAttribute  
<myElem></myElem>2
<parent id="myElem"></parent>3
NULLElement null4 <myElem><null/></myElem>
NULLAttribute null4 <myElem null='true'/>1
Notes:
  1. The attribute must evaluate to true, so the value must be true, 1, or the Boolean True Value property.
  2. This value is valid only for XMLElementAttrVal element rendering, as specified in Message Sets: XML rendering options. Marking an element as being rendered in this way, and setting it to null, is equivalent to removing the attribute of the element that provides the element's value.
  3. This value is valid only for XMLElementAttrIdVal element rendering, as specified in Message Sets: XML rendering options. Marking an element as being rendered in this way, and setting it to null, is equivalent to removing the attribute of the element that provides the element's value, but not removing the attribute that provides the element's name.
  4. Both NULLElement and NULLAttribute are deprecated. The element or attribute name provided must not include a namespace URI or prefix. If namespaces are enabled for the message set, the name matches any namespace.
  5. xsi:nil is not supported with complex elements of MRM-XML.