Short introduction to Eleusoft Schema for EFormBin

    1. 1 Introduction
    2. 2 Complex Type
      1. 2.1 Form Complex Type
      2. 2.2 Initial Schema
      3. 2.3 Bin Description
    3. 3 Form Field
      1. 3.1 Field Type
      2. 3.2 Simple Field
      3. 3.3 Order Example
      4. 3.4 Field Occurrence
      5. 3.5 Complex Field
    4. 4 Metadata
    5. 5 Simple Type
      1. 5.1 Facets

Introduction

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.

Complex Type

A Complex Type contains Form Field(s), is like a group of properties, like the Java Class of a Bean.

Form Complex Type

A Complex Type defines a Form; in EFormBin when there are more complex types the one with name Form is chosen.

Initial Schema

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>

Bin Description

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

Form Field

The <field> element defines a field of the Complex Type and consequently a field of the form. Each field must have an unique name.

Field Type

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).

Simple Field

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

Order Example

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>

See it in Form BIN 3ps1N

Field Occurrence

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.

Complex Field

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>

See it in Form BIN UWhCQ

Metadata

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>

See it in Form BIN Uw9Tw

Metadata names and values are defined in the Eleusoft Forms documentation.

Simple Type

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

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>