Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

XML or Database for Auto form generation

So I'm creating a program that auto generates forms for data entry. The form is created by a user (its a simple table setup with the ability to merge cells). Some of the cells contain text views, others contain text inputs (all based on how the user draws it).

This form is then sent to another application that draws it back out. I was wondering what the best method is to represent the form. I though either use XML to represent the form or use a database that would basically function as a grid and row 1 column 1 in the database would match the form cell row 1 column 1 and so on (kind of an odd way to use a database).

The form creation program is made in C++ and the form regeneration program is created in Java.

Is there an even better way to do this?

Thanks,

like image 962
mgalal Avatar asked Mar 27 '26 01:03

mgalal


2 Answers

I am also thinking the same thing because I am in to creating dynamic forms for my framework to. So I will share some thoughts with you. Using database to add new forms like adding a record in one table that specifies the form and its fields in another having the ability to select it's field types to, or creating one table for each form and each time create a new table or altering its fields (sound messy).. or create a folder with a bunch of xmls that are used for the structure of your forms?

When it comes to database:

  1. Your application is stricted with a specific database application like sql server 2008 or mysql or mysqli or oracle etc.
  2. Your application is causing network traffic, not that bad but it is doing it eveytime you need to create or use a form.
  3. You need a panel that creates those forms using the database, and can be accessed if its web even from your mobile.

When it comes to XML:

  1. Your application is free from database version restrictions.
  2. you need the impersonator to have the right to create files in a spesific directory in your frameowork.
  3. You don't need a panel even though you can create one, because XML are human readable files. So you can make one while eating your dinner and serve it to your system, and wala, you have your form generated.

These are my thoughts for now.

How about the methods that will be used in the form? will those also be dynamic? How can you specify what calls what? this is also what you need to take in account.

like image 178
themhz Avatar answered Mar 28 '26 14:03

themhz


I think that XML is a much better choice here. Using database as a grid could be more of a headache than needed. You will have to deal with all the problems related to having the database and not really get any benefits of the database. The industry decides to go with xml more often than not as well (xbrl being one example).

like image 31
bjedrzejewski Avatar answered Mar 28 '26 15:03

bjedrzejewski