xsd-schema-validator
A (XSD) schema validator for nodejs
Last updated 10 months ago by nikku .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install xsd-schema-validator 
SYNC missed versions from official npm registry.

xsd-schema-validator

Build Status

A (XSD) schema validator for NodeJS that uses Java to perform the actual validation.

Prerequisites

This utility assumes that javac and java are on the path or that the JAVA_HOME environment exists and points to an installed JDK.

On some platforms, i.e. Mac OSX you need to define JAVA_HOME manually.

How to Use

Install via npm:

npm install --save xsd-schema-validator

Use in your application:

var validator = require('xsd-schema-validator');

var xmlStr = '<foo:bar />';

validator.validateXML(xmlStr, 'resources/foo.xsd', function(err, result) {
  if (err) {
    throw err;
  }

  result.valid; // true
});

You may validate readable streams, too:

var xmlStream = fs.createReadableStream('some.xml');

validator.validateXML(xmlStream, ...);

...and files, too:

validator.validateXML({ file: 'some.xml' }, ...);

Why

Because Java can do schema validation and NodeJS cannot.

License

MIT

Current Tags

  • 0.6.0                                ...           latest (10 months ago)

10 Versions

  • 0.6.0                                ...           10 months ago
  • 0.5.0                                ...           2 years ago
  • 0.4.0                                ...           2 years ago
  • 0.3.1                                ...           3 years ago
  • 0.3.0                                ...           4 years ago
  • 0.2.0                                ...           4 years ago
  • 0.1.0                                ...           4 years ago
  • 0.0.4                                ...           4 years ago
  • 0.0.3                                ...           5 years ago
  • 0.0.2                                ...           5 years ago
Maintainers (1)
Downloads
Today 0
This Week 30
This Month 33
Last Day 30
Last Week 0
Last Month 15
Dependencies (0)
None
Dev Dependencies (5)

Copyright 2014 - 2017 © taobao.org |