I needed a fast, memory efficient, simple-to-use, and simple-to-deploy command line tool for validating very large XML files with external DTDs or XSD schemas. This is the result. A build recipe (and downloads) that creates a single file executable having no other dependencies than a C runtime library. No need to fiddle with extra libraries, .NET, Java, Ruby, Python or any other runtimes.
Limited expandability is supported via runtime native or Lua handler plugins that allow customized behavior for error, warning, and status messages.
The XValid project consists of the following pieces:
- a build recipe source repository
libxml2
andliblua
development artifact downloads for Windows users, and- a download containing the single file
xval
executable for both Windows and Linux users
- If not already available, install Ruby using the RubyInstaller.
- Install the DevKit and add it to
your
PATH
environment variable by running it'sdevkitvars.bat
file. - Download and install the provided
libxml2
andliblua
libraries. - Run
ruby configure
to configure for building, providing options as needed. - Run
rake
.
- If not already available, install Ruby and ensure it's on your
PATH
. - Install the
libxml2
andliblua
headers/libraries relevant to your distribution. - Run
./configure
(may need to make executable viachmod +x configure
) to prepare for building, providing options as needed. - Run
rake
.
usage: ruby configure [options]
libxml2 options:
--with-xml2-include <s>: libxml2 header directory
--with-xml2-lib <s>: libxml2 library directory
liblua options:
--with-lua-include <s>: liblua header directory
--with-lua-lib <s>: liblua library directory
--lua-libname <s>: libname sans prefix (default: lua52)
compiler toolkit options:
--cc <s>: C compiler (default: gcc)
--defines, -d <s+>: preprocessor definitions
--optflags, -o <s+>: optimization settings (default: O3)
--debugflags, -g <s+>: debug settings
general options:
--chatty-build: build app with verbose messages
--help, -h: Show this message
Once you've downloaded either the pre-built executable or built your own version,
simply run it via xval.exe
(Windows) or ./xval
(Linux). That's it!
You can always get command line help information by running the executable with no arguments like the following.
C:\projects\xvalid-git>xval.exe
XValid vX.Y.Z - validate XML documents
Usage: xval [options] XML_FILE ...
where validation options are:
--dtd ROOT FILE validate ROOT element with external DTD file
--xsd FILE validate with external XSD schema file
where general options are:
--handler FILE use external error handler (.so|.dll|.lua)
- Only UTF-8, UTF-16, ISO-8859-1, and ASCII character encodings supported. No iconv library support.
- Validation against either an external DTD or XSD, not both simultaneously.
- give
configure
more brains to figure out whetherlibxml2
andliblua
are available - add filename length and maximum files checks
- add runtime/CLI selectable support for
.so
,.dll
,.lua
error handlers - add support for building
libxml2
andliblua
from source, or binary download (leverage MiniPortile?)
3-clause BSD. See project LICENSE file.