XML Definition Files for Database Tables

The structure of each of tables in the database for each coursework is defined in an XML file for each table. A file for a table defines the columns in the table, their names and other attributes. This allows same database table editor code to be used on any table whatever the structure, for the table editor to create new instances of tables, and for table editor commands to access the names of the columns without any of these being pre-programmed into the code.

The Document definition file, "dBaseTable.dtd" for the XML definition file is


        
<?xml version="1.0" encoding="UTF-8"?>
<!ELEMENT dBaseTable (Column+ | OtherCreateDef*) >
<!ATTLIST dBaseTable name NMTOKEN #REQUIRED>
<!ELEMENT Column (Description?,uniqueID*,value*,autoNumber?,sequence?) >
<!ELEMENT Description (#PCDATA)>
<!ELEMENT uniqueID (#PCDATA)>
<!ELEMENT value (#PCDATA)>
<!ELEMENT autoNumber EMPTY>
<!ELEMENT sequence EMPTY>
<!ELEMENT OtherCreateDef (#PCDATA)>
<!ATTLIST Column
	name NMTOKEN #REQUIRED
	null ( true | false) "false" 
	type ( DATE | DATESTAMP | TIMESTAMP | TIME | CHAR | VARCHAR | INTEGER | DOUBLE | FLOAT | BLOB | TEXT ) "VARCHAR" 
	size  CDATA  "1"
	primary_key ( true | false ) "false"
	auto_increment ( true | false ) "false"
        no_spaces ( true | false ) "false"
>
<!ATTLIST value
	default	( true | false ) "false"
>
        
  
.

The structure of the XML definition files is defined here.

Database Table Element

This is the outermost element. It has single attribute "name" which is assigned the name of the table. It contains multiple "Column" or "OtherDef" elements.