Skip to content

Commit

Permalink
update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
sterpe committed Feb 6, 2015
1 parent d9ecc3c commit ea772d2
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 0 deletions.
42 changes: 42 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,45 @@

Online demo at http://syssgx.github.com/xml.js/

This package exports the `xmllint` object which is an Emscripten port of
libxml2's `xmllint` command for use in the browser or node.

##### API #####

```javascript

Object xmllint.validateXML({
xml: "String",
schema: "String" || ["String", "String", ...]
});

```

The return value Object has one property `errors` which is either null,
in the case of no errors, or an Array of error strings....eg:

```javascript

if (!xmllint.validateXML(opts).errors) {
//there were no errors.
}

```

Usable with Browserify via `browserify-shim`.

#### Building xmllint from source ####

Install emscripten.

```
git clone
git submodule init
git submodule update
./script/clean
./script/libxml2
./script/compile
./script/test
```

There are also equivalent `gulp` tasks.
6 changes: 6 additions & 0 deletions test/test.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,11 @@
<br>
<input type="submit" value="validate">
</form>
<!-- browserify/browserify-shim bundle test:
expect to see:
Object { errors: null }
in the console log.
-->
<script src="./bundle.js"></script>
</body>
</html>

0 comments on commit ea772d2

Please sign in to comment.