<commit_before># xsd-schema-validator


A (XSD) schema validator for [NodeJS](nodejs.org) that uses [Java](https://www.java.com) to perform the actual validation.


## Prerequisites

Ensure a `JAVA_HOME` environment variable exists that points to an installed JDK.

On some platforms, i.e. [Mac OSX](http://www.mkyong.com/java/how-to-set-java_home-environment-variable-on-mac-os-x/) you need to define it manually.


## How to Use

Install via [npm](http://npmjs.org):

```
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
});
```

## Why

Because Java can do schema validation and NodeJS cannot.


## License

MIT<commit_msg>docs(project): add travis badge + stream hint<commit_after># xsd-schema-validator

[![Build Status](https://travis-ci.org/nikku/node-xsd-schema-validator.svg?branch=master)](https://travis-ci.org/nikku/node-xsd-schema-validator)

A (XSD) schema validator for [NodeJS](nodejs.org) that uses [Java](https://www.java.com) to perform the actual validation.


## Prerequisites

Ensure a `JAVA_HOME` environment variable exists that points to an installed JDK.

On some platforms, i.e. [Mac OSX](http://www.mkyong.com/java/how-to-set-java_home-environment-variable-on-mac-os-x/) you need to define it manually.


## How to Use

Install via [npm](http://npmjs.org):

```
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, ...);
```


## Why

Because Java can do schema validation and NodeJS cannot.


## License

MIT
{'fraction_non_alphanumeric': 0.15234375, 'fraction_numerical': 0.0, 'mean_word_length': 4.148241206030151, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 4, 'lorem ipsum': 0, 'www.': 4, 'xml': 7}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1127873', 'n_tokens_mistral': 716, 'n_tokens_neox': 687, 'n_words': 184}