Skip to content
highsource edited this page Dec 24, 2014 · 3 revisions

Overview

Jsonix Schema Compiler supports a number of configuration options.

Configuration can be provided in binding files.

You can configure modules and mappings which will be generated as well as how they will be written out.

Please refer to the following pages for more information.

Examples

Assume we have a purchase order schema defined in the file purchaseorder.xsd.

Basic usage - no configuration

You can compile this schema without any configuration:

java -jar jsonix-schema-compiler-full.jar -p PO purchaseorder.xsd

Generates the PO.js module which exports the PO mapping.

Configuration in Binding Files

You can provide configuration in the binding file (binings.xjb):

java -jar jsonix-schema-compiler-full.jar -b bindings.xjb purchaseorder.xsd

Example of the bindings.xjb file:

<jaxb:bindings
    version="1.0"
    xmlns:jaxb="http://java.sun.com/xml/ns/jaxb" 
    xmlns:xs="http://www.w3.org/2001/XMLSchema" 
    xmlns:jsonix="http://jsonix.highsource.org/customizations"
    jaxb:extensionBindingPrefixes="jsonix">

    <jaxb:bindings schemaLocation="purchaseorder.xsd" 
        node="/xs:schema">

        <jaxb:schemaBindings>
            <jaxb:package name="com.acme.foo.po"/>
        </jaxb:schemaBindings>

        <jsonix:mapping package="com.acme.foo.po" name="PO"/>
    </jaxb:bindings>
</jaxb:bindings>

Also generates the PO.js module which exports the PO mapping.

Configuring the default output

<jsonix:output naming="standard" fileName="#{module.name}.std.js"/>
<jsonix:output naming="compact" fileName="#{module.name}.cmp.js"/>

Generates PO.std.js with standard naming and PO.cmp.js with compact naming.

Configuring the mapping

<jsonix:mapping package="com.acme.foo.po" name="PurOrd"/>

Generates a PurOrd.js which exports the PurOrd mapping

Configuring the module

<jsonix:module name="PurchaseOrder">
    <jsonix:mapping package="com.acme.foo.po" name="PO"/>
    <jsonix:output naming="compact" fileName="${module.name}.js"/>
    <jsonix:output naming="standard" fileName="${module.name}.standard.js"/>
</jsonix:module>

Generates the PurchaseOrder.js (compact naming) and PurchaseOrder.standard.js (standard naming) which export the PO mapping.

Clone this wiki locally