<?xml version="1.0" encoding="UTF-8"?>
<!-- The xnote XML DTD - extended notes for RefDB -->
<!-- (C) 2003-10-29 Markus Hoenicka <markus@mhoenicka.de> -->
<!-- Invoke with the following declaration -->
<!-- <!DOCTYPE xnoteset PUBLIC "-//Markus Hoenicka//DTD Xnote V1.4//EN" "http://refdb.sourceforge.net/dtd/xnote-1.4/xnote.dtd"> -->
<!-- version number last bumped due to changes in the link type attribute list, use 1.4 for next released version -->
<!-- the top-level element, containing one or more extended notes -->
<grammar ns="http://refdb.sourceforge.net/namespaces/xnote" xmlns:a="http://relaxng.org/ns/compatibility/annotations/1.0" xmlns="http://relaxng.org/ns/structure/1.0" datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
  <define name="xnoteset">
    <element name="xnoteset">
      <ref name="attlist.xnoteset"/>
      <oneOrMore>
        <ref name="xnote"/>
      </oneOrMore>
    </element>
  </define>
  <define name="attlist.xnoteset" combine="interleave">
    <empty/>
  </define>
  <!-- this element describes one extended note -->
  <define name="xnote">
    <element name="xnote">
      <ref name="attlist.xnote"/>
      <optional>
        <ref name="title"/>
      </optional>
      <optional>
        <ref name="content"/>
      </optional>
      <zeroOrMore>
        <ref name="keyword"/>
      </zeroOrMore>
      <zeroOrMore>
        <ref name="link"/>
      </zeroOrMore>
      <zeroOrMore>
        <ref name="ulink"/>
      </zeroOrMore>
    </element>
  </define>
  <define name="attlist.xnote" combine="interleave">
    <optional>
      <attribute name="id">
        <data type="NMTOKEN"/>
      </attribute>
    </optional>
    <optional>
      <attribute name="citekey">
        <data type="NMTOKEN"/>
      </attribute>
    </optional>
    <optional>
      <attribute name="user">
        <data type="NMTOKEN"/>
      </attribute>
    </optional>
    <optional>
      <attribute name="date">
        <data type="NMTOKEN"/>
      </attribute>
    </optional>
    <optional>
      <attribute name="share">
        <choice>
          <value>public</value>
          <value>private</value>
        </choice>
      </attribute>
    </optional>
  </define>
  <!-- the optional title of a note -->
  <define name="title">
    <element name="title">
      <ref name="attlist.title"/>
      <text/>
    </element>
  </define>
  <define name="attlist.title" combine="interleave">
    <empty/>
  </define>
  <!-- the contents of the note -->
  <define name="content">
    <element name="content">
      <ref name="attlist.content"/>
      <ref name="any"/>
    </element>
  </define>
  <define name="attlist.content" combine="interleave">
    <optional>
      <attribute name="type"/>
    </optional>
    <optional>
      <attribute name="xml:lang"/>
    </optional>
  </define>
  <!-- keyword for indexing purposes -->
  <define name="keyword">
    <element name="keyword">
      <ref name="attlist.keyword"/>
      <text/>
    </element>
  </define>
  <define name="attlist.keyword" combine="interleave">
    <empty/>
  </define>
  <!-- the link element, defines relations to other objects -->
  <define name="link">
    <element name="link">
      <ref name="attlist.link"/>
      <empty/>
    </element>
  </define>
  <define name="attlist.link" combine="interleave">
    <attribute name="type">
      <choice>
        <value>reference</value>
        <value>refid</value>
        <value>author</value>
        <value>keyword</value>
        <value>journalfull</value>
        <value>journalabbrev</value>
        <value>journalcustabbrev1</value>
        <value>journalcustabbrev2</value>
      </choice>
    </attribute>
    <attribute name="target"/>
  </define>
  <!-- an URL of a web resource -->
  <define name="ulink">
    <element name="ulink">
      <ref name="attlist.ulink"/>
      <text/>
    </element>
  </define>
  <define name="attlist.ulink" combine="interleave">
    <optional>
      <attribute name="type" a:defaultValue="url">
        <choice>
          <value>url</value>
          <value>pdf</value>
          <value>fulltext</value>
          <value>related</value>
          <value>image</value>
        </choice>
      </attribute>
    </optional>
  </define>
  <start>
    <choice>
      <ref name="xnoteset"/>
    </choice>
  </start>
  <define name="any">
    <zeroOrMore>
      <choice>
        <element>
          <anyName/>
          <zeroOrMore>
            <attribute>
              <anyName/>
            </attribute>
          </zeroOrMore>
          <ref name="any"/>
        </element>
        <text/>
      </choice>
    </zeroOrMore>
  </define>
</grammar>
