The XML Wire Format supports the handling of null
values within messages. Encoding null properties
for XML are set only on the message set and apply to all the defined objects
within the message set.
You can use the following two properties
to represent the numeric and non-numeric encoding for NULL within the XML
Wire Format:
- Encoding Numeric Null
- Encoding Non-Numeric Null
These
represent the numeric and non-numeric encoding for NULL respectively.
- The numeric data types are:
- Decimal schema types: decimal, integer, negativeInteger,
nonNegativeInteger, nonPositiveInteger, positiveInteger
- Float
schema types: double, float
- Integer schema types:
byte, int, long, short, unsignedByte, unsignedInt, unsignedLong, 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, duration, 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 will cause
the element myElem to be given a value NULL:
Notes: - The value of Boolean True is
used.
- This is only valid for XMLElementAttrVal element
rendering, as specified in 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 detailed the element's
value.
- This is only valid for XMLElementAttrIdVal element
rendering, as specified in 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 detailed the element's
value, but not removing the attribute id.
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 |
NULLValueAttribute |
|
<myElem></myElem>2
<parent id="myElem"></parent>3
|
NULLElement |
null4 |
<myElem><null/></myElem> |
NULLAttribute |
null4 |
<myElem null='true'/>1 |
Notes: - The attribute must evaluate to true, so the value must be either "true", "1" or
the Boolean True Value property.
- This is only valid for XMLElementAttrVal element
rendering, as specified in 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.
- This is only valid for XMLElementAttrIdVal element
rendering, as specified in 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.
- Both NULLElement and NULLAttribute are deprecated. The
element or attribute name provided should not include a namespace URI or prefix.
If namespaces are enabled for the message set then the name matches any namespace.
You do not have to supply additional clarification for NULLEmpty and NULLValAttr,
but if you select NULLValue, NULLAttribute, or NULLElement,
you must define further values to be assigned to represent the NULL condition
in the Encoding Null Num Value and Encoding Null Non-Num Value message set
properties (see the table above).