lookup()
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 SHMT 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 extensionof the database file must be either lowercase
.json
for a JSON file or lowercase.shmt
for an SHMT file.key
: database key to search fordefault
: optional value to return if thekey
is not found in the database (default is an empty string""
)
Using a JSON file
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 json-to-xml()
function, the result string can be translated into a corresponding XML structure.
Example:
would result in the string "{\"k\":\"v\"}"
.
Debugging
The lookup
XPath function provides many information or error messages in the json
debug channel.
Examples
Last updated