Introduction

Top  Previous  Next

The schema language, developed for this module, is novel for it’s simplicity and expressive power. Anyone familiar with XML should be able to pick it up quickly and easily. This is because a schema is nothing more than an XML instance document annotated with meta-information (in the form of XML attributes). These attributes are then used by the code generator to produce Java code that conforms to the schema language.

 

Let's begin with a simple example.

 

We start with the following XML instance document.

 

<root>
    <container attribute="4">
        <value>12</value>
    </container>
</root>

 

Creating a schema is as simple as wrapping the instance document in a schema root element and then annotating the instance document with the appropriate meta-data.

 

<schema packageScope="com.wickedfastsolutions.demo.domain">
    <root>
        <container>
            <attribute parent="container" type="positiveInteger">4</attribute>
            <value type="integer" minValue="0" maxValue="255">12</value>
        </container>
    </root>
</schema>