lookup()
Last updated
Was this helpful?
Last updated
Was this helpful?
The XPath function lookup
returns the value associated with the key
in a database file. The database file specified by the fidj-uri
can be either in JSON or format. If the key
is not found, the default
string will be returned.
fidj-file-uri
: FIDJ URI pointing to a local database file. The extension
of the database file must be either lowercase .json
for a JSON file or lowercase
.shmt
for an SHMT file.
key
: database key to search for
default
: optional value to return if the
key
is not found in the database (default is an empty string ""
)
The JSON DB file has to be implemented as a key-value object (SHMT does this automatically):
If a value is either of type object
or ordered list of values
(array
), the value is always converted to a JSON string. By using the function, the result string can be translated into a corresponding XML structure.
Example:
would result in the string "{\"k\":\"v\"}"
.
The lookup
XPath function provides many information or error messages in the json
.