<!-- MusiXML

     this document is in early alpha state.
     It is for personal use and may not be redistributed.
     (c) Gerd Castan
     mailto:Gerd@gerdcastan.de
     http://www.s-line.de/homepages/gerd_castan/compmus/index_e.html#MusiXML

     19991002 Changed attributes coct and oct to (S|s|K|g|k|1|2|3|4|5)
     20010902 extract must start with a bibdata element that describes for which part/instrument 
              this extract is intended. Example: Violin 1 or Score
     20010904 removed lines from thRef. lines in staff is enough.
     20010904 removed voice from thRef. If something human readable is necesary, make it language independant
     20010907 replaced t by tm, tn, td. My Java application had no problem, but avoiding microparsing makes MusiXML XSLT friendly
     20010907 same vor staff.start
     20010908 replaced level by breakLevel
     20010908 resetPageNo
     20010910 extractId
     
  -->

<!-- to do
   * find a better word for time
   * replace start_klammer and end_klammer by an english word
   * define register pipeLen
   * define duration
   * think about how to handle %lasting; attributes
   * replace paragraph + type by scoreParagraph
   * octave shift for clefs
  --> 


<!-- ********** ********** ********** ********** ********** -->
<!--                       Notations                        -->
<!-- ********** ********** ********** ********** ********** -->

<!--                      no Notations                      -->




<!-- ********** ********** ********** ********** ********** -->
<!--                        Entities                        -->
<!-- ********** ********** ********** ********** ********** -->

     <!ENTITY % ISOlat1 PUBLIC
       "ISO 8879:1986//ENTITIES Added Latin 1//EN//XML"
       "ISOlat1.pen" >
     %ISOlat1;

     <!ENTITY % ISOlat2 PUBLIC
       "ISO 8879:1986//ENTITIES Added Latin 2//EN//XML"
       "ISOlat2.pen">
     %ISOlat2;

<!--============= Data types ================== -->

<!ENTITY % textLine     "CDATA">
<!ENTITY % LanguageCode "CDATA">
    <!-- a language code, as per [RFC1766] -->
<!ENTITY % boolean      "(true|false)">
<!ENTITY % short        "CDATA">
<!ENTITY % chordString  "CDATA">
<!ENTITY % noteName     "CDATA">
<!ENTITY % duration     "CDATA">


<!--============= superclasses ================== -->

<!-- the xml:lang attribute is intended as
     "choose this language wherever you have different localText elements.
     Exception: in localText elements, it describes the language of the content."
  -->
<!ENTITY % coreattrs
 "id          ID               #IMPLIED
  xml:lang    %LanguageCode;   #IMPLIED"
>

<!-- tm, tn, td together describe a point in time (think of measure, numerator, denominator) -->
<!ENTITY % time
  "%coreattrs;
  tm           %short;      #IMPLIED
  tn           %short;      #IMPLIED
  td           %short;      #IMPLIED"
>

<!ENTITY % barAttrs
 "type        (standard|invisible|tactus|double|fat|fatthin) #IMPLIED
  leftRepeat  %short;   #IMPLIED
  rightRepeat %short;   #IMPLIED
  count       %boolean; #IMPLIED
 "
>

  
<!ENTITY % conAttrs
 "vis         (nothing|clef|key) #IMPLIED
  cname       CDATA            #IMPLIED
  coct        (S|s|K|g|k|1|2|3|4|5)  #IMPLIED
  clefLine    %short;          #IMPLIED
  kacc        (-7|-6|-5|-4|-3|-2|-1|0|1|2|3|4|5|6|7) #IMPLIED
  kname       %noteName;       #IMPLIED
  sign1       %noteName;       #IMPLIED
  sign2       %noteName;       #IMPLIED
  sign3       %noteName;       #IMPLIED
  sign4       %noteName;       #IMPLIED
  sign5       %noteName;       #IMPLIED
  sign6       %noteName;       #IMPLIED
  sign7       %noteName;       #IMPLIED
 "
>


<!-- articulation:
     staccato="1" finger1="2" means the first sign above the note is a staccato point 
     and the second is a "1" (finger 1). The same holds with negative numbers under
     the note. 
     Exception: numtonguing is the number of points whereas tonguing indicates the 
     position of these tonguing points. 
  -->
<!ENTITY % articulation
 "strongaccent  %short;        #IMPLIED
  mediumaccent  %short;        #IMPLIED
  portato       %short;        #IMPLIED
  staccato      %short;        #IMPLIED
  downbow       %short;        #IMPLIED
  upbow         %short;        #IMPLIED
  harmonic      %short;        #IMPLIED
  fermata       %short;        #IMPLIED
  arsis         %short;        #IMPLIED
  thesis        %short;        #IMPLIED
  plus          %short;        #IMPLIED
  staccatissimo %short;        #IMPLIED
  tonguing      %short;        #IMPLIED
  numtonguing   %short;        #IMPLIED
  pizzicato     %short;        #IMPLIED
  finger1       %short;        #IMPLIED
  finger2       %short;        #IMPLIED
  finger3       %short;        #IMPLIED
  finger4       %short;        #IMPLIED
  finger5       %short;        #IMPLIED
 " 
>

<!ENTITY % lasting
  "%time;
  dots       %short;           #IMPLIED
  dur        %duration;        #IMPLIED
  tupletID   IDREF             #IMPLIED
  beam       IDREF             #IMPLIED
  leftBeams  %short;           #IMPLIED
  rightBeams %short;           #IMPLIED
  abbrev     %short;           #IMPLIED
  %articulation;
  "
>


<!-- ********** ********** ********** ********** ********** -->
<!--                  Document content model                -->
<!-- ********** ********** ********** ********** ********** -->


<!-- This DTD describes one work with one or more workSegs (e.g. movements)
     and different extracts (e.g. parts in an orchetra). 
     body holds the logical information,
     filter holds the information for (visual) rendering.
  -->
<!ELEMENT work (bibdata?,
                body,
                filter) >
<!ATTLIST work
  %coreattrs;>
<!-- the first attribute entity is intended as an "extends" in the corresponding
     model class, if an object oriented program is used. 
  -->

<!-- ********** ********** ********** ********** ********** -->
<!--                     Logical Domain                     -->
<!-- ********** ********** ********** ********** ********** -->

<!-- body, tho logical domain, contains one or more workSegs (e.g. Movements)
  -->
<!ELEMENT body (workSeg+) >
<!ATTLIST body
  %coreattrs;>

<!ELEMENT workSeg (masterThread, thread+) >
<!ATTLIST workSeg
  %coreattrs;>

<!ELEMENT masterThread (register | repeat | dynamics | bar | chordSymbol)* >
<!ATTLIST masterThread
  %coreattrs;>
<!ELEMENT thread (tuplet | slur | beam | register | repeat | dynamics | barRef | meter | chordSymbol | con | chord)* >
<!ATTLIST thread %coreattrs;>


<!-- dynamics: the first child text element is something like "subito" that is rendered
     before the name, the second is rendered after the name
  -->
<!ELEMENT dynamics ((localtext, localText?)?)>
<!ATTLIST dynamics 
  %time;  
  name    (ppppp|pppp|ppp|pp|p|mp|mf|f|ff|fff|ffff|fffff|sfz) #IMPLIED 
  >

<!-- bar:
	 leftRepeat:
	 whether and how a text like "three times" is printed in the score is
	 intended to be stored in the environment in dependance of this attribute.
	 count
	 @see position attribute in several other classes.
	 first part of a position is the measure number.
	 If count=true, then a new measure starts in the sense of position.
  -->
<!ELEMENT bar EMPTY>
<!ATTLIST bar
  %time;
  %barAttrs;
  >

<!-- barRef:
     barRef uses the attributes of the bar it points to.
     If barRef has an attribute, the value overwrites the
     corresponding bar attribute.
  -->     
<!ELEMENT barRef EMPTY>
<!ATTLIST barRef
  %time;
  %barAttrs;
  barID       IDREF   #REQUIRED
  >


<!-- repeat can contain all signs related to repetitions or omissions.
     The only exception are the repeat signs around the bar.
     Text positioning depends on the sign.
  -->
<!ELEMENT repeat (localText?)>
<!ATTLIST repeat
  %coreattrs;
  sign        (empty|segno|dalsegno|coda|tocoda|start_klammer|end_klammer|dacapo|fine|dcalfinesenzarep|dcalfine|dcsenzarep|vi|de) "empty" 
  >

<!-- chordSymbol:
     a text String that describes a chord
  -->
<!ELEMENT chordSymbol EMPTY>
<!ATTLIST chordSymbol
  %time;
  name        %chordString;    #REQUIRED
  >

<!-- con:
     context definition: one tag for key and clef.
     the reason to put key and clef together is that there are clefs like S
     which define clef and key together.
     vis indicates whether a clef or a key (or nothing) is visually rendered.
     NB: it is allowed to set the context without rendering. 
     cname, coct: name of a clef. Some, like "G" 
     TODO: allow an additional parameter for octave shifts.
     clefLine: allows to assign a "G" key to a line different from 2
     kacc: key accidentals
     kname: key name
	 * examples:
	 * kacc=0 & name = "C"   -> c Major
	 * kacc=0 & name = "a"   -> a Minor
	 * kacc=0 & name = ... -> church keys
	 sign1 ... sign7:
	 * acc and name can't represent the examples in Gardner Read: Music Notation Chapter 9 page 141ff (second edition)
	 * so you can provide seven independant note names instead of
	 * counting sharps or flats with kacc

  -->
<!ELEMENT con EMPTY>
<!ATTLIST con
  %time;
  %conAttrs;
  >

<!-- conRef
     reference to a con
     If conRef has an attribute, the value overwrites the
     corresponding con attribute.
  -->
<!ELEMENT conRef EMPTY>
<!ATTLIST conRef
  %time;
  %conAttrs;
  src       IDREF     #REQUIRED
  >

<!-- register:
     name: machine readable, language independant name
     style: some register signs can be rendered with a square or a circle around.
     pipelen example: "4,8-,8+,16"
  -->
<!ELEMENT register (description*)>
<!ATTLIST register
  %time;
  pipeLen    CDATA       #IMPLIED
  style      (none|square|circle) "none"
  >


<!-- chord:
     each note is encapsulated by a chord. This makes programming easier.
  -->
<!ELEMENT chord (note+)>
<!ATTLIST chord
  %lasting;
  >

<!-- note:
     attribute chord is a chord symbol that belongs to the note, usually used in manual 2 of
     accordions. Example: "7". (In a chordSymbol element you would say G7, because it is not tied to a note)
  -->
<!ELEMENT note EMPTY>
<!ATTLIST note
  %lasting;
  name    %noteName;  #REQUIRED
  oct     (S|s|K|g|k|1|2|3|4|5)  #IMPLIED
  chord   %chordString; #IMPLIED
  >

<!-- beam:
     defines an ID that groups chords/notes together
  -->
<!ELEMENT beam EMPTY>
<!ATTLIST beam
  %coreattrs;
  >

<!-- slur:
     groups notes left and (right) together
     if tie = "false", right mus be provided
  -->
<!ELEMENT slur EMPTY>
<!ATTLIST slur
  %coreattrs;
  left     IDREF          #REQUIRED
  right    IDREF          #IMPLIED
  tie      %boolean;      "false"
  >

<!-- ********** ********** ********** ********** ********** -->
<!--                        Rendering                       -->
<!-- ********** ********** ********** ********** ********** -->

<!-- filter:
     parent of all rendering elements
  -->
<!ELEMENT filter (extract*, staff*) >
<!ATTLIST filter
  %coreattrs;
  >

<!-- extract:
     in relational databases one would call this a view,
     but the term view is used in a different way in design patterns.
     extractId is a unique Id in the document. NMTOKEN is essential to
     be able to adress a document and an extract together in one String
     documentId + ':' + extractId
  -->
<!ELEMENT extract (bibdata, paragraph+) >
<!ATTLIST extract
  %coreattrs;
  extractId		NMTOKEN     #REQUIRED
  >

<!-- paragraph:
     type="score" is mandatory for future extensions
  -->
<!ELEMENT paragraph (bibdata?,bracket?,break*,stRef*) >
<!ATTLIST paragraph
  %coreattrs;
  type    (score)    #REQUIRED
  >


<!-- bracket:
     group staffs
     start and end are IDs of stRef elements
  -->
<!ELEMENT bracket EMPTY >
<!ATTLIST bracket
  %coreattrs;
  type    (bracket|brace)    "bracket"
  start   IDREF              #REQUIRED
  end     IDREF              #REQUIRED
  >


<!-- break:
     linebraks or pagebreaks
     resetPageNo: if breakLevel="pageBreak", manually reset the page number of the page 
                  created by the break
     man_pg: manual penalty for page breaks
     man_ln: manual penalty for line breaks
     aut_pg: automatic penalty for page breaks
     aut_ln: automatic penalty for line breaks
  -->
<!ELEMENT break EMPTY >
<!ATTLIST break
  %time;
  breakLevel    (dontBreak|lineBreak|pageBreak)    "lineBreak"
  resetPageNo %short; #IMPLIED
  man_pg   %short;    #IMPLIED
  man_ln   %short;    #IMPLIED
  aut_pg   %short;    #IMPLIED
  aut_ln   %short;    #IMPLIED
  >


<!-- stRef:
     reference to a staff
  -->
<!ELEMENT stRef EMPTY >
<!ATTLIST stRef
  %coreattrs;
  src     IDREF              #REQUIRED
  >

<!-- staff:
  -->
<!ELEMENT staff (thRef*,conRef*) >
<!ATTLIST staff
  %coreattrs;
  startm           %short;      "0"
  startn           %short;      "0"
  startd           %short;      "4"
  lines  %short;      "5"
  >

<!-- thRef:
     reference to a thread
  -->
<!ELEMENT thRef EMPTY >
<!ATTLIST thRef
  %coreattrs;
  src     IDREF              #REQUIRED
  stem    (auto|up|down)     "auto"
  voice   CDATA              #IMPLIED
>


<!-- ********** ********** ********** ********** ********** -->
<!--                   Common used elements                 -->
<!-- ********** ********** ********** ********** ********** -->
<!ELEMENT bibdata (localText*) >
<!ATTLIST bibdata
  %coreattrs;
  author                CDATA #IMPLIED>

<!ELEMENT description (localText+)>
<!ATTLIST description
  %coreattrs;
  align      (left|right|bottom|top) "right"
  >


<!-- localText is used at several places.
     It replaces PCDATA by entities with a language key to PCDATA
     Example:
     replace <HELLOWORLD>Hello World</HELLOWORLD>
     by 
     <HELLOWORLD>
       <localText xml:lang="en">Hello World</localText>
       <localText xml:lang="de">Tach Welt</localText>
     </HELLOWORLD>
  -->     
<!ELEMENT localText        (#PCDATA)>
<!ATTLIST localText
  %coreattrs;
>