# AdaBrowse DTD 2.0

    <!--
    This file is part of AdaBrowse.

    Copyright © 2002-2003 by Thomas Wolf.

    AdaBrowse 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. AdaBrowse 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 with this distribution, see file
    "GPL.txt". If not, write to the

      Free Software Foundation
      59 Temple Place - Suite 330
      Boston, MA 02111-1307
      USA.

    Author:
       Thomas Wolf

    Purpose:
       XML 1.0 Document Type Definition for AdaBrowse XML files.

    Version:
       AdaBrowse DTD 2.0 (generated by AdaBrowse V4.0).

       Earlier versions:
          AdaBrowse DTD 1.0 generated by AdaBrowse 3.0 up to 3.3.
          AdaBrowse DTD 1.1 generated by AdaBrowse 3.4 up to 3.4.2.

    Revision History

       20-AUG-2002   TW  Initial version.
       28-AUG-2002   TW  Corrections in cross-references.
       30-MAY-2003   TW  Added private attributes to UNIT and CHILD elements.
       07-JUL-2003   TW  Added indices.
    -->

    <!ENTITY % pure   "#PCDATA|KEYWORD|ATTRIBUTE|XREF|LITERAL" >
    <!ENTITY % inline "%pure;|ANCHOR|COMMENT|CODE" >

    <!ENTITY % lib_no_container
       "A_PROCEDURE |
        A_FUNCTION |
        A_GENERIC_PROCEDURE |
        A_GENERIC_FUNCTION |
        A_PACKAGE_INSTANTIATION|
        A_PROCEDURE_INSTANTIATION |
        A_FUNCTION_INSTANTIATION |
        A_PACKAGE_RENAMING |
        A_PROCEDURE_RENAMING |
        A_FUNCTION_RENAMING |
        A_GENERIC_PACKAGE_RENAMING |
        A_GENERIC_PROCEDURE_RENAMING |
        A_GENERIC_FUNCTION_RENAMING" >

    <!ENTITY % lib_container
       "A_PACKAGE |
        A_GENERIC_PACKAGE |
        A_GENERIC_SIGNATURE_PACKAGE" >

    <!ENTITY % no_lib_no_container
       "A_PRAGMA |
        A_USE_CLAUSE |
        A_USE_TYPE_CLAUSE |
        A_TYPE |
        A_SUBTYPE |
        A_VARIABLE |
        A_CONSTANT |
        A_DEFERRED_CONSTANT |
        AN_OBJECT_RENAMING |
        AN_EXCEPTION_RENAMING |
        AN_ENTRY |
        A_PROTECTED_PROCEDURE |
        A_PROTECTED_FUNCTION |
        AN_EXCEPTION" >

    <!ENTITY % no_lib_container
       "A_TASK_TYPE |
        A_PROTECTED_TYPE |
        A_TASK |
        A_PROTECTED_OBJECT" >

    <!ENTITY % boolean
       "FALSE | TRUE" >

    <!ENTITY % lib "%lib_no_container; | %lib_container;" >

    <!ENTITY % container "%lib_container; | %no_lib_container;" >

    <!ENTITY % no_container "%lib_no_container; | %no_lib_no_container; | A_TASK_TYPE | A_TASK" >
    <!-- Tasks and task types can also appear as items. -->

    <!-- Inline elements -->

    <!ELEMENT KEYWORD (#PCDATA) >

    <!ELEMENT ATTRIBUTE (#PCDATA) >

    <!ELEMENT LITERAL (#PCDATA) >

    <!ELEMENT CODE (%inline;)* >

    <!ELEMENT XREF (#PCDATA|LITERAL|KEYWORD)* >
    <!-- Actually, I'd like to specify that an XREF may contain either
         PCDATA, or a LITERAL, or a KEYWORD. It cannot contain PCDATA with
         interspersed LITERALs and KEYWORDs (which is what the above spec
         really says). However, there is *no* way in XML 1.0 to specify this!

         Literals and keywords are allowed within an XREF because of operators
         such as "&" or "or". -->

    <!ATTLIST XREF
              UNIT     CDATA       #REQUIRED
              POS      CDATA       #REQUIRED
              IS_TOP   (%boolean;) "FALSE"
              IS_LOCAL (%boolean;) "FALSE">
    <!-- XREFs always contain the Unit, even if the cross-reference is local.
         Local cross-references have IS_LOCAL="TRUE". Cross-references to
         other compilation UNITs have IS_TOP="TRUE". -->

    <!ELEMENT ANCHOR (%pure;)* >
    <!ATTLIST ANCHOR
              UNIT   CDATA       #REQUIRED
              POS    CDATA       #REQUIRED
              IS_TOP (%boolean;) "FALSE">
    <!-- ANCHORs always are local, so Unit always will equal the Name of the
         enclosing compilation UNIT. It is still explicitly repeated in each
         anchor to facilitate processing: there's no need to go look up the
         enclosing UNIT's name. Is_Top is TRUE only for the anchor on that
         compilation unit's name. -->

    <!-- Note: I briefly considered using attribute types ID and IDREF for
         ANCHORS and XREFs, respectively. However, that wouldn't have worked,
         for any IDREF must correspond to some ID in the XML; but our XML may
         contain references to units in other files. -->

    <!ELEMENT COMMENT (%pure;|ANCHOR|CODE)* >
    <!-- Comments cannot be nested -->

    <!-- Block elements -->

    <!ELEMENT UNIT (DEPENDENCIES?, DESCRIPTION?, (CONTAINER|ITEM)) >
    <!ATTLIST UNIT
              NAME    CDATA       #REQUIRED
              KIND    (%lib;)     #REQUIRED
              PRIVATE (%boolean;) "FALSE"
              POS     CDATA       #IMPLIED>
    <!-- Name and Kind of a UNIT can be used to generate indices. Pos can be
         used for cross-reference purposes; it is the position on the unit's
         CONTAINER's or ITEM's defining name. PRIVATE is "TRUE" if it's a
         private compilation unit. -->

    <!ELEMENT ITEM (SNIPPET, DESCRIPTION?) >
    <!ATTLIST ITEM
              NAME  CDATA            #IMPLIED
              KIND  (%no_container;) #IMPLIED
              UNIT  CDATA            #IMPLIED
              POS   CDATA            #IMPLIED>
    <!-- Name and Kind of an Item can be used to generate indices.  Unit and
         Pos can be used for cross-reference purposes; it is the position on
         the item's defining name. -->

    <!ELEMENT SNIPPET (LINE)+ >
    <!-- Used for code snippets. Implies <CODE> -->

    <!ELEMENT LINE    (%inline;)* >

    <!ELEMENT DESCRIPTION (BLOCK)+ >
    <!ELEMENT BLOCK       (LINE)+ >

    <!ELEMENT DEPENDENCIES (SNIPPET, DESCRIPTION?) >

    <!ELEMENT CONTAINER    (HEADER, CONTENT?, FOOTER) >
    <!ATTLIST CONTAINER
              NAME  CDATA         #IMPLIED
              KIND  (%container;) #IMPLIED
              UNIT  CDATA         #IMPLIED
              POS   CDATA         #IMPLIED>
    <!-- Name and Kind of a CONTAINER can be used to generate indices. Unit and
         Pos can be used for cross-reference purposes; it is the position on the
         container's defining name. -->

    <!ELEMENT HEADER  (LINE)* >

    <!ELEMENT FOOTER  (LINE)* >

    <!ELEMENT CONTENT  (TOP_ITEM?, CHILDREN?, EXCEPTIONS?, TYPE_SUMMARY?,
                        CONSTANTS?, VARIABLES?, OTHERS?, PRIVATE?) >

    <!ELEMENT TOP_ITEM (SNIPPET?, DESCRIPTION?) >

    <!ELEMENT CHILDREN (CHILD)+ >

    <!ELEMENT CHILD (#PCDATA|XREF)* >
    <!-- Actually, I'd like to specify that a CHILD may contain either
         PCDATA, or an XREF. It cannot contain PCDATA with interspersed XREFs
         (which is what the above spec really says). However, there is *no* way
         in XML 1.0 to specify this! -->

    <!ATTLIST CHILD
              NAME    CDATA       #IMPLIED
              KIND    (%lib;)     #IMPLIED
              PRIVATE (%boolean;) "FALSE">

    <!ELEMENT PRIVATE EMPTY >

    <!ELEMENT EXCEPTIONS (EXCEPTION)+ >

    <!ELEMENT EXCEPTION ((EXCEPTION_NAME)+, EXCEPTION_RENAME?, ULTIMATE_EXCEPTION?, DESCRIPTION?) >

    <!ELEMENT EXCEPTION_NAME (#PCDATA|ANCHOR)* >
    <!-- Actually, I'd like to specify that an EXCEPTION_NAME may contain either
         PCDATA, or an ANCHOR. It cannot contain PCDATA with interspersed ANCHORDs
         (which is what the above spec really says). However, there is *no* way in
         XML 1.0 to specify this! -->

    <!ELEMENT EXCEPTION_RENAME (%inline;)*>

    <!ELEMENT ULTIMATE_EXCEPTION (%inline;)*>

    <!ELEMENT OTHERS (CONTAINER|ITEM|PRIVATE)+ >

    <!ELEMENT CONSTANTS (ITEM)+ >

    <!ELEMENT VARIABLES (ITEM)+ >

    <!ELEMENT TYPE_SUMMARY (TYPE)+ >

    <!ELEMENT TYPE (TYPE_NAME, TYPE_KIND?, PARENT_TYPE?, OPERATIONS?) >

    <!ELEMENT TYPE_NAME (#PCDATA|XREF)* >
    <!-- Actually, I'd like to specify that a TYPE_NAME may contain either
         PCDATA, or an XREF. It cannot contain PCDATA with interspersed XREFs
         (which is what the above spec really says). However, there is *no* way
         in XML 1.0 to specify this! -->

    <!ELEMENT TYPE_KIND (#PCDATA)>

    <!ELEMENT PARENT_TYPE (#PCDATA|XREF)* >
    <!-- Actually, I'd like to specify that a PARENT_TYPE may contain either
         PCDATA, or an XREF. It cannot contain PCDATA with interspersed XREFs
         (which is what the above spec really says). However, there is *no* way
         in XML 1.0 to specify this! -->

    <!ELEMENT OPERATIONS (OPLIST)+ >

    <!ELEMENT OPLIST (XREF)+ >
    <!ATTLIST OPLIST
              KIND (OVERRIDDEN|OWN|INHERITED) #REQUIRED>

    <!-- Indices. New in V2.0 -->

    <!ELEMENT INDEX_ITEM (#PCDATA|XREF)* >
    <!-- This time, the definition is actually correct. -->

    <!ELEMENT INDEX_SECTION (INDEX_ITEM)+ >
    <!ATTLIST INDEX_SECTION
              NAME  CDATA #REQUIRED>
    <!-- The name is the single common starting character of all contained
         INDEX_ITEMs -->

    <!ELEMENT INDEX ((INDEX_SECTION)+|(INDEX_ITEM)*) >
    <!ATTLIST INDEX
              NAME  CDATA #REQUIRED
              TITLE CDATA #REQUIRED>

    <!-- Document root -->

    <!ELEMENT ADABROWSE ((UNIT)+, (INDEX)*) >