rod's microdomain dtd hub   |   biblio-ml   |   dt-ml   |   rod's root tripod page


 
Datetime Markup Language (DT-ML)
a micro-domain markup langauge for date and time information

introduction

Perhaps the simplest and most universal example of a micro-domain for markup languages is date and time information.

This application is simple, since there is a clearly defined scope with well known fields. This application is universal, since nearly every document has some need to indicate date and time, if only to indicate the "last modified date" for the document itself.

Below you'll find my proposal for a Datetime Markup Language (DT-ML).

analysis

fields

Dates and times are commonly (in the Gregorian calendar, at least) broken down into some subset of the following fields.

options

There are basically two ways to define the datetime markup.
  1. Define a root "datetime" element, with children for each particular field.

    For example:

    Example 1: The datetime element with children, indicating 12:00:00:001 AM GMT on CE October 15, 1582
     <datetime>
       <era>CE</era>
       <year>1582</year>
       <month>October</month>
       <date>15</date>
       <hour>12</hour>
       <minute>00</minute>
       <second>00</second>
       <millisecond>001</millisecond>
       <ampm>AM</ampm>
       <timezone>GMT</timezone>
     </datetime>

    Advantages

    • Each field is explictly marked. Hence it is easy for applications to decide which fields are included or ommitted, or what content belongs to what field.
    • Assuming we specify the DTD such that the elements can appear in any order, it is possible to markup existing text with date and time information without altering the original text. Hence even if the tags are ignored, it is still possible to render the information in a human legible format.

    Disadvantages

    • Each field must be individually parsed as XML.
    • Wastes bandwidth (as compared to the second alternative).
    • The number of elements is large.

  2. Define a single datetime element which directly contains all datetime information in a specified format.

    For example:

    Example 2: The datetime element with no child elements, indicating 12:00:00:001 AM GMT on CE October 15, 1582
    <datetime format="YYYY-MMM-DD hh:mm:ss.s TZD">
      1582-Oct-15 00:00:00.001 GMT
    </datetime>

    Advantages

    • Markup is concise.

    Disadvantages

    • The "format" notation is somewhat complicated.

some related links

Note on Date and Time Formats [W3C NOTE-datetime]
A subset of ISO-8601www.w3.org/TR/NOTE-datetime-970915.html, or more generally, www.w3.org/TR/

Data elements and interchange formats - Information interchange - Representation of dates and times [ISO 8601:1988(E)]
The ISO sells their standards documents and protects the copyrights, hence there is no complete online reference. Discussion of ISO 8601 can be found at the following urls, however. (There undoubtedly more, try your favorite search engine). Information on ordering the ISO 8601 document itself can be found at www.iso.ch/cate/d15903.html.

the dtd

<!--
###############################################################################
# DT-ML.DTD                                                                   #
###############################################################################
# a general markup language for date and time information                     #
#                                                                             #
# Revision #0.1 1998.07.03                                                    #
# Rodney Waldhoff <rod@pg.net>; <rwald@hotmail.com>                           #
#                                                                             #
# https://members.tripod.com/~rwald/ml/dt-ml.html                              #
###############################################################################
-->

<!--
   The datetime.calendar.default entity defines the default value for the
   datetime calendar attribute.
-->
<!ENTITY % datetime.calendar.default "Gregorian">

<!--
   Set the value of the datetime.calendar.fixed entity to #FIXED to keep
   authors from changing the default calendar.
-->
<!ENTITY % datetime.calendar.fixed "">

<!--
   The datetime.format.default entity defines the default value for the
   datetime format attribute.
-->
<!ENTITY % datetime.format.default "YYYY/M/D">

<!--
   Set the value of the datetime.format.fixed entity to #FIXED to keep
   authors from changing the default format.
-->
<!ENTITY % datetime.format.fixed "">

<!--
   You can use the datetime.attr.custom entity to extend the datetime
   element's attributes.
-->
<!ENTITY % datetime.attr.custom "">

<!--
   The datetime element is the root element of the dt-ml.
   It's children are the date and time fields.
-->
<!ELEMENT datetime (#PCDATA)>
<!ATTLIST datetime
          calendar CDATA %datetime.calendar.fixed; %datetime.calendar.default;
          format   CDATA %datetime.format.fixed;   %datetime.format.default;
          %datetime.attr.custom;
>


 

rod's microdomain dtd hub   |   biblio-ml   |   dt-ml   |   rod's root tripod page

Rev. 2 July 1998
Rod Waldhoff rod@pg.net  ·  rwald@hotmail.com
My root Tripod page: members.tripod.com/~rwald
Valid HTML 4.0!