Specifying Element Values of Null, Empty/blank, spaces

The SSC processing rules change depending on what you are trying to do.

Create

Where SSC inserts new data into the database, the SSC processing rules are as follows:

  • An element in the payload with a value sets the associated database value.
  • For an element in the payload with an empty or blank value, ( <element></element> or <element/>), the database column default is applied. This may be NULL for columns that are nullable, or is set to blank or spaces.
  • For an element that is omitted from the payload or an element that is commented out, ( <!-- <element>XYZ</element> --> ), the database column default is applied. This may be NULL for columns that are nullable.

Amend

Existing data may be modified, removed or left unchanged, depending on what is specified in the payload. The SSC processing rules are as follows:

  • An element in the payload with a value sets the associated database value.
  • An element in the payload with an empty or blank value removes or deletes the associated database value. This can be expressed as <element></element> or as <element/>.
  • An element that is missing from the payload or that is commented out ( <!-- <element>XYZ</element> -->) is ignored and leaves any existing database value unchanged.

Handling of Spaces

In standard XML a space is insignificant; it is not treated as data. In order to ensure that a space is treated as a value, you would normally wrap it in a CDATA section. However, in SunSystems applications and data a space can be a valid value, Allocation Marker for example. SAXParser therefore treats a space as a value, not as empty or blank.

Certain elements have trailing spaces trimmed at runtime. In these cases, if a value of all spaces is specified in the payload, it is cleared and processed as if it were empty.

Business validation in the application and validation rules on the database may prevent a value of empty, blank or space to be written to the database.

Nota: Oracle users should note that a varchar column value of space(s) is always trimmed and Oracle attempts to write a NULL value to the database. In a non-nullable field, this can cause an error in Oracle that is not an error in SQL Server.