NULL values and empty strings in annotated XML schema decomposition

Annotated XML schema decomposition inserts NULL values or empty strings under certain conditions.

XML elements

The following table shows when an empty string or a NULL value is inserted into the database for elements in the XML document.

Table 1. NULL handling for mapped elements
Condition Empty string NULL value
Element missing from document   X
Element satisfies all of the following conditions:
  • is present in the document
  • contains the xsi:nil="true" or xsi:nil="1" attribute in the start tag
  X
Element satisfies all of the following conditions:
  • is present and empty in the document
  • does not contain the xsi:nil="true" or xsi:nil="1" attribute in the start tag
  • is derived from or declared to be of list type, union type, complex type with mixed content, or the following atomic built-in types: xsd:string, xsd:normalizedString, xsd:token, xsd:hexBinary, xsd:base64Binary, xsd:anyURI, xsd:anySimpleType; any other types will result in an error.
X  
Note:
  1. If a mapping involves the db2-xdb:condition or db2-xdb:expression annotations, then the empty string or NULL value (as shown in this table) is passed as the argument for expression evaluation.
  2. If a target column is of type CHAR or GRAPHIC, an empty string is inserted as a string of blank characters.

XML attributes

The following table shows when an empty string or a NULL value is inserted into the database when XML attributes annotated for decomposition contain NULL values in the document or are missing.

Table 2. NULL handling for mapped attributes
Condition Empty string NULL value
Attribute missing from document (either because no validation was performed, or there was no default value provided by validation)   X
Attribute satisfies all of the following conditions:
  • is present and empty in the document
  • is derived from or declared to be of list type, union type, or the following atomic built-in types: xsd:string, xsd:normalizedString, xsd:token, xsd:hexBinary, xsd:base64Binary, xsd:anyURI, xsd:anySimpleType; any other types will result in an error.
X  
Note: If a mapping involves the db2-xdb:condition or db2-xdb:expression annotations, then the empty string or NULL value (as shown in this table) is passed as the argument for expression evaluation.