Dtd for MrProject

<!--
  Copyright (C) 2001/2002/2003 Karsten Reincke <karsten.reincke@karubik.de>
  
  This file mrproject.dtd describes howto build a mrproject-dabase-xml-file

  This file is part of 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 of the License, or
  (at your option) any later version.
-->

<!-- 
  Some general remarks: 
  
  (1) Very often mrproject uses attributes 'id'. But as values of these 
	   attributes mrproject inserts integeres like id="1" instead of strings 
	   starting with a character. Therefore these attribute can't be specified 
	   as ID and they can't be denoted by IDREF-attributes.
    	For solving that problem I've specified id-attributes as CDATA too.
-->

<!--
  (I.A) nearly each mrproject-xml-database-file consists of seven sections:
  (a) one or more lists of properties (which itself contains each single property)
  (b) a list of phase-names (by which one can describe the state of the project)
  (c) a list of calendars (by which one defines types of working days)
  (d) a list of tasks
  (e) a list of recource-groups
  (f) a list of resources (persons)
  (g) a list of allocations (= assignments between tasks and recources)
   ...
-->
<!ELEMENT project (properties*, phases?, calendars?, tasks, resource-groups, resources, allocations)>

<!--
  (I.B) ... and each mrproject-xml-database-file has
   (a) a specific namespace being denoted by the tag
       xmlns="http://mrproject.codefactory.se/format/project/1"
   (b) a name denoting the project as whole (the set of tasks) [maybe the empty string]
   (c) a name denoting the company which realizes the project [maybe the empty string]
   (d) a name denoting the project-leader [maybe the empty string]
   (e) a number denoting the ids of one of the phases
   (f) the date of the project-start 
      (nearly noted as ISO 8601 compliant date string closed by a 'Z')
   (g) the mrproject-version (for the moment the number 2)
   (g) a number denoting the id of the selected calendar
-->
<!ATTLIST project name CDATA #REQUIRED>
<!ATTLIST project company CDATA #REQUIRED>
<!ATTLIST project manager CDATA #REQUIRED>
<!ATTLIST project phase CDATA #IMPLIED>
<!ATTLIST project project-start CDATA #IMPLIED> <!-- YYYYMMDDTHHmmssZ -->
<!ATTLIST project mrproject-version CDATA #IMPLIED>
<!ATTLIST project calendar CDATA #IMPLIED>


<!-- 
  (1) each list of properties contains one or more properties 
-->
<!ELEMENT properties (property+)>

<!--  
  (1.A) each property has only some attributes: 
  (a) a name
  (b) a type
  (c) an owner
  (d) a label
  (e) a description
  (f) a value
-->
<!ELEMENT property (list-item*)>
<!ATTLIST property name CDATA #REQUIRED>
<!ATTLIST property type CDATA #IMPLIED>
<!ATTLIST property owner CDATA #IMPLIED>
<!ATTLIST property label CDATA #IMPLIED>
<!ATTLIST property description CDATA #IMPLIED>
<!ATTLIST property value CDATA #IMPLIED>


<!-- 
  (1.A) each list-item  is an empty unit which contains a value as attribute 
-->

<!ELEMENT list-item EMPTY>
<!ATTLIST list-item value CDATA #REQUIRED>

<!-- 
  (2) each list of phases contains none or more single phases ...
-->
<!ELEMENT phases (phase*)>
<!-- 
  and each phase is an empty unit with an attribute 'name'
-->
<!ELEMENT phase EMPTY>
<!ATTLIST phase name CDATA #REQUIRED>


<!--  
  (3) each calendars describing section contains section of datatypes 
  followed by a row of calenmdars
-->
<!ELEMENT calendars (day-types?, calendar*)>

<!--  
  (3.A) each data-type-section contains one or more data-type entries
-->
<!ELEMENT day-types (day-type+)>

<!--
  (3.A.a) each single data-type is an empty unit and has the following features:
  (a) an id
  (b) a name
  (c) a description
-->
<!ELEMENT day-type EMPTY>
<!ATTLIST day-type id CDATA #REQUIRED>
<!ATTLIST day-type name CDATA #REQUIRED>
<!ATTLIST day-type description CDATA #REQUIRED>

<!--  
  (3.B) each calendar contains ...
  (a) a description of its default week
  (b) a set of overridden day-types
  (c) a set of day descriptions
  ... and is specified by 
  (d) an id
  (b) a name
-->

<!ELEMENT calendar (default-week?, overridden-day-types?, days?)>
<!ATTLIST calendar id CDATA #REQUIRED>
<!ATTLIST calendar name CDATA #REQUIRED>

<!--  
  (3.B.a) each default-week is an empty unit which for each day of the week 
  contains a reference into the set of (overidden) daytypes
-->
<!ELEMENT default-week EMPTY>
<!ATTLIST default-week mon CDATA #REQUIRED>
<!ATTLIST default-week tue CDATA #REQUIRED>
<!ATTLIST default-week wed CDATA #REQUIRED>
<!ATTLIST default-week thu CDATA #REQUIRED>
<!ATTLIST default-week fri CDATA #REQUIRED>
<!ATTLIST default-week sat CDATA #REQUIRED>
<!ATTLIST default-week sun CDATA #REQUIRED>

<!--  
  (3.B.b) each set of overridden-day-types contains
  one or more single overridden-day-types which 
  (3.B.b.I) itself contains one or more intervals which define the working-times.
  Each single overridden-day-type is made referable by a specific id
-->
<!ELEMENT overridden-day-types (overridden-day-type*)>
<!ELEMENT overridden-day-type (interval+)>
<!ATTLIST overridden-day-type id CDATA #REQUIRED>

<!--
  (3.B.b.II) each interval is an empty unit and defines the start and
  end of the interval by using the corresponding attributes
-->
<!ELEMENT interval EMPTY>
<!ATTLIST interval start CDATA #REQUIRED>
<!ATTLIST interval end CDATA #REQUIRED>

<!--  
  (3.B.c) each set of days contains ...
  (3.B.c.I) a row of days which are empty units being defined by
  (a) a date attribute
  (b) a type attribute
  (c) an id attribute
-->
<!ELEMENT days (day*)>
<!ELEMENT day EMPTY>
<!ATTLIST day date CDATA #REQUIRED>
<!ATTLIST day type CDATA #REQUIRED>
<!ATTLIST day id CDATA #REQUIRED>


<!-- 
  (4) each list of tasks consists of none or many tasks 
-->
<!ELEMENT tasks (task*)>

<!-- 
  (4.A) each task consists of 
  (a) none or more constraints,
  (b) a list of predecessor and 
  (c) none or many tasks (implicitely recursive definition)
  ...
-->
<!ELEMENT task (constraint*,predecessors*,task*)>
<!--
  ... and each task has
  (a) a specific uniq id 
  (b) a name denoting the task [maybe the empty string]
  (c) a startdate denoted by an iso-8601 string of the form YYYYMMDDThhmmss
  (d) an endate denoted by an iso-8601 string of the form YYYYMMDDThhmmss
  (e) an natural number between 0 and 100 denoting the degree (percent) of being fullfilled
  (f) a (describing) note concerning the task [maybe the empty string]
  (g) a work string
  (h) a note string
  (i) a type string
  (i) a scheduling string
-->

<!ATTLIST task id CDATA #REQUIRED>
<!ATTLIST task name CDATA #REQUIRED>
<!ATTLIST task start CDATA #REQUIRED>
<!ATTLIST task end CDATA #REQUIRED>
<!ATTLIST task percent-complete CDATA #REQUIRED>
<!ATTLIST task note CDATA #REQUIRED>
<!ATTLIST task work CDATA #IMPLIED>
<!ATTLIST task type CDATA #IMPLIED>
<!ATTLIST task scheduling CDATA #IMPLIED>

<!-- 
  (4.A) each list of constraints consists of none or many constraints 
  and each constraint has the attributes 
  (a) type: must-start-on (or .. or must-end-on?)
  (b) time: date nearly noted as ISO 8601 compliant string closed by a 'Z'
-->
<!ELEMENT constraint EMPTY>
<!ATTLIST constraint type (must-start-on|must-end-on) #REQUIRED>
<!ATTLIST constraint time CDATA #REQUIRED>

<!-- 
  (4.B) each list of predecessors consists of none or many predecessors 
-->
<!ELEMENT predecessors (predecessor*)>

<!-- 
  (4.B.1) each  predecessor is an empty entity ... 
-->
<!ELEMENT predecessor EMPTY>
<!--
    ... which has
   (a) a specific uniq id (denoting itself)
   (b) a predecessor id (denoting another task)
   (c) a type described the strings
		    (I)   FS :- Finish to Start 
		    (II)  FF :- Finish to Finish 
		    (III) FS :- Start to Start 
		    (IV)  SF :- Start to Finish 
-->
<!ATTLIST predecessor id CDATA #REQUIRED>
<!ATTLIST predecessor predecessor-id CDATA #REQUIRED>
<!ATTLIST predecessor type (FS|SF|FF|SS) #REQUIRED>
<!ATTLIST predecessor lag CDATA #IMPLIED>


<!-- 
  (5) each list of resource-groups consists of none or many groups
  of whose one can be selected as default group
-->
<!ELEMENT resource-groups (group*)>
<!ATTLIST resource-groups default_group CDATA #IMPLIED>


<!-- 
  (5.A) each  group is an empty entity ... 
-->
<!ELEMENT group EMPTY>
<!--
  ... which has
  (a) a specific uniq id (denoting the group itself)
  (b) a name denoting the group as whole
  (c) an admin-name denoting the group admin [maybe the empty string]
  (d) an admin-phone denoting the phonenumber of the group admin [maybe the empty string]
  (e) an admin-email denoting the email-address of the group admin [maybe the empty string]
  (f) a note attribute
-->
<!ATTLIST group id CDATA #REQUIRED>
<!ATTLIST group name CDATA #REQUIRED>
<!ATTLIST group admin-name CDATA #REQUIRED>
<!ATTLIST group admin-phone CDATA #REQUIRED>
<!ATTLIST group admin-email CDATA #REQUIRED>
<!ATTLIST group note CDATA #IMPLIED>

<!-- 
  (6) each list of resources consists of none or many resources 
-->
<!ELEMENT resources (resource*)>

<!-- 
  (6.A) each  resource is an empty entity ... 
-->
<!ELEMENT resource (properties?)>
<!--
  ... which has
  (a) a specific uniq id (denoting the group itself)
  (b) a name denoting the group as whole
  (c) a group id (denoting the resource-group of which the resource is a member)
       [ must be a value of the set of id-values of the groups or -1 ]
  (d) a type-determiner [ an integer: 1 = work, 2 = material ]
  (e) an unit-determiner (in unsigned integer? planned for computing the possible credits?)
  (f) an admin-email denoting the email-address of the group admin [maybe the empty string]
  (g) a std-rate-float-value
  (h) an ovt-rate-float-value
  (i) a note attribute
-->
<!ATTLIST resource id CDATA #REQUIRED>
<!ATTLIST resource name CDATA #REQUIRED>
<!ATTLIST resource group CDATA #REQUIRED>
<!ATTLIST resource type (1 | 2) #REQUIRED>
<!ATTLIST resource units CDATA #REQUIRED>
<!ATTLIST resource email CDATA #REQUIRED>
<!ATTLIST resource std-rate CDATA #REQUIRED>
<!ATTLIST resource ovt-rate CDATA #IMPLIED>
<!ATTLIST resource note CDATA #IMPLIED>

<!-- 
  (7) each list of allocations consists of none or many allocations
-->
<!ELEMENT allocations (allocation*)>
<!-- 
  (7.A) each  allocation is an empty entity ... 
-->
<!ELEMENT allocation EMPTY>
<!--
  ... which has
  (a) a task-id (denoting the intended task)
      [ must be a value of the set of all id-values of the tasks ]
  (b) a resource-id (denoting the intended resource)
       [ must be a value of the set of id-values of the resources ]
-->
<!ATTLIST allocation task-id CDATA #REQUIRED>
<!ATTLIST allocation resource-id CDATA #REQUIRED>
<!ATTLIST allocation units CDATA #IMPLIED>