[xiph-commits] r3553 - in libcmml/branches/cmml4: . Win32 doc src tests tools

silvia at svn.annodex.net silvia at svn.annodex.net
Sun Apr 13 07:22:57 PDT 2008


Author: silvia
Date: 2008-04-13 07:22:56 -0700 (Sun, 13 Apr 2008)
New Revision: 3553

Modified:
   libcmml/branches/cmml4/ChangeLog
   libcmml/branches/cmml4/Win32/libcmml.def
   libcmml/branches/cmml4/doc/cmml_4_0.xsd
   libcmml/branches/cmml4/doc/cmml_dox.h
   libcmml/branches/cmml4/src/Version_script.in
   libcmml/branches/cmml4/src/cmml.c
   libcmml/branches/cmml4/src/cmml.h
   libcmml/branches/cmml4/src/cmml_element.c
   libcmml/branches/cmml4/src/cmml_private.c
   libcmml/branches/cmml4/src/cmml_private.h
   libcmml/branches/cmml4/tests/error14.cmml
   libcmml/branches/cmml4/tools/cmml-fix.c
Log:
adapted structs to new CMML4.0; not all functions are adapted yet

Modified: libcmml/branches/cmml4/ChangeLog
===================================================================
--- libcmml/branches/cmml4/ChangeLog	2008-04-13 14:21:26 UTC (rev 3552)
+++ libcmml/branches/cmml4/ChangeLog	2008-04-13 14:22:56 UTC (rev 3553)
@@ -1,7 +1,9 @@
 2008-04-13  Silvia Pfeiffer <silvia at silvia-pfeiffer dot de>
 	* Started on supporting CMML4
+	* removed namespace from cmml tag
 	* removed import, stream and param tags
 	* removed utc time since it doesn't make much sense without relating to a media file
+	* adapted the structs to the new CMML4.0
 
 2008-04-06  Silvia Pfeiffer <silvia at silvia-pfeiffer dot de>
 	* Version 0.9.3

Modified: libcmml/branches/cmml4/Win32/libcmml.def
===================================================================
--- libcmml/branches/cmml4/Win32/libcmml.def	2008-04-13 14:21:26 UTC (rev 3552)
+++ libcmml/branches/cmml4/Win32/libcmml.def	2008-04-13 14:22:56 UTC (rev 3553)
@@ -29,7 +29,7 @@
 ; error functions
 ;
 cmml_get_last_error		@16
-cmml_error_clear		@17
+cmml_clear_error		@17
 
 ;
 ; seeking

Modified: libcmml/branches/cmml4/doc/cmml_4_0.xsd
===================================================================
--- libcmml/branches/cmml4/doc/cmml_4_0.xsd	2008-04-13 14:21:26 UTC (rev 3552)
+++ libcmml/branches/cmml4/doc/cmml_4_0.xsd	2008-04-13 14:22:56 UTC (rev 3553)
@@ -46,6 +46,10 @@
     html:LanguageCode
     html:FrameTarget
     html:Length
+	html:style
+	html:meta
+	html:link
+	html:block
     </xs:documentation>
   </xs:annotation>
 
@@ -76,34 +80,6 @@
     <xs:restriction base="xs:string" />
   </xs:simpleType>
 
-  <xs:simpleType name="Playbacktime">
-    <xs:annotation>
-      <xs:documentation>
-      timestamps similar to [RFC2326] 
-      "smpte-24:" SMPTE time with a 24 fps basis
-      "smpte-24-drop:" SMPTE time with a 24/1.001 fps basis
-      "smpte-25:" SMPTE time with a 25 fps basis
-      "smpte-30:" SMPTE time with a 30 fps basis
-      "smpte-30-drop:" SMPTE time with a 30/1.001 fps basis
-      "smpte-50:" SMPTE time with a 50 fps basis
-      "smpte-60:" SMPTE time with a 60 fps basis
-      "smpte-60-drop:" SMPTE time with a 60/1.001 fps basis
-      "npt:" npt-time
-      no clock time
-      </xs:documentation>
-    </xs:annotation>
-    <xs:restriction base="xs:string" />
-  </xs:simpleType>
-
-  <xs:simpleType name="UTCtime">
-    <xs:annotation>
-      <xs:documentation>
-      UTCtime is specified as in [RFC2326], but without the "clock" identifier
-      </xs:documentation>
-    </xs:annotation>
-    <xs:restriction base="xs:string"/>
-  </xs:simpleType>
-
   <xs:annotation>
     <xs:documentation>
     =================== Generic Attributes ===============================
@@ -131,10 +107,12 @@
     cmml tag containing sequence of one head and n clip tags
     i18n        = the default language for the whole document including
                   the id tag of the cmml element
-    xmlns       = namespace of the cmml tags
     role        = describes what type of text track this CMML file represents,
                   such as e.g. closed-caption, annotation, subtitle, transcript,
                   ticker
+    basetime    = time stamp offset from which to calculate the start and end
+                  times of the clip tags; allows to synchronise with a media
+                  file that does not start at time offset 0
     </xs:documentation>
   </xs:annotation>
 
@@ -147,6 +125,7 @@
       <xs:attributeGroup ref="html:i18n"/>
       <xs:attribute name="role" type="TTextType"/>
       <xs:attribute name="id" type="xs:ID"/>
+      <xs:attribute name="basetime" type="Timestamp" default="0"/>
     </xs:complexType>
   </xs:element>
 
@@ -167,21 +146,21 @@
       Title is the title of the media file
       Img is an optional representative image for the full media file
       Base is an optional base URL for the full media file
-      Style is style sheet for the document
+      Style is an optional internal style sheet for the document
       Meta is a collection of meta tags for the document
       Link points to related documents
       </xs:documentation>
     </xs:annotation>
     <xs:complexType>
       <xs:all minOccurs="0">
-        <xs:element ref="title" />
+        <xs:element ref="html:title" />
         <xs:element ref="img" />
         <xs:element ref="base" />          
       </xs:all>
       <xs:choice minOccurs="0" maxOccurs="unbounded">
-        <xs:element ref="style"/>
-        <xs:element ref="meta"/>
-        <xs:element ref="link"/>
+        <xs:element ref="html:style"/>
+        <xs:element ref="html:meta"/>
+        <xs:element ref="html:link"/>
       </xs:choice>
       <xs:attributeGroup ref="html:i18n"/>
       <xs:attribute name="id" type="xs:ID"/>
@@ -191,28 +170,6 @@
 
   <xs:annotation>
     <xs:documentation>
-    =================== Title ===============================
-    title tag giving descriptive title of the media document
-    i18n    = the language of the title text
-    </xs:documentation>
-  </xs:annotation>
-
-  <xs:element name="title">
-    <xs:annotation>
-      <xs:documentation>
-      The title element is not considered part of the presentation.
-      It should be displayed, for example as the page header or
-      window title. Exactly one title is required per document.
-      </xs:documentation>
-    </xs:annotation>
-    <xs:complexType mixed="true">
-      <xs:attributeGroup ref="html:i18n"/>
-      <xs:attribute name="id" type="xs:ID"/>
-    </xs:complexType>
-  </xs:element>
-
-  <xs:annotation>
-    <xs:documentation>
     =================== Img ===========================================
     To avoid accessibility problems for people who aren't
     able to see the image, you should provide a text
@@ -260,84 +217,6 @@
 
   <xs:annotation>
     <xs:documentation>
-    =================== Meta ===============================
-    description tags of the document (empty content)
-    i18n    = the language of the meta attributes
-    name    = identifies a property name; does not list legal values for this 
-	          attribute
-    content = specifies a property's value; does not list legal values for 
-	          this attribute
-    scheme  = names a scheme to be used to interpret the property's value 
-	          (see the profiles tag in the head element for locating these)
-    </xs:documentation>
-  </xs:annotation>
-
-  <xs:element name="meta">
-    <xs:complexType>
-      <xs:attributeGroup ref="i18n"/>
-      <xs:attribute name="id" type="xs:ID"/>
-      <xs:attribute name="http-equiv"/>
-      <xs:attribute name="name"/>
-      <xs:attribute name="content" use="required"/>
-      <xs:attribute name="scheme"/>
-    </xs:complexType>
-  </xs:element>
-
-  <xs:annotation>
-    <xs:documentation>
-    =================== Link ===============================
-    LINK tag to specify relationship values (empty content)
-    attrs = the language of the title text; a short description of the
-            relationship through title, and the stylesheet class
-    href  = reference to a related document
-    type  = type of the document referenced, e.g. "text/css"
-    rel   = type of relationship to forward linked document
-    rev   = type of relationship to reverse linked document
-    media = type or medium/media to be rendered on, default "screen"
-    </xs:documentation>
-  </xs:annotation>
-
-  <xs:element name="link">
-    <xs:complexType>
-      <xs:attributeGroup ref="attrs"/>
-      <xs:attribute name="href" type="URI"/>
-      <xs:attribute name="type" type="html:ContentType"/>
-      <xs:attribute name="rel" type="html:LinkTypes"/>
-      <xs:attribute name="rev" type="html:LinkTypes"/>
-      <xs:attribute name="media" type="html:MediaDesc"/>
-    </xs:complexType>
-  </xs:element>
-
-  <xs:annotation>
-    <xs:documentation>
-    =================== Style ===============================
-    STYLE tag to specify presentation styles
-    i18n  = the language of the style's title attribute
-    title = short description of the style
-    type  = type of the document referenced, e.g. "text/css"
-    media = type or medium/media to be rendered on, default "screen"
-    xml:space = fixed to preserve whitespace characters in content
-    </xs:documentation>
-  </xs:annotation>
-
-  <xs:element name="style">
-    <xs:annotation>
-      <xs:documentation>
-      The content of the "style" element is a style sheet.
-      </xs:documentation>
-    </xs:annotation>
-    <xs:complexType mixed="true">
-      <xs:attributeGroup ref="i18n"/>
-      <xs:attribute name="id" type="xs:ID"/>
-      <xs:attribute name="title" type="html:Text"/>
-      <xs:attribute name="type" use="required" type="html:ContentType"/>
-      <xs:attribute name="media" type="html:MediaDesc"/>
-      <xs:attribute ref="xml:space" fixed="preserve"/>
-    </xs:complexType>
-  </xs:element>
-
-  <xs:annotation>
-    <xs:documentation>
     =================== Clip Elements ===============================
     Clip tag containing information for a specific fragment
     attrs    = the base language of the clip's attribute values and 
@@ -359,8 +238,8 @@
     <xs:complexType>
       <xs:all>
         <xs:choice minOccurs="0" maxOccurs="unbounded">
-          <xs:element ref="meta"/>
-          <xs:element ref="style"/>
+          <xs:element ref="html:meta"/>
+          <xs:element ref="html:style"/>
         </xs:choice>          
         <xs:element ref="a" minOccurs="0" maxOccurs="1"/>
         <xs:element ref="img" minOccurs="0" maxOccurs="1"/>
@@ -399,13 +278,17 @@
       </xs:documentation>
     </xs:annotation>
     <xs:complexType mixed="true">
-      <xs:attributeGroup ref="attrs"/>
-      <xs:attribute name="href" type="html:URI"/>
-      <xs:attribute name="hreflang" type="html:LanguageCode"/>
-      <xs:attribute name="rel" type="html:LinkTypes"/>
-      <xs:attribute name="rev" type="html:LinkTypes"/>
-      <xs:attribute name="target" type="html:FrameTarget"/> 
-      <xs:attribute name="type" type="html:ContentType"/>
+        <xs:attributeGroup ref="attrs"/>
+        <xs:attribute name="target" type="html:FrameTarget"/> 
+        <xs:attribute name="charset" type="Charset"/>
+        <xs:attribute name="type" type="html:ContentType"/>
+        <xs:attribute name="name" type="xs:NMTOKEN"/>
+        <xs:attribute name="href" type="html:URI"/>
+        <xs:attribute name="hreflang" type="html:LanguageCode"/>
+        <xs:attribute name="rel" type="html:LinkTypes"/>
+        <xs:attribute name="rev" type="html:LinkTypes"/>
+        <xs:attribute name="shape" default="rect" type="Shape"/>
+        <xs:attribute name="coords" type="Coords"/>
     </xs:complexType>
   </xs:element>
 

Modified: libcmml/branches/cmml4/doc/cmml_dox.h
===================================================================
--- libcmml/branches/cmml4/doc/cmml_dox.h	2008-04-13 14:21:26 UTC (rev 3552)
+++ libcmml/branches/cmml4/doc/cmml_dox.h	2008-04-13 14:22:56 UTC (rev 3553)
@@ -319,7 +319,7 @@
  *
  * \subsection tb Basetime attribute 
  *
- * The basetime attribute maps the first frame of the OUTPUT annodex
+ * The basetime attribute maps the first frame of the OUTPUT stream
  * document to a playback time to be displayed with the first
  * frame. This playback time can be given as npt or some smpte
  * specification given as a name-value pair, and it defaults to 0.

Modified: libcmml/branches/cmml4/src/Version_script.in
===================================================================
--- libcmml/branches/cmml4/src/Version_script.in	2008-04-13 14:21:26 UTC (rev 3552)
+++ libcmml/branches/cmml4/src/Version_script.in	2008-04-13 14:22:56 UTC (rev 3553)
@@ -25,7 +25,7 @@
 cmml_get_previous_clip;
 
 cmml_get_last_error;
-cmml_error_clear;
+cmml_clear_error;
 
 cmml_set_window;
 cmml_skip_to_secs;

Modified: libcmml/branches/cmml4/src/cmml.c
===================================================================
--- libcmml/branches/cmml4/src/cmml.c	2008-04-13 14:21:26 UTC (rev 3552)
+++ libcmml/branches/cmml4/src/cmml.c	2008-04-13 14:22:56 UTC (rev 3553)
@@ -242,16 +242,15 @@
   if (!context || !context->status || !context->status->info) return NULL;
 
   /* parse to head if cmml tag not yet parsed */
-  if (!context->status->info->cmml_xmlns) {
-    if (cmml_parse_to_head(context)!=0) return NULL;
-  }
+  if (cmml_parse_to_head(context) != 0) return NULL;
 
   i = cmml_preamble_new(context->status->info->xml_encoding,
 	  context->status->info->cmml_id,
 	  context->status->info->cmml_lang,
 	  context->status->info->cmml_xml_lang,
 	  context->status->info->cmml_dir,
-	  context->status->info->cmml_role);
+	  context->status->info->cmml_role,
+      context->status->info->cmml_basetime);
   if (context->status->info->xml_version != NULL) {
 	  i->xml_version    = context->status->info->xml_version;
   }
@@ -309,7 +308,7 @@
 }
 
 void
-cmml_error_clear (CMML * cmml)
+cmml_clear_error (CMML * cmml)
 {
   cmml_set_error (cmml, CMML_OK);
 }
@@ -361,8 +360,8 @@
   }
 
   /* if seek time is in past, return error */
-  if (ctxt->status->stream != NULL && ctxt->status->stream->basetime != NULL) {
-    if (seconds <  ctxt->status->stream->basetime->t.sec) {
+  if (ctxt->status->info->cmml_role != NULL) {
+    if (seconds <  ctxt->status->info->basetime->t.sec) {
       /* stream starts beyond that time */
       return -1;
     }
@@ -412,7 +411,7 @@
   if (ctxt->status->seek_type == _CMML_SEEK_FOUND && 
       ctxt->status->seek_secs < 0.0) {
     ctxt->status->seek_type = _CMML_SEEK_NONE;
-    return ctxt->status->stream->basetime->t.sec;
+    return ctxt->status->info->basetime->t.sec;
   }
   
   ctxt->status->seek_type = _CMML_SEEK_NONE;

Modified: libcmml/branches/cmml4/src/cmml.h
===================================================================
--- libcmml/branches/cmml4/src/cmml.h	2008-04-13 14:21:26 UTC (rev 3552)
+++ libcmml/branches/cmml4/src/cmml.h	2008-04-13 14:22:56 UTC (rev 3553)
@@ -108,26 +108,43 @@
   char *xml_version;      /**< version attribute of xml proc instr */
   char *xml_encoding;     /**< encoding attribute of xml proc instr */
   int   xml_standalone;   /**< standalone attribute of xml proc instr */
-  char *cmml_lang;        /**< lang attribute of cmml tag */
-  char *cmml_xml_lang;    /**< xml:lang attribute of cmml tag */
-  char *cmml_dir;         /**< dir attribute of cmml tag */
+  char *cmml_lang;        /**< lang attribute of cmml tag (i18n)*/
+  char *cmml_xml_lang;    /**< xml:lang attribute of cmml tag (i18n)*/
+  char *cmml_dir;         /**< dir attribute of cmml tag (i18n)*/
   char *cmml_id;          /**< id attribute of cmml tag */
-  char *cmml_xmlns;       /**< xmlns attribute of cmml tag */
   char *cmml_role;        /**< role attribute of cmml tag */
+  char *cmml_basetime;    /**< basetime attribute of cmml tag */
 } CMML_Preamble;
 
+/**
+ * CMML_StyleElement: a struct to keep the details of the link tag in
+ * either a head or a clip
+ */
+typedef struct {
+  char *id;         /**< id attribute of style */
+  char *lang;       /**< language code of style (i18n)*/
+  char *xml_lang;   /**< xml:lang code of style (i18n)*/
+  char *dir;        /**< directionality of lang (i18n)*/
+  char *type;       /**< type attribute of style */
+  char *media;      /**< media attribute of style */
+  char *title;      /**< title attribute of style */
+  char *xml_space;  /**< xml:space code of style */
+  char *style_text; /**< CDATA section of style element */
+} CMML_StyleElement;
 
 /**
  * CMML_MetaElement: a struct to keep the details of the meta tag in
  * either a head or a clip
  */
 typedef struct {
-  char *id;      /**< id attribute of meta element */
-  char *lang;    /**< language code of meta element */
-  char *dir;     /**< directionality of lang (ltr/rtl) */
-  char *name;    /**< property name of meta element */
-  char *content; /**< property value of meta element */
-  char *scheme;  /**< scheme name of meta element */
+  char *id;         /**< id attribute of meta element */
+  char *lang;       /**< language code of meta (i18n)*/
+  char *xml_lang;   /**< xml:lang code of meta (i18n)*/
+  char *dir;        /**< directionality of lang (i18n)*/
+  char *name;       /**< property name of meta element */
+  char *content;    /**< property value of meta element */
+  char *scheme;     /**< scheme name of meta element */
+  char *http-equiv; /**< http-equiv of meta element */
 } CMML_MetaElement;
 
 /**
@@ -135,12 +152,17 @@
  * either a head or a clip
  */
 typedef struct {
-  char *id;         /**< id attribute of link */
-  char *link_class; /**< class attribute of link */
-  char *title;      /**< title attribute of link */
-  char *lang;       /**< language code of link */
-  char *dir;        /**< directionality of lang (ltr/rtl) */
+  char *id;         /**< id attribute of link (coreattrs)*/
+  char *lclass;      /**< class attribute of link (coreattrs)*/
+  char *style;      /**< style attribute of link (coreattrs)*/
+  char *title;      /**< title attribute of link (coreattrs)*/
+  char *lang;       /**< language of link (i18n)*/
+  char *xml_lang;    /**< directionality of xml:lang (i18n)*/
+  char *dir;        /**< directionality of lang (i18n)*/
+  char *events;     /**< events attribute of link */
+  char *charset;    /**< charset attribute of link */
   char *href;       /**< href attribute of link */
+  char *hreflang;   /**< hreflang attribute of link */
   char *type;       /**< type attribute of link */
   char *rel;        /**< rel attribute of link */
   char *rev;        /**< rev attribute of link */
@@ -148,57 +170,94 @@
 } CMML_LinkElement;
 
 /**
+ * CMML_Image: a img element as presented in the CMML document
+ *             used in head and clip tags.
+ */
+typedef struct {
+	char *id;         /**< id attribute of image (coreattrs)*/
+	char *iclass;      /**< class attribute of image (coreattrs)*/
+	char *style;      /**< style attribute of image (coreattrs)*/
+	char *title;      /**< title attribute of image (coreattrs)*/
+	char *lang;       /**< language of img (i18n)*/
+	char *xml_lang;   /**< directionality of xml:lang (i18n)*/
+	char *dir;        /**< directionality of lang (i18n)*/
+	char *src;        /**< keyframe image of clip */
+	char *alt;        /**< alternate text for image */
+	char *longdesc;   /**< link to long description for image */
+	char *height;     /**< height for image */
+	char *width;      /**< width for image */
+} CMML_ImgElement;
+	
+/**
  * CMML_Head: a head element as presented in the CMML document.
  */
 typedef struct {
-  char *head_id;    /**< id attribute of header */
-  char *lang;       /**< language of header */
-  char *dir;        /**< directionality of lang */
-  char *profile;    /**< profile of header */
-  char *title;      /**< title element of header */
-  char *title_id;   /**< id attribute of title element */
-  char *title_lang; /**< language of title */
-  char *title_dir;  /**< directionality of title_lang */
-  char *base_id;    /**< id attribute of base element */
-  char *base_href;  /**< href attribute of base element */
-  CMML_List * meta; /**< list of meta elements */
-  CMML_List * link; /**< list of link elements */
+  char *id;             /**< id attribute of header */
+  char *lang;           /**< language of header (i18n)*/
+  char *xml_lang;       /**< xml:lang of header (i18n)*/
+  char *dir;            /**< directionality of lang (i18n)*/
+  char *profile;        /**< profile of header */
+  char *title;          /**< title element of header */
+  char *title_id;       /**< id attribute of title element */
+  char *title_lang;     /**< language of title (i18n)*/
+  char *title_xml_lang; /**< xml:lang of title (i18n)*/
+  char *title_dir;      /**< directionality of title_lang (i18n)*/
+  CMML_ImgElement * image;   /**< image element of header */
+  char *base_id;        /**< id attribute of base element */
+  char *base_href;      /**< href attribute of base element */
+  CMML_List * style;    /**< list of style elements */
+  CMML_List * meta;     /**< list of meta elements */
+  CMML_List * link;     /**< list of link elements */
 } CMML_Head;
 
+typedef struct {
+  char *id;          /**< id attribute of anchor (coreattrs)*/
+  char *aclass;      /**< class attribute of anchor (coreattrs)*/
+  char *style;       /**< style attribute of anchor (coreattrs)*/
+  char *title;       /**< title attribute of anchor (coreattrs)*/
+  char *lang;        /**< language of a (i18n)*/
+  char *xml_lang;    /**< directionality of xml:lang (i18n)*/
+  char *dir;         /**< directionality of lang (i18n)*/
+  char *target;      /**< target attribute of anchor */
+  char *charset;     /**< charset attribute of anchor */
+  char *type;        /**< type attribute of anchor */
+  char *name;        /**< name attribute of anchor */
+  char *href;        /**< href out of clip */
+  char *hreflang;    /**< hreflang of clip */
+  char *rel;         /**< rel attribute of anchor */
+  char *rev;         /**< rev attribute of anchor */
+  char *shape;       /**< shape attribute of anchor */
+  char *coords;      /**< coords attribute of anchor */
+  char *anchor_text; /**< anchor text */
+} CMML_AElement;
 
 /**
  * CMML_Clip: a clip element as presented in the CMML document.
  */
 typedef struct {
-  char *clip_id;         /**< id attribute of clip */
-  char *clip_class;      /**< class attribute of clip */
-  char *title;           /**< title attribute of clip */
-  char *lang;            /**< language attribute of desc element */
-  char *dir;             /**< directionality of lang */
-  char *track;           /**< track attribute of clip */
+  char *id;              /**< id attribute of clip (coreattrs)*/
+  char *cclass;          /**< class attribute of clip (coreattrs)*/
+  char *style;           /**< style attribute of clip (coreattrs)*/
+  char *title;           /**< title attribute of clip (coreattrs)*/
+  char *lang;            /**< language attribute of clip (i18n)*/
+  char *xml_lang;        /**< xml:lang attribute of clip (i18n)*/
+  char *dir;             /**< directionality of lang (i18n)*/
   CMML_Time *start_time; /**< start time of this clip */
   CMML_Time *end_time;   /**< end time of this clip */
   CMML_List * meta;      /**< list of meta elements */
-  char *anchor_id;       /**< id attribute of anchor */
-  char *anchor_class;    /**< class attribute of clip */
-  char *anchor_title;    /**< title attribute of clip */
-  char *anchor_lang;     /**< language of anchor */
-  char *anchor_dir;      /**< directionality of lang */
-  char *anchor_href;     /**< href out of clip */
-  char *anchor_text;     /**< anchor text */
-  char *img_id;          /**< id attribute of image */
-  char *img_class;       /**< class attribute of image */
-  char *img_title;       /**< title attribute of image */
-  char *img_lang;        /**< language of img */
-  char *img_dir;         /**< directionality of lang */
-  char *img_src;         /**< keyframe image of clip */
-  char *img_alt;         /**< alternate text for image */
-  char *desc_id;         /**< id attribute of desc */
-  char *desc_class;      /**< class attribute of desc */
-  char *desc_title;      /**< title attribute of desc */
-  char *desc_lang;       /**< language attribute of desc element */
-  char *desc_dir;        /**< directionality of lang */
-  char *desc_text;       /**< the description itself */
+  CMML_List * style;     /**< list of style elements */
+  CMML_AElement * anchor;  /**< a element */
+  CMML_ImgElement * image; /**< image element */
+  char *body_id;         /**< id attribute of body (coreattrs)*/
+  char *body_class;      /**< class attribute of body (coreattrs)*/
+  char *body_style;      /**< style attribute of body (coreattrs)*/
+  char *body_title;      /**< title attribute of body (coreattrs)*/
+  char *body_lang;       /**< language attribute of body (i18n)*/
+  char *body_xml_lang;   /**< xml:lang attribute of body (i18n)*/
+  char *body_dir;        /**< directionality of lang (i18n)*/
+  char *body_onload;     /**< onload attribute of body */
+  char *body_onunload;   /**< onunload attribute of body */
+  char *body_text;       /**< the body itself */
 } CMML_Clip;
 
 /**
@@ -254,7 +313,6 @@
   CMML_FORMAT_ERROR,      /**< error in the formatting of an implied attribute */
   CMML_UNKNOWN_TAG,       /**< skipping an unknown tag */
   CMML_TAG_IGNORED,       /**< skipping a faulty tag */
-  CMML_XMLNS_REDEFINED,   /**< xmlns in cmml tag is wrongly redefined */
   CMML_NONSEQUENTIAL_CLIP /**< clip with start time in the "past" skipped */
 } CMML_Error_Type;
 
@@ -316,7 +374,7 @@
 CMML * cmml_open (const char *XMLfilename);
 
 /**
- * cmml_attach_parser: Takes a FILE pointer to an already-opened CMML
+ * cmml_new: Takes a FILE pointer to an already-opened CMML
  * document.  Returns a CMML object containing internal initialised
  * data structures, etc, which is used in subsequent operations on the
  * CMML file.  This function must be called exactly once, after the
@@ -329,7 +387,7 @@
 CMML * cmml_new (FILE * file);
 
 /**
- * cmml_detach_parser: Close a CMML object.  Return the FILE pointer
+ * cmml_destroy: Close a CMML object.  Return the FILE pointer
  * from which the CMML object was derived.
  *
  * \param cmml a CMML* handle
@@ -445,11 +503,11 @@
 
 
 /**
- * cmml_error_clear: Clear the last error.
+ * cmml_clear_error: Clear the last error.
  *
  * \param cmml a CMML* handle
  */
-void         cmml_error_clear (CMML * cmml);
+void         cmml_clear_error (CMML * cmml);
 
 /**
  * cmml_set_window: sets the active temporal interval of a cmml stream;
@@ -510,10 +568,11 @@
  * \param xml_lang the xml:lang attribute of the cmml tag; not used if NULL
  * \param dir the dir attribute of the cmml tag; not used if NULL
  * \param role the role attribute of the cmml tag; not used if NULL
+ * \param basetime the basetime attribute of the cmml tag; not used if NULL
  *
  * \returns a CMML preamble
  */
-CMML_Preamble * cmml_preamble_new (const char *encoding, const char *id, const char *lang, const char *xml_lang, const char *dir, const char *role);
+CMML_Preamble * cmml_preamble_new (const char *encoding, const char *id, const char *lang, const char *xml_lang, const char *dir, const char *role, const char *basetime);
 
 /**
  * cmml_element_new: Create a new CMML_Element.
@@ -634,7 +693,7 @@
  * \returns the number of characters written to the buffer (including
  * the terminating \\0) or -1 if buffer too small.
  */
-int cmml_preamble_snprint(char *buf, int n, CMML_Preamble *pre);
+int cmml_preamble_snprint (char *buf, int n, CMML_Preamble *pre);
 
 /**
  * cmml_element_snprint: Given a buffer buf of size n, write a CMML
@@ -781,8 +840,8 @@
  *
  * \returns the head of the list (which may have changed)
  */
-CMML_List * cmml_list_add_before (CMML_List * list, void * data, 
-				  CMML_List * node);
+CMML_List * cmml_list_add_before (CMML_List * list, void * data, CMML_List * node);
+
 /**
  * cmml_list_add_after: Add a new node containing given data after a
  * given node.
@@ -793,8 +852,7 @@
  *
  * \returns the head of the list
  */
-CMML_List * cmml_list_add_after  (CMML_List * list, void * data, 
-				  CMML_List * node);
+CMML_List * cmml_list_add_after  (CMML_List * list, void * data, CMML_List * node);
 
 /**
  * cmml_list_find: Find the first node containing given data in a list.
@@ -853,8 +911,7 @@
  *
  * \returns NULL on success
  */
-CMML_List * cmml_list_free_with   (CMML_List * list, 
-				   CMML_FreeFunc free_func);
+CMML_List * cmml_list_free_with   (CMML_List * list, CMML_FreeFunc free_func);
 
 /**
  * cmml_list_free: Free a list, using anx_free() to free each data
@@ -912,8 +969,7 @@
  * range, otherwise just a t_start time, and returns the number of
  * times created or -1 otherwise.
  */
-int cmml_time_interval_new (const char * s, 
-			    CMML_Time ** t_start, CMML_Time ** t_end);
+int cmml_time_interval_new (const char * s, CMML_Time ** t_start, CMML_Time ** t_end);
 
 /**
  * cmml_time_new_in_sec: For parsing/converting start and end time

Modified: libcmml/branches/cmml4/src/cmml_element.c
===================================================================
--- libcmml/branches/cmml4/src/cmml_element.c	2008-04-13 14:21:26 UTC (rev 3552)
+++ libcmml/branches/cmml4/src/cmml_element.c	2008-04-13 14:22:56 UTC (rev 3553)
@@ -54,7 +54,7 @@
  * cmml_preamble_new: Create a new CMML_Preamble.
  */
 CMML_Preamble * 
-cmml_preamble_new (const char *encoding, const char *id, const char *lang, const char *xml_lang, const char *dir, const char *role)
+cmml_preamble_new (const char *encoding, const char *id, const char *lang, const char *xml_lang, const char *dir, const char *role, const char *basetime)
 {
   CMML_Preamble * p;
   p = (CMML_Preamble *) cmml_malloc(sizeof(CMML_Preamble));
@@ -90,7 +90,11 @@
   } else {
     p->cmml_role = NULL;
   }
-  p->cmml_xmlns = cmml_strdup("http://www.annodex.net/cmml");
+  if (basetime) {
+    p->cmml_basetime = cmml_strdup(basetime);
+  } else {
+    p->cmml_basetime = NULL;
+  }
   return p;
 }
 
@@ -98,7 +102,7 @@
  * cmml_element_new: initialise memory for a new CMML_Element.
  */
 CMML_Element *
-cmml_element_new(CMML_Element_Type type)
+cmml_element_new (CMML_Element_Type type)
 {
   CMML_Element * elem = cmml_malloc(sizeof(CMML_Element));
   
@@ -124,16 +128,20 @@
 {
   CMML_Head * h;
   h = (CMML_Head *) cmml_malloc(sizeof(CMML_Head));
-  h->head_id = NULL;
+  h->id = NULL;
   h->lang = NULL;
+  h->xml_lang = NULL;
   h->dir = NULL;
   h->profile = NULL;
   h->title = NULL;
   h->title_id = NULL;
   h->title_lang = NULL;
+  h->title_xml_lang = NULL;
   h->title_dir = NULL;
+  h->image = NULL;
   h->base_id = NULL;
   h->base_href = NULL;
+  h->style = cmml_list_new();
   h->meta = cmml_list_new();
   h->link = cmml_list_new();
   return h;
@@ -191,6 +199,54 @@
  * Cloning functions
  */
 
+static CMML_ImgElement *
+cmml_image_element_clone (CMML_ImgElement * image)
+{
+  CMML_ImgElement * new_image;
+
+  if (image == NULL) return NULL;
+
+  new_image = (CMML_ImgElement* ) cmml_malloc (sizeof(CMML_ImgElement));
+  /* maybe consider memcpy for speedup and introduce reference counting!
+     memcpy (new_image, image, sizeof (*new_image));
+  */
+  new_image->id       = cmml_strdup (image->id);
+  new_image->iclass   = cmml_strdup (image->iclass);
+  new_image->style    = cmml_strdup (image->style);
+  new_image->title    = cmml_strdup (image->title);
+  new_image->lang     = cmml_strdup (image->lang);
+  new_image->xml_lang = cmml_strdup (image->xml_lang);
+  new_image->dir      = cmml_strdup (image->dir);
+  new_image->src      = cmml_strdup (image->src);
+  new_image->alt      = cmml_strdup (image->alt);
+  new_image->longdesc = cmml_strdup (image->longdesc);
+  new_image->height   = cmml_strdup (image->height);
+  new_image->width    = cmml_strdup (image->width);
+  return new_image;
+}
+
+static CMML_StyleElement *
+cmml_style_element_clone (CMML_StyleElement * style)
+{
+  CMML_StyleElement * new_style;
+
+  if (style == NULL) return NULL;
+
+  new_style = (CMML_StyleElement* ) cmml_malloc (sizeof(CMML_StyleElement));
+  /* maybe consider memcpy for speedup and introduce reference counting!
+     memcpy (new_style, style, sizeof (*new_style));
+  */
+  new_style->id         = cmml_strdup (style->id);
+  new_style->lang       = cmml_strdup (style->lang);
+  new_style->xml_lang   = cmml_strdup (style->xml_lang);
+  new_style->type       = cmml_strdup (style->type);
+  new_style->media      = cmml_strdup (style->media);
+  new_style->title      = cmml_strdup (style->title);
+  new_style->xml_space  = cmml_strdup (style->xml_space);
+  new_style->style_text = cmml_strdup (style->style_text);
+  return new_style;
+}
+
 static CMML_MetaElement *
 cmml_meta_element_clone (CMML_MetaElement * meta)
 {
@@ -202,12 +258,14 @@
   /* maybe consider memcpy for speedup and introduce reference counting!
      memcpy (new_meta, meta, sizeof (*new_meta));
   */
-  new_meta->id      = cmml_strdup (meta->id);
-  new_meta->lang    = cmml_strdup (meta->lang);
-  new_meta->dir     = cmml_strdup (meta->dir);
-  new_meta->name    = cmml_strdup (meta->name);
-  new_meta->content = cmml_strdup (meta->content);
-  new_meta->scheme  = cmml_strdup (meta->scheme);
+  new_meta->id         = cmml_strdup (meta->id);
+  new_meta->lang       = cmml_strdup (meta->lang);
+  new_meta->xml_lang   = cmml_strdup (meta->xml_lang);
+  new_meta->dir        = cmml_strdup (meta->dir);
+  new_meta->name       = cmml_strdup (meta->name);
+  new_meta->content    = cmml_strdup (meta->content);
+  new_meta->scheme     = cmml_strdup (meta->scheme);
+  new_meta->http-equiv = cmml_strdup (meta->http-equiv);
   return new_meta;
 }
 
@@ -223,11 +281,16 @@
      memcpy (new_link, link, sizeof (*new_link));
   */
   new_link->id         = cmml_strdup (link->id);
-  new_link->link_class = cmml_strdup (link->link_class);
+  new_link->lclass     = cmml_strdup (link->lclass);
+  new_link->style      = cmml_strdup (link->style);
   new_link->title      = cmml_strdup (link->title);
   new_link->lang       = cmml_strdup (link->lang);
+  new_link->xml_lang   = cmml_strdup (link->xml_lang);
   new_link->dir        = cmml_strdup (link->dir);
+  new_link->events     = cmml_strdup (link->events);
+  new_link->charset    = cmml_strdup (link->charset);
   new_link->href       = cmml_strdup (link->href);
+  new_link->hreflang   = cmml_strdup (link->hreflang);
   new_link->type       = cmml_strdup (link->type);
   new_link->rel        = cmml_strdup (link->rel);
   new_link->rev        = cmml_strdup (link->rev);
@@ -248,8 +311,8 @@
   p->cmml_xml_lang    = cmml_strdup(src->cmml_xml_lang);
   p->cmml_dir         = cmml_strdup(src->cmml_dir);
   p->cmml_id          = cmml_strdup(src->cmml_id);
-  p->cmml_xmlns       = cmml_strdup(src->cmml_xmlns);
   p->cmml_role        = cmml_strdup(src->cmml_role);
+  p->cmml_basetime    = cmml_strdup(src->cmml_basetime);
   return p;
 }
 
@@ -287,16 +350,21 @@
   /*
   memcpy (new_head, head, sizeof (*new_head));
   */
-  new_head->head_id    = cmml_strdup(head->head_id);
+  new_head->id         = cmml_strdup(head->id);
   new_head->lang       = cmml_strdup(head->lang);
+  new_head->xml_lang   = cmml_strdup(head->xml_lang);
   new_head->dir        = cmml_strdup(head->dir);
   new_head->profile    = cmml_strdup(head->profile);
   new_head->title      = cmml_strdup(head->title);
   new_head->title_id   = cmml_strdup(head->title_id);
   new_head->title_lang = cmml_strdup(head->title_lang);
+  new_head->title_xml_lang = cmml_strdup(head->title_xml_lang);
   new_head->title_dir  = cmml_strdup(head->title_dir);
+  new_head->image      = cmml_image_clone(head->image);
   new_head->base_id    = cmml_strdup(head->base_id);
   new_head->base_href  = cmml_strdup(head->base_href);
+  new_head->style =
+    cmml_list_clone_with (head->style, (CMML_CloneFunc)cmml_style_element_clone);
   new_head->meta =
     cmml_list_clone_with (head->meta, (CMML_CloneFunc)cmml_meta_element_clone);
   new_head->link =
@@ -304,6 +372,34 @@
   return new_head;
 }
 
+CMML_AElement *
+cmml_anchor_element_clone (CMML_AElement * src)
+{
+	CMML_AElement * a;
+	if (src == NULL) return NULL;
+	a = (CMML_Aelemetn *) cmml_malloc(sizeof(CMML_AElement));
+	
+	a->id          = cmml_strdup(src->id);
+	a->aclass      = cmml_strdup(src->aclass);
+	a->style       = cmml_strdup(src->style);
+	a->title       = cmml_strdup(src->title);
+	a->lang        = cmml_strdup(src->lang);
+	a->xml_lang    = cmml_strdup(src->xml_lang);
+	a->dir         = cmml_strdup(src->dir);
+	a->target      = cmml_strdup(src->target);
+	a->charset     = cmml_strdup(src->charset);
+	a->type        = cmml_strdup(src->type);
+	a->name        = cmml_strdup(src->name);
+	a->href        = cmml_strdup(src->href);
+	a->hreflang    = cmml_strdup(src->hreflang);
+	a->rel         = cmml_strdup(src->rel);
+	a->rev         = cmml_strdup(src->rev);
+	a->shape       = cmml_strdup(src->shape);
+	a->coords      = cmml_strdup(src->coords);
+	a->anchor_text = cmml_strdup(src->anchor_text);
+	return a;
+}
+
 CMML_Clip  * 
 cmml_clip_clone (CMML_Clip * src)
 {
@@ -313,52 +409,66 @@
   /*
   memcpy (a, src, sizeof (*a));
   */
-  a->clip_id    = cmml_strdup(src->clip_id);
-  a->clip_class = cmml_strdup(src->clip_class);
+  a->id         = cmml_strdup(src->id);
+  a->cclass     = cmml_strdup(src->cclass);
+  a->style      = cmml_strdup(src->style);
   a->title      = cmml_strdup(src->title);
   a->lang       = cmml_strdup(src->lang);
-  a->dir        = cmml_strdup(src->dir);
-  a->track      = cmml_strdup(src->track);
+  a->xml_lang   = cmml_strdup(src->xml_lang);
+  a->dir        = cmml_strdup(src->anchor_dir);
   a->start_time = cmml_time_clone(src->start_time);
   a->end_time   = cmml_time_clone(src->end_time);
   a->meta =
     cmml_list_clone_with (src->meta, (CMML_CloneFunc)cmml_meta_element_clone);
-  a->anchor_id       = cmml_strdup(src->anchor_id);
-  a->anchor_class    = cmml_strdup(src->anchor_class);
-  a->anchor_title    = cmml_strdup(src->anchor_title);
-  a->anchor_lang     = cmml_strdup(src->anchor_lang);
-  a->anchor_dir      = cmml_strdup(src->anchor_dir);
-  a->anchor_href     = cmml_strdup(src->anchor_href);
-  a->anchor_text     = cmml_strdup(src->anchor_text);
-  a->img_id       = cmml_strdup(src->img_id);
-  a->img_class    = cmml_strdup(src->img_class);
-  a->img_title    = cmml_strdup(src->img_title);
-  a->img_lang     = cmml_strdup(src->img_lang);
-  a->img_dir      = cmml_strdup(src->img_dir);
-  a->img_src      = cmml_strdup(src->img_src);
-  a->img_alt      = cmml_strdup(src->img_alt);
-  a->desc_id      = cmml_strdup(src->desc_id);
-  a->desc_class   = cmml_strdup(src->desc_class);
-  a->desc_title   = cmml_strdup(src->desc_title);
-  a->desc_lang    = cmml_strdup(src->desc_lang);
-  a->desc_dir     = cmml_strdup(src->desc_dir);
-  a->desc_text    = cmml_strdup(src->desc_text);
+  a->style =
+    cmml_list_clone_with (src->style, (CMML_CloneFunc)cmml_style_element_clone);
+  a->anchor        = cmml_anchor_element_clone(src->anchor);
+  a->image         = cmml_image_element_clone(src->image);
+  a->body_id       = cmml_strdup(src->body_id);
+  a->body_class    = cmml_strdup(src->body_class);
+  a->body_style    = cmml_strdup(src->body_style);
+  a->body_title    = cmml_strdup(src->body_title);
+  a->body_lang     = cmml_strdup(src->body_lang);
+  a->body_xml_lang = cmml_strdup(src->body_xml_lang);
+  a->body_dir      = cmml_strdup(src->body_dir);
+  a->body_onload   = cmml_strdup(src->body_onload);
+  a->body_onunload = cmml_strdup(src->body_onunload);
+  a->body_text     = cmml_strdup(src->body_text);
   return a;
 }
 
 /*
  * Destroying functions
  */
+CMML_StyleElement *
+cmml_style_element_destroy (CMML_StyleElement * style)
+{
+  if (style == NULL) return NULL;
+  cmml_free (style->id);
+  cmml_free (style->lang);
+  cmml_free (style->xml_lang);
+  cmml_free (style->dir);
+  cmml_free (style->type);
+  cmml_free (style->media);
+  cmml_free (style->title);
+  cmml_free (style->xml_space);
+  cmml_free (style->style_text);
+  cmml_free (style);
+  return NULL;
+}
+
 CMML_MetaElement *
 cmml_meta_element_destroy (CMML_MetaElement * meta)
 {
   if (meta == NULL) return NULL;
   cmml_free (meta->id);
   cmml_free (meta->lang);
+  cmml_free (meta->xml_lang);
   cmml_free (meta->dir);
   cmml_free (meta->name);
   cmml_free (meta->content);
   cmml_free (meta->scheme);
+  cmml_free (meta->http_equiv);
   cmml_free (meta);
   return NULL;
 }
@@ -368,9 +478,11 @@
 {
   if (link == NULL) return NULL;
   cmml_free (link->id);
-  cmml_free (link->link_class);
+  cmml_free (link->lclass);
+  cmml_free (link->style);
   cmml_free (link->title);
   cmml_free (link->lang);
+  cmml_free (link->xml_lang);
   cmml_free (link->dir);
   cmml_free (link->href);
   cmml_free (link->type);
@@ -390,8 +502,8 @@
   cmml_free(info->cmml_xml_lang);
   cmml_free(info->cmml_dir);
   cmml_free(info->cmml_id);
-  cmml_free(info->cmml_xmlns);
   cmml_free(info->cmml_role);
+  cmml_free(info->cmml_basetime);
   cmml_free(info);
   return;
 }
@@ -423,16 +535,20 @@
 cmml_head_destroy(CMML_Head * h)
 {
   if (h == NULL) return;
-  cmml_free(h->head_id);
+  cmml_free(h->id);
   cmml_free(h->lang);
+  cmml_free(h->xml_lang);
   cmml_free(h->dir);
   cmml_free(h->profile);
   cmml_free(h->title);
   cmml_free(h->title_id);
   cmml_free(h->title_lang);
+  cmml_free(h->title_xml_lang);
   cmml_free(h->title_dir);
+  cmml_image_free(h->image);
   cmml_free(h->base_id);
   cmml_free(h->base_href);
+  cmml_list_free_with(h->style, (CMML_FreeFunc) cmml_style_element_destroy);
   cmml_list_free_with(h->meta, (CMML_FreeFunc) cmml_meta_element_destroy);
   cmml_list_free_with(h->link, (CMML_FreeFunc) cmml_link_element_destroy);
   cmml_free(h);
@@ -492,6 +608,44 @@
 
 /* return number of characters written */
 static
+int cmml_style_list_snprint (char *buf, int *_len, int *_n, int *_n_written, 
+			    CMML_List * style)
+{
+  int len = *_len;
+  int n = *_n;
+  int n_written = *_n_written;
+  
+  if (!cmml_list_is_empty(style)) {
+    CMML_List * style_node;
+      
+    for (style_node = style;
+	 style_node != NULL;
+	 style_node = style_node->next) {
+      CMML_StyleElement * s = (CMML_StyleElement *) style_node->data;
+	
+      BEGIN_TAG("style");
+      APPEND_ATTRIBUTE("id", s->id);
+      APPEND_ATTRIBUTE("lang", s->lang);
+      APPEND_ATTRIBUTE("xml:lang", s->xml_lang);
+      APPEND_ATTRIBUTE("dir", s->dir);
+      APPEND_ATTRIBUTE("type", s->type);
+      APPEND_ATTRIBUTE("media", s->media);
+      APPEND_ATTRIBUTE("title", s->title);
+      APPEND_ATTRIBUTE("xml_space", s->xml_space);
+	  END_TAG();
+      APPEND_DATA(s->style_text);
+      CLOSE_TAG("style");
+      NEWLINE;
+    }
+  }
+  *_len = len;
+  *_n = n;
+  *_n_written = n_written;
+  return 0;
+}
+
+/* return number of characters written */
+static
 int cmml_meta_list_snprint (char *buf, int *_len, int *_n, int *_n_written, 
 			    CMML_List * meta)
 {
@@ -503,17 +657,19 @@
     CMML_List * meta_node;
       
     for (meta_node = meta;
-	 meta_node != NULL;
-	 meta_node = meta_node->next) {
+	     meta_node != NULL;
+	     meta_node = meta_node->next) {
       CMML_MetaElement * m = (CMML_MetaElement *) meta_node->data;
 	
       BEGIN_TAG("meta");
       APPEND_ATTRIBUTE("id", m->id);
       APPEND_ATTRIBUTE("lang", m->lang);
+      APPEND_ATTRIBUTE("xml:lang", m->xml_lang);
       APPEND_ATTRIBUTE("dir", m->dir);
       APPEND_ATTRIBUTE("name", m->name);
       APPEND_ATTRIBUTE("content", m->content);
       APPEND_ATTRIBUTE("scheme", m->scheme);
+      APPEND_ATTRIBUTE("http-equiv", m->http-equiv);
       END_EMPTY_TAG();
       NEWLINE;
     }
@@ -543,11 +699,16 @@
 	
       BEGIN_TAG("link");
       APPEND_ATTRIBUTE("id", l->id);
-      APPEND_ATTRIBUTE("class", l->link_class);
+      APPEND_ATTRIBUTE("class", l->lclass);
+      APPEND_ATTRIBUTE("style", l->style);
       APPEND_ATTRIBUTE("title", l->title);
       APPEND_ATTRIBUTE("lang", l->lang);
+      APPEND_ATTRIBUTE("xml:lang", l->xml_lang);
       APPEND_ATTRIBUTE("dir", l->dir);
+      APPEND_ATTRIBUTE("events", l->events);
+      APPEND_ATTRIBUTE("charset", l->charset);
       APPEND_ATTRIBUTE("href", l->href);
+      APPEND_ATTRIBUTE("hreflang", l->hreflang);
       APPEND_ATTRIBUTE("type", l->type);
       APPEND_ATTRIBUTE("rel", l->rel);
       APPEND_ATTRIBUTE("rev", l->rev);
@@ -595,10 +756,8 @@
   APPEND_ATTRIBUTE("lang", pre->cmml_lang);
   APPEND_ATTRIBUTE("xml:lang", pre->cmml_xml_lang);
   APPEND_ATTRIBUTE("dir", pre->cmml_dir);
-  /* to print or not to print?
-  APPEND_ATTRIBUTE("xmlns", pre->cmml_xmlns);
-  */
   APPEND_ATTRIBUTE("role", pre->cmml_role);
+  APPEND_ATTRIBUTE("basetime", pre->cmml_basetime);
   END_TAG();
   NEWLINE;
 
@@ -649,20 +808,24 @@
     BEGIN_TAG("head");
     APPEND_ATTRIBUTE("id", h->head_id);
     APPEND_ATTRIBUTE("lang", h->lang);
+    APPEND_ATTRIBUTE("xml:lang", h->lang);
     APPEND_ATTRIBUTE("dir", h->dir);
     APPEND_ATTRIBUTE("profile", h->profile);
     END_TAG();
 
-    if (h->title || h->title_id || h->title_lang || h->title_dir) {
+    if (h->title || h->title_id || h->title_lang || h->title_xml_lang || h->title_dir) {
         BEGIN_TAG("title");
         APPEND_ATTRIBUTE("id", h->title_id);
         APPEND_ATTRIBUTE("lang", h->title_lang);
+        APPEND_ATTRIBUTE("xml:lang", h->title_xml_lang);
         APPEND_ATTRIBUTE("dir", h->title_dir);
         END_TAG();
         APPEND_DATA(h->title);
         CLOSE_TAG("title");
     }
 
+	cmml_image_snprint(buf, &len, &n, &n_written, h->image);
+
     if (h->base_id || h->base_href) {
         BEGIN_TAG("base");
         APPEND_ATTRIBUTE("id", h->base_id);
@@ -670,8 +833,13 @@
         END_EMPTY_TAG();
     }
 
+    if (cmml_meta_list_snprint(buf, &len, &n, &n_written, h->style) < 0)
+      return -1;
     if (cmml_meta_list_snprint(buf, &len, &n, &n_written, h->meta) < 0)
       return -1;
+    if (cmml_meta_list_snprint(buf, &len, &n, &n_written, h->link) < 0)
+      return -1;
+
     CLOSE_TAG("head");
     
     return len;
@@ -688,15 +856,17 @@
   BEGIN_TAG("head");
   APPEND_ATTRIBUTE("id", h->head_id);
   APPEND_ATTRIBUTE("lang", h->lang);
+  APPEND_ATTRIBUTE("xml:lang", h->xml_lang);
   APPEND_ATTRIBUTE("dir", h->dir);
   APPEND_ATTRIBUTE("profile", h->profile);
   END_TAG();
   NEWLINE;
     
-  if (h->title || h->title_id || h->title_lang || h->title_dir) {
+  if (h->title || h->title_id || h->title_lang || h->title_xml_lang || h->title_dir) {
     BEGIN_TAG("title");
     APPEND_ATTRIBUTE("id", h->title_id);
     APPEND_ATTRIBUTE("lang", h->title_lang);
+    APPEND_ATTRIBUTE("xml:lang", h->title_xml_lang);
     APPEND_ATTRIBUTE("dir", h->title_dir);
     END_TAG();
     APPEND_DATA(h->title);
@@ -704,6 +874,8 @@
     NEWLINE;
   }
 
+  cmml_image_pretty_snprint(buf, &len, &n, &n_written, h->image);
+
   if (h->base_id || h->base_href) {
     BEGIN_TAG("base");
     APPEND_ATTRIBUTE("id", h->base_id);
@@ -712,10 +884,13 @@
     NEWLINE;
   }
 
+  if (cmml_meta_list_snprint(buf, &len, &n, &n_written, h->style) < 0)
+    return -1;
   if (cmml_meta_list_snprint(buf, &len, &n, &n_written, h->meta) < 0)
     return -1;
   if (cmml_link_list_snprint(buf, &len, &n, &n_written, h->link) < 0)
     return -1;
+
   CLOSE_TAG("head");
   NEWLINE;
 
@@ -923,9 +1098,6 @@
   case CMML_TAG_IGNORED:
     REPORT (error, "Skipped doubly defined tag or tag with missing required attribute");
     break;
-  case CMML_XMLNS_REDEFINED:
-    REPORT (error, "Skipped xmlns in cmml tag wrongly redefined");
-    break;
   case CMML_NONSEQUENTIAL_CLIP:
     REPORT (error, "Skipped clip out of temporal order");
     break;

Modified: libcmml/branches/cmml4/src/cmml_private.c
===================================================================
--- libcmml/branches/cmml4/src/cmml_private.c	2008-04-13 14:21:26 UTC (rev 3552)
+++ libcmml/branches/cmml4/src/cmml_private.c	2008-04-13 14:22:56 UTC (rev 3553)
@@ -60,8 +60,7 @@
   /* if stream tag had not previously been read, read until you've got it by */
   /* checking for basetime as this is a stream attribute that is obligatory */
   /* or until you have a head tag */
-  while (ctxt->status->stream == NULL || 
-	 ctxt->status->stream->basetime == NULL) {
+  while (ctxt->status->info == NULL) {
 	  if ((bytes = (long)fread(buf, 1, READ_BUF_SIZE, ctxt->file)) == -1) {
       cmml_set_error((CMML*)ctxt, CMML_READ_ERROR);
       return -1;
@@ -78,7 +77,7 @@
     /* end of file reached */
     if (bytes == 0) {
       if (cmml_get_last_error((CMML*)ctxt) == NULL) {
-	cmml_set_error ((CMML*)ctxt, CMML_EOF);
+        cmml_set_error ((CMML*)ctxt, CMML_EOF);
       }
       return -1;
     }
@@ -92,7 +91,7 @@
  * characters: handler for PCDATA between start and end tags.  
  */
 static void 
-characters(void *cmml, const XML_Char *ch, int len)
+characters (void *cmml, const XML_Char *ch, int len)
 {
   CMML_Context * context = (CMML_Context*) cmml;
   XML_Char *p;
@@ -120,7 +119,7 @@
  * the status context
  */
 static void 
-insert_root_attrs(CMML_Preamble * docinfo, const XML_Char **attr, CMML_Context *ctxt)
+insert_root_attrs (CMML_Preamble * docinfo, const XML_Char **attr, CMML_Context *ctxt)
 {
   int i;
 
@@ -135,15 +134,12 @@
       docinfo->cmml_xml_lang = cmml_strdup(attr[i+1]);
     } else if (cmml_strcmp(attr[i], "dir") == 0) {
       docinfo->cmml_dir = cmml_strdup(attr[i+1]);
-    } else if (cmml_strcmp(attr[i], "xmlns") == 0) {
-      /* this is fix so redefining it is a sloppy error */
-      if (cmml_strcmp(attr[i+1], "http://www.annodex.net/cmml") != 0) {
-	cmml_set_error((CMML*)ctxt, CMML_XMLNS_REDEFINED);
-      }
+    } else if (cmml_strcmp(attr[i], "role") == 0) {
+      docinfo->cmml_role = cmml_strdup(attr[i+1]);
+    } else if (cmml_strcmp(attr[i], "basetime") == 0) {
+      docinfo->cmml_basetime = cmml_strdup(attr[i+1]);
     }
   }
-  /* this is fix so ignore whatever it was set to */
-  docinfo->cmml_xmlns = cmml_strdup("http://www.annodex.net/cmml");
 }
 
 /*
@@ -151,7 +147,7 @@
  * CMML_HEAD.
  */
 static void 
-insert_head_attrs(CMML_Head * head, const XML_Char **attr)
+insert_head_attrs (CMML_Head * head, const XML_Char **attr)
 {
   int i;
 
@@ -161,9 +157,11 @@
     fprintf(stderr, "Inserting head attribute %s=%s\n", attr[i], attr[i+1]);
 #endif
     if (cmml_strcmp(attr[i], "id") == 0) {
-      head->head_id = cmml_strdup(attr[i+1]);
+      head->id = cmml_strdup(attr[i+1]);
     } else if (cmml_strcmp(attr[i], "lang") == 0) {
       head->lang = cmml_strdup(attr[i+1]);
+    } else if (cmml_strcmp(attr[i], "xml:lang") == 0) {
+      head->xml_lang = cmml_strdup(attr[i+1]);
     } else if (cmml_strcmp(attr[i], "dir") == 0) {
       head->dir = cmml_strdup(attr[i+1]);
     } else if (cmml_strcmp(attr[i], "profile") == 0) {
@@ -190,6 +188,8 @@
       head->title_id = cmml_strdup(attr[i+1]);
     } else if (cmml_strcmp(attr[i], "lang") == 0) {
       head->title_lang = cmml_strdup(attr[i+1]);
+    } else if (cmml_strcmp(attr[i], "xml:lang") == 0) {
+      head->title_xml_lang = cmml_strdup(attr[i+1]);
     } else if (cmml_strcmp(attr[i], "dir") == 0) {
       head->title_dir = cmml_strdup(attr[i+1]);
     }
@@ -344,7 +344,7 @@
   int i;
 
   if (!a) return -1;
-  ctxt->status->stream->basetime = cmml_time_new("0");
+  ctxt->status->info->basetime = cmml_time_new("0");
   for (i = 0; attr[i] != NULL; i += 2) {
 #ifdef DEBUG
     fprintf(stderr, "Inserting clip attribute %s=%s\n", attr[i], attr[i+1]);
@@ -364,11 +364,11 @@
     } else if (cmml_strcmp(attr[i], "start") == 0) {
       a->start_time = 
 	cmml_time_new_in_sec (attr[i+1], 
-			      ctxt->status->stream->basetime->t.sec);
+			      ctxt->status->info->basetime->t.sec);
     } else if (cmml_strcmp(attr[i], "end") == 0) {
       a->end_time = 
 	cmml_time_new_in_sec (attr[i+1],
-			      ctxt->status->stream->basetime->t.sec);
+			      ctxt->status->info->basetime->t.sec);
     }
   }
   /* set default track  */
@@ -388,7 +388,7 @@
     cmml_time_free (a->end_time);
   }
   /* check if new clip comes after basetime and after previous clip */
-  if (a->start_time->t.sec < ctxt->status->stream->basetime->t.sec ||
+  if (a->start_time->t.sec < ctxt->status->info->basetime->t.sec ||
       (ctxt->status->clip && 
        (a->start_time->t.sec < ctxt->status->clip->start_time->t.sec))) {
       cmml_set_error((CMML*)ctxt, CMML_NONSEQUENTIAL_CLIP);
@@ -396,7 +396,7 @@
       fprintf(stderr, 
 	      "nonsequential: clip=%f(%s), basetime=%f, prev_clip=%f\n",
 	      a->start_time->t.sec, a->start_time->tstr,
-	      ctxt->status->stream->basetime->t.sec,
+	      ctxt->status->info->basetime->t.sec,
 	      ctxt->status->prev_clip->start_time->t.sec);
 #endif
       return -1;
@@ -616,7 +616,7 @@
       context->status->type = CMML_HEAD;
       return;
     }
-    context->status->stream->basetime = cmml_time_new("0");
+    context->status->info->basetime = cmml_time_new("0");
     context->status->type = CMML_HEAD;
     /* there musn't be a head tag after a clip tag */
     if (context->status->clip) {
@@ -1028,8 +1028,8 @@
   context->status->info->cmml_xml_lang    = NULL;
   context->status->info->cmml_dir         = NULL;
   context->status->info->cmml_id          = NULL;
-  context->status->info->cmml_xmlns       = NULL;
   context->status->info->cmml_role        = NULL;
+  context->status->info->cmml_basetime    = NULL;
   context->status->type = CMML_NONE;
   context->status->head   = NULL;
   context->status->clip = NULL;

Modified: libcmml/branches/cmml4/src/cmml_private.h
===================================================================
--- libcmml/branches/cmml4/src/cmml_private.h	2008-04-13 14:21:26 UTC (rev 3552)
+++ libcmml/branches/cmml4/src/cmml_private.h	2008-04-13 14:22:56 UTC (rev 3553)
@@ -140,25 +140,24 @@
  * ------------------------------- */
 
 /* set up the context and destroy it */
-CMML_Context * cmml_context_setup(FILE * file);
-FILE *         cmml_context_destroy(CMML_Context * context);
-int            cmml_parse_to_head (CMML_Context * context);
-CMML_MetaElement *
-               cmml_meta_element_destroy (CMML_MetaElement * meta);
-CMML_LinkElement *
-               cmml_link_element_destroy (CMML_LinkElement * link);
+CMML_Context *      cmml_context_setup (FILE * file);
+FILE *              cmml_context_destroy (CMML_Context * context);
+int                 cmml_parse_to_head (CMML_Context * context);
 
 
+CMML_StyleElement * cmml_style_element_destroy (CMML_StyleElement * style);
+CMML_MetaElement *  cmml_meta_element_destroy (CMML_MetaElement * meta);
+CMML_LinkElement *  cmml_link_element_destroy (CMML_LinkElement * link);
+
 /* set the encountered error in the context */
-void cmml_set_error(CMML * cmml, CMML_Error_Type error);
+void cmml_set_error (CMML * cmml, CMML_Error_Type error);
 
 /* -------------------------------------- *
  * helper functions for printing tags     *
  * -------------------------------------- */
 
 int cmml_snprintf          (char * str, size_t size, const char * format, ...);
-int cmml_snprint_attribute (char * buf, int n, char * attr_name, 
-			    char * attr_value);
+int cmml_snprint_attribute (char * buf, int n, char * attr_name, char * attr_value);
 int cmml_snprint_pcdata    (char * buf, int n, char * data);
 
 /* ------------------------ *
@@ -169,6 +168,6 @@
  * however, with better memory-management code and error-reporting
  * functions.
  */
-void *emalloc(size_t size);
+void *emalloc (size_t size);
 
 #endif /* __CMML_PRIVATE_H__ */

Modified: libcmml/branches/cmml4/tests/error14.cmml
===================================================================
--- libcmml/branches/cmml4/tests/error14.cmml	2008-04-13 14:21:26 UTC (rev 3552)
+++ libcmml/branches/cmml4/tests/error14.cmml	2008-04-13 14:22:56 UTC (rev 3553)
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
 <!DOCTYPE cmml SYSTEM "cmml.dtd">
 
-<cmml xmlns="test">
+<cmml>
 
 <head lang="en">
 <title>Buried dams of water</title>

Modified: libcmml/branches/cmml4/tools/cmml-fix.c
===================================================================
--- libcmml/branches/cmml4/tools/cmml-fix.c	2008-04-13 14:21:26 UTC (rev 3552)
+++ libcmml/branches/cmml4/tools/cmml-fix.c	2008-04-13 14:22:56 UTC (rev 3553)
@@ -175,7 +175,7 @@
  * the file in chunks of BUFSIZE size, during which the callbacks get
  * activated as the relevant elements get parsed.
  */
-int main(int argc, char *argv[])
+int main (int argc, char *argv[])
 {
   char *pathfile = NULL;
   int i;



More information about the commits mailing list