<!-- $Project: polymake $$Id: datafile.dtd 8991 2008-12-15 21:28:28Z gawrilow $
     Definition of the polymake data file format.
     Some constraints cannot be effectively expressed by the DTD
     means, they are put into remarks -->

<!-- In a standalone polymake data file the default namespace is used
     for all tags.  If a polymake object has to be embedded in another
     XML document coming from different namespace, an explicit
     namespace prefix should be specified in the internal subset of
     the containing document, overriding the following two settings -->
 
<!ENTITY % ns-prefix ''>           <!-- tag and attribute namespace prefix -->
<!ENTITY % ns-declaration 'xmlns'> <!-- attribute for namespace declaration -->

<!-- Define all the global element names, with optional prefix -->

<!ENTITY % object       "%ns-prefix;object">
<!ENTITY % property     "%ns-prefix;property">
<!ENTITY % attachment   "%ns-prefix;attachment">
<!ENTITY % description  "%ns-prefix;description">
<!ENTITY % credit       "%ns-prefix;credit">
<!ENTITY % e            "%ns-prefix;e">
<!ENTITY % v            "%ns-prefix;v">
<!ENTITY % m            "%ns-prefix;m">
<!ENTITY % t            "%ns-prefix;t">


<!-- Root element, as well as a container for subobjects -->
<!ELEMENT %object; ( %description;? , %credit;* , ( %property; | %attachment; )* )>

<!ATTLIST %object;
          type    CDATA  #IMPLIED
          version CDATA  #IMPLIED
          name    CDATA  #IMPLIED
          tm      CDATA  #IMPLIED
          ext     CDATA  #IMPLIED
          %ns-declaration; CDATA #IMPLIED
>

<!ELEMENT %description; (#PCDATA) >
<!ELEMENT %credit; (#PCDATA) >
<!ATTLIST %credit;
          product CDATA #REQUIRED
>

<!--  type, version, and xmlns are required for top-level object.
      version and xmlns are forbidden in subobjects. -->

<!ELEMENT %property; ( %v; | %m; | %t; | %object; )* >

<!ATTLIST %property;
          name    CDATA  #REQUIRED
          type    CDATA  #IMPLIED
          value   CDATA  #IMPLIED
          ext     CDATA  #IMPLIED
          ref     CDATA  #IMPLIED
          undef   (true) #IMPLIED
>
<!-- value, ref, and undef attributes are mutually exclusive
     and allowed only for empty contents elements -->

<!ELEMENT %attachment; ( %v; | %m; | %t; )* >

<!ATTLIST %attachment;
          name    CDATA  #REQUIRED
          type    CDATA  #REQUIRED
          ext     CDATA  #IMPLIED
          value   CDATA  #IMPLIED
>

<!-- Structure elements of complex property values -->

<!ELEMENT %m; ( %v; | %m; | %t; )* >
<!ATTLIST %m;
          cols  CDATA  #IMPLIED
          dim   CDATA  #IMPLIED
>

<!ELEMENT %v; ( %e;* | #PCDATA ) >
<!ATTLIST %v;
          dim   CDATA  #IMPLIED
          i     CDATA  #IMPLIED
>

<!ELEMENT %t; (( %v; | %m; | %t; | %e; )* | #PCDATA ) >

<!ELEMENT %e; (#PCDATA) >
<!ATTLIST %e;
          i   CDATA  #IMPLIED
>
