Skip to content

jonforums/xvalid

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

79 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

What?

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 and liblua development artifact downloads for Windows users, and
  • a download containing the single file xval executable for both Windows and Linux users

Usage Overview - build recipe

building on Windows

  1. If not already available, install Ruby using the RubyInstaller.
  2. Install the DevKit and add it to your PATH environment variable by running it's devkitvars.bat file.
  3. Download and install the provided libxml2 and liblua libraries.
  4. Run ruby configure to configure for building, providing options as needed.
  5. Run rake.

building on Linux

  1. If not already available, install Ruby and ensure it's on your PATH.
  2. Install the libxml2 and liblua headers/libraries relevant to your distribution.
  3. Run ./configure (may need to make executable via chmod +x configure) to prepare for building, providing options as needed.
  4. Run rake.

configure usage

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

Usage Overview - xval executable

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)

Considerations

  • 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.

TODO

  • give configure more brains to figure out whether libxml2 and liblua 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 and liblua from source, or binary download (leverage MiniPortile?)

License

3-clause BSD. See project LICENSE file.

About

Self contained XML validator

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published