NeXus validation tool written in C
This is the first version of nxvalidate written in C. Its dependencies are libxml2 and the HDF5 libraries, version 1.8.9 or better. Its purpose is to validate HDF5 files against NeXus application definitions. If you do not know what all this is, see the NeXus web site.
This repository holds two things:
- A library implementation which allows to use nxvalidate from your own software
- A proof of concept command line utility
Using the nxvalidate Command Line Utility
nxvalidate is invoked like this:
nxvalidate -a appdef -l appdefdir -p path -o -b -u -d -t datafile
The minimum invocation is:
nxvalidate -l appdefdir datafile
This searches for application definitions in appdefdir and validates datafile. It expects to find the application definition to validate from from the definitions fields in NXentry or NXsubentry.
- -a appdef Validate the datafile against the application definition appdef. This option allows to override the application definition to validate against.
- -l appdefdir specifies the directory where to search for application definitions. As nxvalidate tries to load base calss definitions too, this must be given.
- -p path specifies a path in the HDF5 file to validate. This also requires an application definition to be specified with -a.
- -t Produce all output possible
- -d Produce debug output tracing what nxvalidate does
- -b Warn about additional elements in the data file found in a base class
- -u Warn about undefined additional elements in the data file
- -o Warn about optional elements which are not present in the datafile
Validation errors are always reported.
Using the nxvalidation library
- You must include nxvalidate.h in your code
- You must link your program against the nxvalidate, xml2, hdf5 and hdf_hl libraries.
The library documentation is basically the doxygen markup of nxvalidate.h and the example use case of the command line application in nxvmain.c.
Currently you have to build nxvalidate from source.
- Download or clone the repository
- cd into it the source tree
- Create a build directory: mkdir build
- Edit CMakeLists.txt at the root level of the distribution. Due to a bug in cmake, you have to set HDF5_HL_LIBRARIES to point to the hdf5_hl library. The bug is already fixed in cmake but only very recently. Thus no one will have afixed version of cmake.
- cd into the build diretory with cd build
- Run cmake: cmake ../
- Run make: make
- Run: make test
This should get it done. When this job has been finished, there may be binary builds as well.