This is documentation for Semarchy xDI 2024.2, which is no longer actively maintained.

For more information, see our Global Support and Maintenance Policy.

Including empty or null values in XML files

When writing XML Files with Semarchy xDI, the default behavior for null values is to not include the element/attribute in the file.

But we might need to include null or empty values in the file and there are several solutions to do it.

The difference between empty and null values is:

  • Empty value will return "" (an empty string for example if the element is a string)

  • Null value will return the real null value

Including empty values

Empty values can be set in the mapping expression with two single quotes.

With Oracle databases

As oracle consider empty values as null (cf : https://docs.oracle.com/cd/B28359_01/server.111/b28286/sql_elements005.htm) this solution will not work on oracle databases.

Example :

empty

Result :

emptyResult

Including null values

To include the real 'null' value into an element :

  1. Type null in the mapping expression

  2. Set the Nil Behavior parameter of the template to TrueIfNotDefined.

This will only work for elements, not attributes.

Example :

null

Result :

nullResult

xsi:nil represents the null value in XML.

For further information about nil behavior you can look at :