Enketo Validate
Validate ODK XForms using Enketo's form engine
This app can be used:
- via the command-line, e.g. in a non-javascript form builder such as pyxform.
- as a nodeJS module to be used in your own javascript application
Live demo web application (meant for testing purposes only) that uses Enketo Validate (and ODK Validate) as a module: validate.enketo.org (source code)
Via Command-line
Command-line Install
- install nodeJS 6+
- install build tools for native modules with
apt-get install build-essential
- clone repo
npm install --production
Command-line Use
$ ./validate test/xform/xpath-fails.xml
Command-line Help
$ ./validate --help
Command-line update
git pull && npm install --production
As NodeJS module
Module installation
npm install enketo-validate --save
Module Use
const validator = require('enketo-validate');
let result = validator.validate( xformStr, options );
How it works
In it's current iteration, the validator does the following:
- It checks whether the XForm is a valid XML document.
- It performs some basic ODK XForm structure checks.
- It checks if each bind
nodeset
exists in the primary instance. - It checks for each
<bind>
whether the relevant
, constraint
, calculate
, and required
expressions are supported and valid* XPath.
* Note, that /path/to/nonexisting/node
is perfectly valid XPath.
Funding
The development of this application was funded by OpenClinica.
License
See the license document for this application's license.
Change log
See change log