How can we help?
Searching in {{docApp.searchFilterBySpecificBookTitle}}
{{docApp.searchResultFilteredItems.length}} results for: {{docApp.currentResultsSearchText}}
in {{docApp.searchFilterBySpecificBookTitle}}
Search results have been limited. There are a total of {{docApp.searchResponse.totalResultsAvailable}} matches.
You have an odd number of " characters in your search terms - each one needs closing with a matching " character!
-
{{resultItem.title}}
{{resultItem.url}}
{{docApp.libraryHomeViewProduct.title || docApp.libraryHomeViewProduct.id}}
{{docApp.libraryHomeViewProduct.description}}
{{group.title || group.id}}
{{group.description}}
Working with XML and NULL values
When making an API call using the XML format where you are required to represent a NULL
value, we follow the de facto standard for XML using a special attribute/value pair xs:nil="true"
. This is not strictly part of the XML specification or the XML Schema specification, but seems to have originated from uses in the XSLT template language. In any case, for the Hornbill API when using XML representation, we use this form to indicate a NULL
value.
xs:nil="true"
is an attribute used in XML schema (xs namespace) to indicate that an element has no value. It is used in situations where the element should have a value that is required by the schema, but no data is available. The “nil” attribute, when set to “true”, specifies that the element is nil, i.e., it has no value. This allows for a distinction between an element that is present but has no value, and an element that is absent.
For example, if an element named “PhoneNumber” is required in an XML document, but no phone number is available, the element can be declared like this:
<PhoneNumber xs:nil="true"/>
This means that the element exists, but it has no value. This can be useful in situations where the presence of the element is required by the schema, but no data is available to fill it.
For APIs that map data from the API call to a database, there are four possible values for any given column
- [1] No parameter provided - self-evident, if you do not provide a value then, assuming it is optional then the bound column is simply left alone.
- [2] A Value - a specific and valid expected value is provided.
- [3] Empty Value - for types like xs:string and xs:base64Binary, it’s possible to provide an empty string.
- [4] A
NULL
Value - for most types, aNULL
value is distinct from a value, and in the case of a string type, is distinct from an empty string. ANULL
value is a value that is present but has no specific value.
The key here is it is possibly to identify these four specific states, not present, no value, an empty
value and a value that is NULL
.
Example XML Values (including NULL)
The following examples show the correct way of sending values via XML
<!-- Example [2] -->
<param>Some Value</param>
<!-- Example [3] - An Empty Value, Value is present but contains no content-->
<param></param>
<param/>
<!-- Example [4] - A NULL Value (two variations) -->
<param xs:nil="true"/>
<param xs:nil="true"></param>
There are a number of common incorrect variations in use. These are all wrong and will either not work or exhibit undefined behavior.
<!-- Invalid/wrong ways of NULL values -->
<!-- A common source of bugs, typically occurring from errors in the
front-end/browser code, or in FlowCode JavaScript, and happens because
a value is sent from a variable object reference. -->
<param>undefined</param>
<!-- missing namespace when defining a NULL value -->
<param nil="true"></param>
<!-- this is most likely an unexpected behavior. In this case NULL is a string value "NULL" -->
<param>NULL</param>
<!-- incorrect namespace (xsi), only the ***xs:*** namespace is supported -->
<param xsi:nil="true"></param>
Note
It is important to understand that not all APIs or input parameters universally support providing a NULL value. If you are unsure refer to the specific API’s documentation for detailed information.
XML Schema Validation
An element may be valid without any content if it has the attribute xs:nil with the value true. An element so labeled must be empty.
When deserializing an XML document into an object, if we encounter an XML element that specifies xs:nil=“true”, it assigns a null reference to the corresponding object and ignores the element value.
<!-- Example 1 -->
<param xs:nil="true"/>
<!-- Example 2 -->
<param xs:nil="true"></param>
<!-- Example 3 -->
<param xs:nil="false"></param>
<!-- Example 4 -->
<param></param>
- Version {{docApp.book.version}}
- Node {{docApp.node}} / {{docApp.build}}