Data Format Description Language (DFDL) v1.0 Specification
OGF Proposed Recommendation GFD-P-R.174, January 31, 2011


13.15 Nils and Default processing

This section describes the processing for nil and default.

Sometimes it is desirable to represent an unshipped element, unknown information, or inapplicable information explicitly with an element, rather than by an absent element. For example, it may be desirable to represent a "null" value being sent to or from a relational database with an element that is present. Such cases can be represented using the DFDL nil mechanism which is based on the XML Schema's nil mechanism and allows "out of band" nil values. Nil processing is used when the XSDL ‘nillable’ attribute of an element is true.

Default processing provides a value for an element that is missing from the data stream on parsing or the infoset on unparsing. Default processing applies to both simple and complex elements.

Definition ‘has default’

A simple element has a default if any of these are true:

  1. The xs:default attribute exists. The default value is the attribute’s value.

  2. The xs:fixed attribute exists. The default value is the attribute’s value.

  3. The element has xs:nillable='true' and dfdl:useNilForDefault is specified. The default value is nil.

A complex element has a default if either:

  1. The content is a sequence and all the required children of a complex element have a default.

  2. The content is a choice and one of the choice branches has a default. The default is the first choice branch in schema definition order to have a default.

Otherwise the element has no default.

Definition: 'required parent context'

A required element (defined below) is only required when its enclosing parent element is one of the following

Definition: 'required element'

When an element is in a 'required parent context', we define the term 'required element' to be :

On parsing, a required element in a required parent context must produce a value in the infoset otherwise it is a processing error.

On unparsing a required element in a required parent context must produce a value in the augmented infoset otherwise it is a processing error.

Definition 'missing element'

On parsing, an element is missing

On unparsing, an element is missing if it is not in the infoset.

Definition 'is nil'

On parsing an element is nil if xs:nillable is 'true' AND one of the following:

  1. dfdl:nilKind is 'logicalValue' and the SimpleRepresentation region of the data stream, converted to its logical type, matches any of the dfdl:nilValue values.

  2. dfdl:nilKind is 'literalValue' and the SimpleRepresentation region of the data stream matches any of the dfdl:nilValue values

  3. dfdl:nilKind is ‘literalCharacter’ and all characters in the SimpleRepresentation region of the data stream match the dfdl:nilValue character.

On unparsing an element is nil if xs:nillable is 'true' AND the element value is nil in the infoset.

Definition 'nil output representation'

The 'nil output representation' is one of the following:

  1. When dfdl:nilKind is 'logicalValue' then the representation value is the first value of dfdl:nilValue converted to the physical representation.

  2. When dfdl:nilKind is 'literalValue' then the representation value is the first value of dfdl:nilValue

  3. When dfdl:nilKind is ‘literalCharacter’ then the representation value is the character from dfdl:nilValue repeated to the required length

13.15.1 Nils and Defaults on Parsing

For simple elements the following applies:

For complex elements the following applies:

13.15.2 Nils and Defaults on Unparsing

For simple elements the following applies:

For complex elements the following applies:


Copyright (C) Open Grid Forum (2005-2010). All Rights Reserved.

This document and translations of it may be copied and furnished to others, and derivative works that comment on or otherwise explain it or assist in its implementation may be prepared, copied, published and distributed, in whole or in part, without restriction of any kind, provided that the above copyright notice and this paragraph are included on all such copies and derivative works. However, this document itself may not be modified in any way, such as by removing the copyright notice or references to the OGF or other organizations, except as needed for the purpose of developing Grid Recommendations in which case the procedures for copyrights defined in the OGF Document process must be followed, or as required to translate it into languages other than English.