Project 10.15
Data Input Forms

In this project, you will write a Java application that processes XML files containing information about data input forms. The Java application takes as command line input an XML file name/URL and produces as output the following four files:

  1. An HTML file that contains code to display the data input form on a browser. The HTML code must include Javascript to perform some basic validation such as data type checking for text box input.
  2. An Oracle SQL or MySQL script file that contains create table statements to create relational table(s) that can accept data submitted from the data input form.
  3. A Java servlet or PhP source file containing code to process data submitted by the user using the data input form. The program should simply insert the data into the database table(s).
  4. A Java servlet or PhP source file that contains code to display contents of the database in tabular form.

Data Input Forms

A data input form consists of one or more form elements that is capable of accepting input from a user. We shall consider 7 types of form elements: textbox, submit, reset, check box, radio buttons, select list, and multiple select list. Each of these form elements except for submit and reset has a datatype (integer, decimal, or string) associated with it. If a datatype is not provided, string would be assumed as the default data type.

If a data input form contains at least one multiselect form element or a check box group of two or more check boxes, one or more of the remaining (single valued) form elements must be classified as key elements. This is to facilitate creating a separate relational table for storing the multiple select values.

The data input form is described in XML. Some sample forms are shown below:

Some comments on the XML schema for data input forms:

Semantic Checks

Your XML parser program should check for semantic errors such as form element without a name or caption, more than one form element having the same name, data type mis-match, etc. and report these. No output is generated in this case.