<!-- GNUe Schema DTD (Version 0.6.9) -->

<!--
     Copyright 2001-2005 Free Software Foundation

     This file is part of GNU Enterprise.

     GNU Enterprise is free software; you can redistribute it
     and/or modify it under the terms of the GNU General Public
     License as published by the Free Software Foundation; either
     version 2, or (at your option) any later version.

     GNU Enterprise is distributed in the hope that it will be
     useful, but WITHOUT ANY WARRANTY; without even the implied
     warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
     PURPOSE. See the GNU General Public License for more details.

     You should have received a copy of the GNU General Public
     License along with program; see the file COPYING. If not,
     write to the Free Software Foundation, Inc., 59 Temple Place
     - Suite 330, Boston, MA 02111-1307, USA.
-->

<!-- Entities for characters/symbols -->
<!ENTITY % lt "&#38;#60;">
<!ENTITY % gt "&#62;">
<!ENTITY % amp "&#38;#38;">

<!--  =================================================  -->
<!--  Datatype entities to make DTD more human readable  -->
<!--  =================================================  -->

<!ENTITY % text "CDATA">

<!ENTITY % true "Y">
<!ENTITY % false "N">
<!ENTITY % boolean "(%true;|%false;) #IMPLIED">

<!ENTITY % whole "NMTOKEN">
<!-- [0-9]+ -->

<!ENTITY % name "NMTOKEN">
<!-- [A-Za-z]([A-Z][a-z][0-9][#$_-])* -->



<!-- ================= -->
<!-- Top level element -->
<!-- ================= -->
<!ELEMENT schema (data?, description?, tables*)>
  <!ATTLIST schema author %text; #IMPLIED>
  <!ATTLIST schema description %text; #IMPLIED>
  <!ATTLIST schema title %text; #IMPLIED>
  <!ATTLIST schema version %text; #IMPLIED>


<!-- ======================== -->
<!-- Child elements of schema -->
<!-- ======================== -->
<!ELEMENT data (import-tabledata*, tabledata*)>

<!ELEMENT description EMPTY>

<!ELEMENT tables (import-table*, table*)>
  <!ATTLIST tables name %name; "tables">
  <!ATTLIST tables type %name; "table">


<!-- ====================== -->
<!-- Child elements of data -->
<!-- ====================== -->
<!ELEMENT import-tabledata EMPTY>
  <!ATTLIST import-tabledata library %name; #REQUIRED>
  <!ATTLIST import-tabledata name %name; #REQUIRED>
  <!ATTLIST import-tabledata tablename %name; #REQUIRED>

<!ELEMENT tabledata (primarykey?, rows?)>
  <!ATTLIST tabledata name %name; #REQUIRED>
  <!ATTLIST tabledata tablename %name; #REQUIRED>


<!-- ======================== -->
<!-- Child elements of tables -->
<!-- ======================== -->
<!ELEMENT import-table EMPTY>
  <!ATTLIST import-table name ID #REQUIRED>
  <!ATTLIST import-table library %name; #REQUIRED>
  <!ATTLIST import-table action (create | extend) "create">
  <!ATTLIST import-table description %text; #IMPLIED>
  <!ATTLIST import-table type %name; #IMPLIED>

<!ELEMENT table (constraints?, fields?, import-fields?, indexes?, 
                 primarykey?)>
  <!ATTLIST table name ID #REQUIRED>
  <!ATTLIST table action (create | extend) "create">
  <!ATTLIST table description %text; #IMPLIED>
  <!ATTLIST table type %name; #IMPLIED>


<!-- =========================== -->
<!-- Child elements of tabledata -->
<!-- =========================== -->
<!ELEMENT primarykey (pkfield*)>
  <!ATTLIST primarykey name %name; #REQUIRED>

<!ELEMENT rows (row*)>


<!-- ======================= -->
<!-- Child elements of table -->
<!-- ======================= -->
<!ELEMENT constraints (foreignkey*, unique*)>

<!ELEMENT fields (field*, import-field*)>

<!ELEMENT import-fields EMPTY>
  <!ATTLIST import-fields library %name; #REQUIRED>

<!ELEMENT indexes (index*)>


<!-- ============================ -->
<!-- Child elements of primarykey -->
<!-- ============================ -->
<!ELEMENT pkfield EMPTY>
  <!ATTLIST pkfield name %name; #REQUIRED>


<!-- ====================== -->
<!-- Child elements of rows -->
<!-- ====================== -->
<!ELEMENT row (value*)>


<!-- ============================= -->
<!-- Child elements of constraints -->
<!-- ============================= -->
<!ELEMENT foreignkey (fkfield*)>
  <!ATTLIST foreignkey name %name; #REQUIRED>
  <!ATTLIST foreignkey references %name; #IMPLIED>

<!ELEMENT unique (uqfield*)>
  <!ATTLIST unique name %name; #REQUIRED>


<!-- ======================== -->
<!-- Child elements of fields -->
<!-- ======================== -->
<!ELEMENT field EMPTY>
  <!ATTLIST field name ID #REQUIRED>
  <!ATTLIST field type %name; #REQUIRED>
  <!ATTLIST field default %text; #IMPLIED>
  <!ATTLIST field defaultwith (constant | serial | timestamp) "constant">
  <!ATTLIST field description %text; #IMPLIED>
  <!ATTLIST field length %whole; #IMPLIED>
  <!ATTLIST field nullable %boolean;>
  <!ATTLIST field precision %whole; "0">

<!ELEMENT import-field EMPTY>
  <!ATTLIST import-field name ID #REQUIRED>
  <!ATTLIST import-field library %name; #REQUIRED>
  <!ATTLIST import-field type %name; #REQUIRED>
  <!ATTLIST import-field default %text; #IMPLIED>
  <!ATTLIST import-field defaultwith (constant | serial | timestamp) 
                                      "constant">
  <!ATTLIST import-field description %text; #IMPLIED>
  <!ATTLIST import-field length %whole; #IMPLIED>
  <!ATTLIST import-field nullable %boolean;>
  <!ATTLIST import-field precision %whole; "0">


<!-- ========================= -->
<!-- Child elements of indexes -->
<!-- ========================= -->
<!ELEMENT index (indexfield*)>
  <!ATTLIST index name %name; #REQUIRED>
  <!ATTLIST index unique %boolean;>


<!-- ===================== -->
<!-- Child elements of row -->
<!-- ===================== -->
<!ELEMENT value EMPTY>
  <!ATTLIST value field %name; #IMPLIED>
  <!ATTLIST value type %name; "text">


<!-- ============================ -->
<!-- Child elements of foreignkey -->
<!-- ============================ -->
<!ELEMENT fkfield EMPTY>
  <!ATTLIST fkfield name %name; #REQUIRED>
  <!ATTLIST fkfield references %name; #REQUIRED>


<!-- ======================== -->
<!-- Child elements of unique -->
<!-- ======================== -->
<!ELEMENT uqfield EMPTY>
  <!ATTLIST uqfield name %name; #REQUIRED>


<!-- ======================= -->
<!-- Child elements of index -->
<!-- ======================= -->
<!ELEMENT indexfield EMPTY>
  <!ATTLIST indexfield name %name; #REQUIRED>


<!-- This DTD was created by gnuedtd
     Updated: 2007-07-12 16:15:05   -->

