xsd2json
========

## To build the JSON schema object

This directory contains a script for PhantomJS, build.js, which can build the mods.js file at the root of the repository or as follows:

    $ phantomjs build.js ../mods.js
    $ phantomjs build.js ../demo/examples/mods.json ../demo/examples/mods-3-4/ mods-3-4.xsd
    $ phantomjs build.js dcterms.js ../demo/examples/dcterms/ ../demo/examples/dcterms.xsd dctermsSchema

Usage: 
`build.js [<output filename> <schema path> <base schema filename> <JSON variable name>]`
- output filename - The name of the file to generate, containing the JSON object created from the given schemas.  If set to "" then the results are output to console.
- schema path - The file path to the location of the schemas to be used.  If not set, then the current directory is used.
- base schema filename - The filename of the first schema to begin processing, which will serve as the root of the generated object.  *.xsd if not set.
- JSON variable name - Name of the javascript variable assigned the JSON object result.  "schema" if not set.


## To extract the schema object at run time
`var extractor = new Xsd2Json("mods-3-4.xsd", {"schemaURI":"mods-3-4/"});`
