zorba-nodejs
This is a native nodejs binding for the Zorba that is inspired by https://github.com/Rod-O/zorba-node. This library leverages Nan so that it is supported on all versions of Node.js and Io.js. A prerequisite for this library is that Zorba is installed. Zorba can be installed using brew install zorba
on a Mac, as well as apt-get
on Linux. Visit the Zorba documentation for more information: http://www.zorba.io/download.
After npm install
this package, you can confirm that it works by executing:
$ node example.js
You should see the following output (this executes the statement "1+1"
in JSONiq):
2
An example of this library's usage is:
var zorba = ; try var result = zorba; console; catch e console;
the output is:
> 2
When there is an error in your query--like the following code:
try console; catche console;
Then the output looks something like this, so that you can troubleshoot the query:
(no URI):1,6: dynamic error [err:XPDY0002]: "context item": undeclared variable
[Error: { "type": "xquery", "file": "", "lines": "1", "characters": "6-16", "error": "context item: undeclared variable" }]