An Eleusoft Schema is the base definition of a Form built with EFormBin and for Eleusoft Forms in general.
EFormBin let a developer build an Eleusoft Schema knowing only some little XML (what is an Element, an Attribute).
This document attempts to introduce the Eleusoft Schema to an EFormBin user in very short time.
A Complex Type contains Form Field(s), is like a group of properties, like the Java Class of a Bean.
A Complex Type defines a Form;
in EFormBin when there are more complex types
the one with name Form
is chosen.
When one creates an empty BIN gets the following schema,
that defines a Complex Type named Form
with a string field
named Hello
:
<complexType name='Form' description=''> <field name='Hello' default='World' type='xs:string'/> </complexType>
The description
attribute of the form <complexType>
element may contain the description of the BIN that
appears over the form and in the page META data.
The description
attribute may contain a link to a BIN in the form:
bin:{bin-id}
For example: bin:3daWW
The description
attribute may contain an hashtag that links to a search,
for example: #ARIA
The <field>
element defines a field of the Complex Type
and consequently a field of the form. Each field must have an unique name.
The type
attribute of the <field>
element contains the name of the type of the field;
the type of a field can be a Simple Type (a scalar value like a number) or a Complex Type (a group of fields, like an object).
A Simple Field is a Form Field whose Field Type is a Simple Type.
In the Initial Schema
the type of the Hello
Simple Field is xs:string
that
is a built-in Simple Type defined in the
W3C Schema Datatypes specification,
together with others like xs:int
, xs:decimal
,
xs:date
, xs:dateTime
etc.. See it in Form BIN IfjRT See it in Form BIN jDksv
We are now able to modify the initial schema creating an Order
form,
note how a xs:date
Simple Field has been added:
<complexType name='Form' description='Order Form'> <field name='employee' type='xs:string'/> <field name='date' type='xs:date'/> </complexType>
A <field>
by default is required with single occurrence.
<field name='number' type='xs:int'/>
Is the same as:
<field name='number' type='xs:int' minOccurs='1' maxOccurs='1'/>
A field can be made optional using minOccurs='0'
,
for example an optional note
field could be added to the Order Example:
<field name='note' minOccurs='0' type='xs:date'/>
The maxOccurs
attribute can be used to declare a collection,
an example of collection with no size limit:
<field name='telephones' maxOccurs='n' type='xs:string'/>
A collection can have also a numeric value as size limit (> 1);
the literals n
, unbounded
and *
are equivalent.
Most of the fields of a form are Simple Field but they can also be Complex Field
when the Field Type is a Complex Type, like the Lines
field in this Order-OrderLine example:
<complexType name='Form' description='Order Form'> <field name='employee' type='xs:string'/> <field name='date' type='xs:date'/> <field name='lines' type='OrderLine' maxOccurs='n'/> </complexType> <complexType name='OrderLine'> <field name='product' type='xs:string'/> <field name='price' type='xs:decimal'/> </complexType>
Metadata can be attached to <field>
and types using the
extra:*
XML attributes.
In the following example the EMail
field is declared
to use the email
Form Control.
<complexType name='Form' description='Contact Form'> <field name='EMail' type='xs:string' extra:form.control='email'/> </complexType>
Metadata names and values are defined in the Eleusoft Forms documentation.
A Simple Type defines a scalar value like a number, a string.
Some Simple Type are built-in, others can be defined restricting a built-in.
A <simpleType>
element is used to declare a Simple Type;
the following is an EMail Simple Type example, it can be used for all EMail fields:
<simpleType name='EMail' type='xs:string' extra:form.control='email'/>
The main reason to create a Simple Type is to apply Metadata and Facets and share this configuration.
Facets are parameters used to restrict the valid values of a simple type.
Facets configure things like for example the minimum length of a string, they are defined in the W3C Schema Datatypes specification.
A <facet>
can be used inside a <field>
or a <simpleType>
.
A popular example, a not empty string:
<complexType name='Form' description='Contact Form'> <field name='lastName' type='xs:string'> <facet name='minLength' value='1'/> </field> </complexType>
An equivalent example with a <simpleType>
<complexType name='Form' description='Contact Form'> <field name='lastName' type='NotEmptyString'/> </complexType> <simpleType name='NotEmptyString' type='xs:string'> <facet name='minLength' value='1'/> </simpleType>