XmlDb2Java

<< Project Home | Index | Data Access Objects (DAO) | DataBean (ValueObject) | XML database file

XML Database Definition File

Describes table schemas, primary key fields, and default 'hard coded' values if any.

database.dtd

<?xml version="1.0" encoding="UTF-8"?>
<!-- database definition -->
<!ELEMENT database (table+)>
<!ELEMENT table (tablename, column+)>
<!ELEMENT tablename (#PCDATA)>
<!ELEMENT column (#PCDATA)>
<!ATTLIST column 
  type (int|double|String) #IMPLIED
  value CDATA              #IMPLIED
  pk (T|F)  "F"
>
  

sample database xml file

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE database SYSTEM "database.dtd">
<!--database definition for mytoc tables-->
<database>
  <table>
    <tablename>CATEGORY</tablename>
    <column type="int" pk="T">MYTOCID</column>
    <column type="int" pk="T">CATID</column>
    <column type="String">CATEGORY</column>
  </table>
  <table>
    <tablename>LINK</tablename>
      <column type="String">CAPTION</column>
      <column type="String">LINK</column>
      <column type="int" pk="T">MYTOCID</column>
      <column type="int" pk="T">CATID</column>
      <column type="int" pk="T">SEQNUM</column>
  </table>
  <table>
    <tablename>USERPROFILE</tablename>
      <column type="String">EMAIL</column>
      <column type="String">FNAME</column>
      <column type="String">MNAME</column>
      <column type="String">LNAME</column>
      <column type="String" pk="T">USERID</column>
      <column type="String" pk="T">PASSWORD</column>
      <column type="String" >SIGNDATE</column>
      <column type="int">MYTOCID</column>
  </table>
</database>