\section{Writing CMML files}
\label{group__intro}\index{Writing CMML files@{Writing CMML files}}
The following simple example CMML file demonstrates the main features of CMML:



\begin{DocInclude}\begin{verbatim}<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<!DOCTYPE cmml SYSTEM "cmml.dtd">

<cmml lang="en" dir="ltr" id="simple" granulerate="1000/1">

<stream id="fish" basetime="0">
  <import id="videosrc" lang="en" dir="ltr" title="Video fish" 
          granulerate="25/1" contenttype="video/mpeg" 
          src="fish.mpg" start="0" end="360">
    <param id="vheight" name="video.height" value="250"/>
    <param id="vwidth"  name="video.width"  value="180"/>
  </import>
</stream>

<head>
  <title>Types of fish</title>
  <meta name="Producer" content="Joe Ordinary"/>
  <meta name="DC.Author" content="Joe's friend"/>
</head>

<clip id="intro" start="0">
  <a href="http://www.blah.au/fish.html">Read more about fish</a>
  <desc>This is the introduction to the film Joe made about fish.</desc>
</clip>

<clip id="dolphin" start="npt:3.5" end="npt:5:5.9">
  <img src="dolphin.jpg"/>
  <desc>Here, Joe caught sight of a dolphin in the ocean.</desc>
  <meta name="Subject" content="dolphin"/>
</clip>

<clip id="goldfish" start="npt:5:5.9">
  <a href="http://www.blah.au/morefish.anx?id=goldfish">More video clips on goldfish.</a>
  <img src="http://www.blah.au/goldfish.jpg"/>
  <desc>Joe has a fishtank at home with many colourful fish. The common goldfish is one of them and Joe's favourite. Here are some fabulous pictures he has taken of them.</desc>
  <meta name="Location" content="Joe's fishtank"/>
  <meta name="Subject" content="goldfish"/>
</clip>

</cmml>
\end{verbatim}
\end{DocInclude}
\subsection{The preamble}\label{group__intro_preamble}
After the usual preamble including the xml processing instruction and the doctype declaration, the root {\bf cmml tag} houses the markup.\subsection{The stream tag}\label{group__intro_streamintro}
The first markup will usually be a {\bf stream} tag which names the source media file(s) that the markup of the CMML file relates to. The stream tag is optional as you may want to prepare a CMML file for a not yet existing media file, for a live media stream, or just as a template.\subsection{The head tag}\label{group__intro_headintro}
The {\bf head} tag is mandatory as with html. It will at least contain either a title or a base tag. The {\bf title} tag contains a short description of the complete annotated work. More structured information for the work go into the {\bf meta} tags. It is recommended to use existing meta schemes such as the {\tt Dublin Core} for the structured annotations.\subsection{The clip tag}\label{group__intro_clipintro}
The following {\bf clip} tags structure the work into temporal sections by specification of start and end times for each section. The end time is optional as a clip will be implicitly ended with the start of the next clip or the end of the file. You may attach an {\bf a} tag to a clip to specify a related Web resource through its href attribute. You may attach an {\bf img} tag to a clip to specify a URL to an image that represents the content of the clip visually. You may attach a {\bf desc} tag to a clip to provide a textual description. More structured information for the clip go into the {\bf meta} tags.\subsection{Finishing the CMML file}\label{group__intro_endintro}
The closing of the cmml tag ends the CMML file. 