Welcome Guest! Log in
Stambia versions 2.x, 3.x, S17, S18, S19 and S20 are reaching End of Support January, 15th, 2024. Please consider upgrading to the supported Semarchy xDI versions. See Global Policy Support and the Semarchy Documentation.

The Stambia User Community is moving to Semarchy! All the applicable resources have already been moved or are currently being moved to their new location. Read more…


When writing XML Files with Stambia, 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.

Note :

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.

Note :

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 :

http://stackoverflow.com/questions/774192/what-is-the-correct-way-to-represent-null-xml-elements

http://www.w3.org/TR/xmlschema-1/#xsi_nil

 

Articles

Suggest a new Article!