Index: XMLIO_V2/dev/dev_rv/src/XMLIO/NetCDF4_data_output.hpp
===================================================================
--- XMLIO_V2/dev/dev_rv/src/XMLIO/NetCDF4_data_output.hpp	(revision 134)
+++ XMLIO_V2/dev/dev_rv/src/XMLIO/NetCDF4_data_output.hpp	(revision 137)
@@ -22,9 +22,8 @@
          void writeVarData(const string& id, const Array<float, 1>& vdata)
          {
-            //if (!latVar->put(lats, NLAT))
-            //   return NC_ERR;
-         }
-
-         virtual ~NetCDF4DataOutput()
+
+         }
+
+         virtual ~NetCDF4DataOutput( void)
          { if (dataFile != NULL) delete dataFile; }
 
@@ -192,8 +191,8 @@
                hm["long_name"]     = "Latitude" ;
                hm["nav_model"]     = domid ;
-               if ((*itt)->yvalue.hasValue())
-               {
-                  hmf["valid_min"] = ((Array<double, 1>)(*itt)->yvalue)(0);
-                  hmf["valid_max"] = ((Array<double, 1>)(*itt)->yvalue)(((Array<double, 1>)(*itt)->yvalue).size()-1);
+               if ((*itt)->latvalue.hasValue())
+               {
+                  hmf["valid_min"] = ((Array<double, 1>)(*itt)->latvalue)(0);
+                  hmf["valid_max"] = ((Array<double, 1>)(*itt)->latvalue)(((Array<double, 1>)(*itt)->latvalue).size()-1);
                   this->addStringAttributesToVar(latVar, hmf);
                   hmf.clear();
@@ -208,8 +207,8 @@
                hm["long_name"]     = "Longitude" ;
                hm["nav_model"]     = domid ;
-               if ((*itt)->xvalue.hasValue())
-               {
-                  hmf["valid_min"] = ((Array<double, 1>)(*itt)->xvalue)(0);
-                  hmf["valid_max"] = ((Array<double, 1>)(*itt)->xvalue)(((Array<double, 1>)(*itt)->xvalue).size()-1);
+               if ((*itt)->lonvalue.hasValue())
+               {
+                  hmf["valid_min"] = ((Array<double, 1>)(*itt)->lonvalue)(0);
+                  hmf["valid_max"] = ((Array<double, 1>)(*itt)->lonvalue)(((Array<double, 1>)(*itt)->lonvalue).size()-1);
                   this->addStringAttributesToVar(lonVar, hmf);
                   hmf.clear();
@@ -218,11 +217,11 @@
                hm.clear();
 
-               if ((*itt)->yvalue.hasValue())
-                  this->writeCoords(lonid, (*itt)->xvalue);
+               if ((*itt)->lonvalue.hasValue())
+                  this->writeCoords(lonid, (*itt)->lonvalue);
                else throw XMLIOUndefinedValueException
                   ("Les coordonnÃ©es de longitude (xvalue) ne sont pas dÃ©finies pour le domaine \""+domid+"\".");
 
-               if ((*itt)->xvalue.hasValue())
-                  this->writeCoords(latid, (*itt)->yvalue);
+               if ((*itt)->latvalue.hasValue())
+                  this->writeCoords(latid, (*itt)->latvalue);
                else throw XMLIOUndefinedValueException
                   ("Les coordonnÃ©es de latitude (yvalue) ne sont pas dÃ©finies pour le domaine \""+domid+"\".");
@@ -244,8 +243,8 @@
                if ((*it)->long_name.hasValue())    hm["long_name"]     = (*it)->long_name ;
                if ((*it)->unit.hasValue())         hm["units"]         = (*it)->unit;
-               if ((*it)->value.hasValue())
-               {
-                  hmf["valid_min"] = ((Array<double, 1>)(*it)->value)(0);
-                  hmf["valid_max"] = ((Array<double, 1>)(*it)->value)(((Array<double, 1>)(*it)->value).size()-1);
+               if ((*it)->zvalue.hasValue())
+               {
+                  hmf["valid_min"] = ((Array<double, 1>)(*it)->zvalue)(0);
+                  hmf["valid_max"] = ((Array<double, 1>)(*it)->zvalue)(((Array<double, 1>)(*it)->zvalue).size()-1);
                   this->addStringAttributesToVar(othvar, hmf);
                   hmf.clear();
@@ -254,6 +253,6 @@
                hm.clear();
 
-               if ((*it)->value.hasValue())
-                  this->writeCoords(axisid, (*it)->value);
+               if ((*it)->zvalue.hasValue())
+                  this->writeCoords(axisid, (*it)->zvalue);
                else throw XMLIOUndefinedValueException
                   ("Les coordonnÃ©es de l'axe \""+axisid+"\" (value) ne sont pas dÃ©finies.");
Index: XMLIO_V2/dev/dev_rv/src/XMLIO/abstract_data_output.hpp
===================================================================
--- XMLIO_V2/dev/dev_rv/src/XMLIO/abstract_data_output.hpp	(revision 134)
+++ XMLIO_V2/dev/dev_rv/src/XMLIO/abstract_data_output.hpp	(revision 137)
@@ -4,5 +4,4 @@
 namespace XMLIOSERVER
 {
-
    class CFile;
 
@@ -25,5 +24,5 @@
          }
 
-         virtual ~AbstractDataOutput()
+         virtual ~AbstractDataOutput(void)
          { /* Ne rien faire de plus */ }
 
Index: XMLIO_V2/dev/dev_rv/src/XMLIO/attribut.hpp
===================================================================
--- XMLIO_V2/dev/dev_rv/src/XMLIO/attribut.hpp	(revision 134)
+++ XMLIO_V2/dev/dev_rv/src/XMLIO/attribut.hpp	(revision 137)
@@ -17,5 +17,5 @@
 
          Attribut(void)
-            : BaseAttribut(), _hasValue(false)
+            : BaseAttribut(), _hasValue(false), value()
          { /* Ne rien faire de plus */ }
 
@@ -37,6 +37,13 @@
          operator Ctype() const
          {
-            if (!_hasValue) throw XMLIOUndefinedValueException("L'attribut \"" + this->getName() + "\" est invalide !");
+            if (!_hasValue)
+               throw XMLIOUndefinedValueException("L'attribut \"" + this->getName() + "\" est invalide !");
             return (value) ;
+         }
+
+         Ctype* getValue(void)
+         {
+            //if (!_hasValue) return(NULL); // REVOIR: 4 h de debug Ã  cause de Ã§a !!!
+            return (&value);
          }
 
@@ -60,12 +67,16 @@
 
          virtual ostream& print(std::ostream & _out) const
-         { if (_hasValue) _out << " " << getName() << "=\"" << boolalpha << value << "\"" ; return (_out) ; }
+         {
+            if (_hasValue)
+            {
+               _out << " " << getName()
+                    << "=\"" << boolalpha << value << "\"" ;
+            }
+            return (_out) ;
+         }
 
          virtual void setValue(const Ctype & value_)
          { _hasValue = true ; value = value_ ;}
 
-         Ctype* getValue(void)
-         { if (!_hasValue) return(NULL); return (&value); }
-
          virtual void getValue(Ctype & value_) const
          {
@@ -74,5 +85,5 @@
          }
 
-         virtual ~Attribut()
+         virtual ~Attribut(void)
          { /* Ne rien faire de plus */ }
 
@@ -89,15 +100,30 @@
    { _hasValue = true ; value.resize(val.shape()); value = val ; }
 
-#define PRINT_ARRAY(type)                                             \
+#define PRINT_ARRAY1(type)                                            \
    template <>                                                        \
       ostream& Attribut<Array<type, 1> >::print(ostream & _out) const \
    {                                                                  \
-      if (_hasValue) _out << " " << getName() << "=\"" << value(0);   \
-      _out << "..." << value(value.size()-1); _out << "\"" ;          \
+      if (_hasValue)                                                  \
+      _out << " " << getName() << "=\"" << value(0)                   \
+           << "(" << value.extent(0) << ")"                           \
+           << value(value.size()-1); _out << "\"" ;                   \
       return (_out) ;                                                 \
    }
 
+#define PRINT_ARRAY2(type)                                            \
+   template <>                                                        \
+      ostream& Attribut<Array<type, 2> >::print(ostream & _out) const \
+   {                                                                  \
+      if (_hasValue)                                                  \
+      _out << " " << getName() << "=\"" << value(0, 0)                \
+           << "(" << value.extent(0) << "," << value.extent(1) << ")" \
+           << value(value.extent(0)-1, value.extent(1)-1)             \
+           << "\"" ;                                                  \
+      return (_out) ;                                                 \
+   }
+
 #define SET_ARRAY_TYPE(type) \
-   PRINT_ARRAY(type)         \
+   PRINT_ARRAY1(type)        \
+   PRINT_ARRAY2(type)        \
    SET_ARRAY_DIM(type, 1)    \
    SET_ARRAY_DIM(type, 2)    \
@@ -167,6 +193,6 @@
       void Attribut<bool>::setFromString(const std::string& str)
    {
-      istringstream iss(str) ;
-      const bool val = (! iss.str().compare(string(".TRUE."))) ? true : false;
+      const bool val =
+          (str.compare(string(".TRUE.")) == 0) ? true : false;
       this->setValue(val);
    }
Index: XMLIO_V2/dev/dev_rv/src/XMLIO/axis_attribut.hpp
===================================================================
--- XMLIO_V2/dev/dev_rv/src/XMLIO/axis_attribut.hpp	(revision 134)
+++ XMLIO_V2/dev/dev_rv/src/XMLIO/axis_attribut.hpp	(revision 137)
@@ -16,5 +16,5 @@
          DECLARE_ATTR(unit          , string) ;
          DECLARE_ATTR(size          , int) ;
-         DECLARE_ATTR(value         , Array(double, 1)) ;
+         DECLARE_ATTR(zvalue        , Array(double, 1)) ;
 
          AxisAttribut(void) : AttributRegistrar()
@@ -30,5 +30,5 @@
             RegisterAttribut(&unit) ;
             RegisterAttribut(&size) ;
-            RegisterAttribut(&value) ;
+            RegisterAttribut(&zvalue) ;
          }
 
Index: XMLIO_V2/dev/dev_rv/src/XMLIO/c_interface.cpp
===================================================================
--- XMLIO_V2/dev/dev_rv/src/XMLIO/c_interface.cpp	(revision 134)
+++ XMLIO_V2/dev/dev_rv/src/XMLIO/c_interface.cpp	(revision 137)
@@ -2,93 +2,407 @@
 
 /* ********************************************************** */
-/*                      CONVERSION FUNCTION                   */
-/* ********************************************************** */
-
-static inline std::string stringXtoStd(const XString _str)
-{
-   char * const temp = new char[_str.len+1]();
-   memset(temp, '\0', _str.len+1);
-   memcpy(temp, _str.str, _str.len);
-   std::string _retstr(temp);
-   size_t d = _retstr.find_first_not_of(' ');
-   size_t f = _retstr.find_last_not_of (' ');
-
-   delete[] temp;
-   return (_retstr.substr(d, f-d+1));
-}
-
-static inline XString stringXtoStd(const std::string& _str) // Non testÃ©e
-{
-   XString _retstr = {new char[_str.size()](), _str.size()};
-   memcpy(_retstr.str, _str.c_str(), _str.size());
-   return (_retstr);
-}
-
-static inline Duration durationXtoXMLIO(const XDuration * const _xdur) // Non testÃ©e
-{
-   Duration __dur= { _xdur->year, _xdur->month , _xdur->day,
-                     _xdur->hour, _xdur->minute, _xdur->second };
-   return (__dur);
-}
-
-/* ********************************************************** */
 /*                      HANDLE INTERFACE                      */
 /* ********************************************************** */
 
-void xios_handle_create_(XHandle * const _ret, const XDType * const _dtype, const XString _id)
-{
-   // Si le handle n'est pas initialisÃ© Ã  0, on ne fait aucun traitement.
-   if (!isNullHandle(*_ret)) return;
-   std::string __id = stringXtoStd(_id);
-   switch(*_dtype)
-   {
-      /* EAXIS, EDOMAIN, EFIELD, EFILE, EGRID, GAXIS, GDOMAIN, GFIELD, GFILE, GGRID*/
+#define CASE_ELEM(elem_enum, elem_class)                    \
+         case (E##elem_enum):                               \
+            *_ret = (!C##elem_class::HasObject(__id)) ?     \
+               0 : C##elem_class::GetObject(__id);          \
+            return;                                         \
+         case (G##elem_enum):                               \
+            *_ret = (!elem_class##Group::HasObject(__id)) ? \
+               0 : elem_class##Group::GetObject(__id);      \
+            return;
+
+void xios_handle_create (XPtr * const _ret, XDType _dtype,
+                         const XString _id, XSize _id_len)
+{
+   MAKE_STRING(__id, _id, _id_len);
+   switch(_dtype)
+   {
       case (ECONTEXT):
          // Si le context n'existe pas, on retourne un handle vide/nul.
-         if (!Context::HasContext(__id)) { *_ret = NULLHANDLE; return ; }
-         _ret->data_type = *_dtype;
-         _ret->data_ptr  = Context::GetContext(__id);
+         *_ret = (!Context::HasContext(__id)) ? 0 : Context::GetContext(__id) ;
          return ;
-
+      CASE_ELEM(AXIS   , Axis);
+      CASE_ELEM(DOMAIN , Domain);
+      CASE_ELEM(FIELD  , Field);
+      CASE_ELEM(FILE   , File);
+      CASE_ELEM(GRID   , Grid);
       default :
-         *_ret = NULLHANDLE;
+         *_ret = 0;
          return ;
    };
 }
 
+#undef CASE_ELEM
+
 /* ********************************************************** */
 /*                      XML INTERFACE                         */
 /* ********************************************************** */
 
-void xios_xml_parse_file_(const XString _filename)
-{
-   std::string   __filename = stringXtoStd(_filename);
+void xios_xml_parse_file(const XString _filename, XSize _filename_len)
+{
+   MAKE_STRING(__filename, _filename, _filename_len);
    std::ifstream __istr( __filename.c_str() , std::ifstream::in );
 
    // On commence la lecture du flux de donnÃ©e xml.
    XMLNode node = XMLNode::CreateNode(__istr, Context::GetRootName());
-
    // On parse le fichier xml noeud par noeud
    // (ie on construit dynamiquement notre arbre d'objets).
    XMLParser::Parse(node);
-}
-
-void xios_xml_parse_string_(const XString _xmlcontent)
-{
-   std::string        __xmlcontent = stringXtoStd(_xmlcontent);
+
+}
+
+void xios_xml_parse_string(const XString _xmlcontent, XSize _xmlcontent_len)
+{
+   MAKE_STRING(__xmlcontent, _xmlcontent, _xmlcontent_len);
    std::istringstream __istr(__xmlcontent);
 
    // On commence la lecture du flux de donnÃ©e xml.
    XMLNode node = XMLNode::CreateNode(__istr, Context::GetRootName());
-
-   // On parse le fichier xml noeud par noeud
-   // (ie on construit dynamiquement notre arbre d'objets).
+   // On parse le document xml noeud par noeud
    XMLParser::Parse(node);
 }
-
-/* ********************************************************** */
-/*                      DATA TREATMENT INTERFACE              */
-/* ********************************************************** */
-
+/* ********************************************************** */
+/*                      CONTEXT INTERFACE                     */
+/* ********************************************************** */
+
+void xios_context_set_current (XPtr _ctx, bool _wswap)
+{
+   Context* const __ctxt = (Context*) _ctx;
+   Context::SetCurrentContext(__ctxt->getId(), _wswap) ;
+}
+
+void xios_context_create (XPtr * _ctx, const XString _ctx_id,
+                          XSize _ctx_id_len, XCalendarType _calType)
+{
+   MAKE_STRING(__ctx_id, _ctx_id, _ctx_id_len);
+   // si le contexte existe dÃ©jÃ , on arrÃªte le traitement.
+   if (Context::HasContext(__ctx_id)) { _ctx = NULL; return ; }
+
+   Context::SetCurrentContext(__ctx_id, false, false);
+   Context * context = Context::CreateObject(__ctx_id);
+   context->createDefinitions(); *_ctx = context;
+
+   if (!Context::HasContext(__ctx_id)) // Au cas oÃ¹ ...
+      std::cerr << "La crÃ©ation du contexte a Ã©chouÃ© ???" << std::endl;
+
+   switch(_calType)
+   {
+      case (D360) :
+         context->setCalendar(new D360Calendar());      return;
+      case (ALLLEAP) :
+         context->setCalendar(new AllLeapCalendar());   return;
+      case (NOLEAP) :
+         context->setCalendar(new NoLeapCalendar());    return;
+      case (JULIAN) :
+         context->setCalendar(new JulianCalendar());    return;
+      case (GREGORIAN) :
+         context->setCalendar(new GregorianCalendar()); return;
+      default:
+         std::cerr << "[context_create] Type de calendrier invalide [0-5]" << std::endl;
+         return;
+   }
+}
+
+/* ********************************************************** */
+/*                    XML TREE INTERFACE                      */
+/* ********************************************************** */
+
+#define CASE_ELEM0(elem_enum, elem_class, group_enum, group_class)              \
+      case (group_enum) : {                                                     \
+         group_class * _group = (group_class *) _parent;                        \
+         switch(_child_type) {                                                  \
+            case (group_enum) :                                                 \
+               if ((_child_id_len != -1) &&                                     \
+                   (group_class::HasObject(___child_id))) return;               \
+               *_child = (_child_id_len != -1)                                  \
+                       ? (group_class *)(&_group->createGroup(___child_id))     \
+                       : (group_class *)(&_group->createGroup());               \
+               break;                                                           \
+            case (elem_enum) :                                                  \
+               if ((_child_id_len != -1) &&                                     \
+                   (elem_class::HasObject(___child_id))) return;                \
+               *_child = (_child_id_len != -1)                                  \
+                       ? (elem_class *)(&_group->createChild(___child_id))      \
+                       : (elem_class *)(&_group->createChild());                \
+               break;                                                           \
+            default :                                                           \
+               std::cerr << "[xml_tree_add] Type enfant invalide" << std::endl; \
+         }; return; }
+
+void xios_xml_tree_add (const XPtr _parent, XDType _parent_type, XPtr * _child,
+                        XDType _child_type, const XString _child_id, XSize _child_id_len)
+{
+   string ___child_id;
+   if (_child_id_len != -1)
+   {
+      MAKE_STRING(__child_id, _child_id, _child_id_len);
+      ___child_id = __child_id;
+   }
+
+   switch (_parent_type)
+   {
+      case (EFILE) :
+      {
+         CFile * _file = (CFile *) _parent;
+         FieldGroup * _field_group = _file->createVirtualFieldGroup(_file->getId());
+         xios_xml_tree_add (_field_group, GFIELD, _child, _child_type, _child_id, _child_id_len);
+         return;
+      }
+      CASE_ELEM0(EAXIS, CAxis, GAXIS, AxisGroup);
+      CASE_ELEM0(EGRID, CGrid, GGRID, GridGroup);
+      CASE_ELEM0(EDOMAIN, CDomain, GDOMAIN, DomainGroup);
+      CASE_ELEM0(EFIELD, CField, GFIELD, FieldGroup);
+      CASE_ELEM0(EFILE, CFile, GFILE, FileGroup);
+      default :
+         std::cerr << "[xml_tree_add] Type parent invalide" << std::endl;
+         return;
+   }
+}
+
+#undef CASE_ELEM0
+
+void xios_xml_tree_show(const XString _filename, XSize _filename_len)
+{
+   string ___filename;
+   if (_filename_len != -1)
+   {
+      MAKE_STRING(__filename, _filename, _filename_len);
+      ___filename = __filename;
+   }
+   if (_filename_len == -1)
+      // On Ã©crit l'arborescence rÃ©sultante du traitement sur la sortie de log.
+      Context::ShowTree(std::clog);
+   else
+   {
+      std::ofstream __outfile (___filename.c_str());
+      // On Ã©crit l'arborescence rÃ©sultante du traitement dans le fichier.
+      Context::ShowTree(__outfile);
+      __outfile.close();
+   }
+}
+
+#undef XML_SET
+#undef XML_SET_STRING
+
+#define XML_SET(ttype, type, type_var, var, long_var)                 \
+   void xios_xml_set_##type##_##var                                   \
+                  (XPtr const _##type, XDType _dtype, type_var var){  \
+      if (_dtype >= 10 && _dtype <= 14) {                             \
+         ttype##Group * __##type = (ttype##Group *) _##type;          \
+         __##type->set_##long_var(var);                               \
+      } else {                                                        \
+         C##ttype * __##type = (C##ttype *) _##type;                  \
+         __##type->set_##long_var(var);                               \
+   }}
+
+
+#define XML_SET_STRING(ttype, type, var, long_var)              \
+   void xios_xml_set_##type##_##var(XPtr const _##type,         \
+      XDType _dtype, const XString _##var, XSize _##var##_len) {\
+      MAKE_STRING(___##var, _##var, _##var##_len);              \
+      if (_dtype >= 10 && _dtype <= 14) {                       \
+         ttype##Group * __##type = (ttype##Group *) _##type;    \
+         __##type->set_##long_var(___##var);                    \
+      } else {                                                  \
+         C##ttype * __##type = (C##ttype *) _##type;            \
+         __##type->set_##long_var(___##var);                    \
+   }}
+
+// Attributs de field ou field_group //
+XML_SET_STRING(Field, field, name, name)
+XML_SET_STRING(Field, field, sname, standard_name)
+XML_SET_STRING(Field, field, lname, long_name)
+XML_SET_STRING(Field, field, unit, unit)
+XML_SET_STRING(Field, field, operation, operation)
+
+void xios_xml_set_field_freq_op(XPtr const _field, XDType _dtype,
+                                double year, double month, double day,
+                                double hour, double minute, double second)
+{
+   const Duration _dur   = {year, month, day, hour, minute, second};
+   if (_dtype >= 10 && _dtype <= 14)
+   {
+      FieldGroup * __field = (FieldGroup *) _field;
+      __field->set_freq_op(_dur);
+   } else {
+      CField * __field = (CField *) _field;
+      __field->set_freq_op(_dur);
+   }
+}
+
+XML_SET(Field, field, int, level, level)
+XML_SET(Field, field, int, prec, prec)
+XML_SET(Field, field, bool, enabled, enabled)
+
+XML_SET_STRING(Field, field, dref, domain_ref)
+XML_SET_STRING(Field, field, aref, axis_ref)
+XML_SET_STRING(Field, field, gref, grid_ref)
+XML_SET_STRING(Field, field, zref, zoom_ref)
+XML_SET_STRING(Field, field, fref, field_ref)
+
+// Attributs de file ou file_group
+XML_SET_STRING(File, file, name, name)
+XML_SET_STRING(File, file, description, description)
+
+void xios_xml_set_file_output_freq(XPtr const _file, XDType _dtype,
+                                   double year, double month, double day,
+                                   double hour, double minute, double second)
+{
+   const Duration _dur   = {year, month, day, hour, minute, second};
+   if (_dtype >= 10 && _dtype <= 14)
+   {
+      FileGroup * __file = (FileGroup *) _file;
+      __file->set_output_freq(_dur);
+   } else {
+      CFile * __file= (CFile *) _file;
+      __file->set_output_freq(_dur);
+   }
+}
+
+XML_SET(File, file, int, olevel, output_level)
+XML_SET(File, file, bool, enabled, enabled)
+
+// Attributs de grid ou grid_group
+XML_SET_STRING(Grid, grid, name, name)
+XML_SET_STRING(Grid, grid, description, description)
+XML_SET_STRING(Grid, grid, dref, domain_ref)
+XML_SET_STRING(Grid, grid, aref, axis_ref)
+
+// Attribut de axis ou axis group
+XML_SET_STRING(Axis, axis, name, name)
+XML_SET_STRING(Axis, axis, sname, standard_name)
+XML_SET_STRING(Axis, axis, lname, long_name)
+
+XML_SET_STRING(Axis, axis, unit, unit)
+
+void xios_xml_set_axis_value(XPtr const _axis, XDType _dtype, double value[], XSize value_size)
+{
+   Array<double, 1> __arr(value, shape(value_size), neverDeleteData, FortranArray<1>());
+   if (_dtype >= 10 && _dtype <= 14)
+   {
+      AxisGroup * __axis = (AxisGroup *) _axis;
+      __axis->set_size(value_size);
+      __axis->zvalue.getValue()->resize(value_size);
+      __axis->set_zvalue(__arr);
+   } else {
+      CAxis * __axis = (CAxis *) _axis;
+      __axis->set_size(value_size);
+      __axis->zvalue.getValue()->resize(value_size);
+      __axis->set_zvalue(__arr);
+   }
+}
+
+// Attribut de domain ou domain_group
+XML_SET_STRING(Domain, domain, name, name)
+XML_SET_STRING(Domain, domain, sname, standard_name)
+XML_SET_STRING(Domain, domain, lname, long_name)
+
+XML_SET(Domain, domain, int, niglo, ni_glo)
+XML_SET(Domain, domain, int, njglo, nj_glo)
+
+XML_SET(Domain, domain, int, ibegin, ibegin)
+XML_SET(Domain, domain, int, iend, iend)
+XML_SET(Domain, domain, int, ni, ni)
+
+XML_SET(Domain, domain, int, jbegin, jbegin)
+XML_SET(Domain, domain, int, jend, jend)
+XML_SET(Domain, domain, int, nj, nj)
+
+void xios_xml_set_domain_mask(XPtr const _domain, XDType _dtype, bool * _mask , XSize _maskXsize, XSize _maskYsize)
+{
+   Array<bool, 2> __arr(_mask, shape(_maskXsize, _maskYsize), neverDeleteData, FortranArray<2>());
+   if (_dtype >= 10 && _dtype <= 14)
+   {
+      DomainGroup * __domain = (DomainGroup *) _domain;
+      __domain->mask.getValue()->resize(shape(_maskXsize, _maskYsize));
+      __domain->set_mask(__arr);
+   } else {
+      CDomain * __domain = (CDomain *) _domain;
+      __domain->mask.getValue()->resize(shape(_maskXsize, _maskYsize));
+      __domain->set_mask(__arr);
+   }
+
+}
+
+XML_SET(Domain, domain, int, ddim, data_dim)
+XML_SET(Domain, domain, int, dni, data_ni)
+XML_SET(Domain, domain, int, dnj, data_nj)
+XML_SET(Domain, domain, int, dibegin, data_ibegin)
+XML_SET(Domain, domain, int, djbegin, data_jbegin)
+
+XML_SET(Domain, domain, int, dnindex, data_n_index)
+
+void xios_xml_set_domain_diindex(XPtr const _domain, XDType _dtype, int _diindex[], XSize _diindex_size)
+{
+   Array<int, 1> __arr(_diindex, shape(_diindex_size), neverDeleteData, FortranArray<1>());
+   if (_dtype >= 10 && _dtype <= 14)
+   {
+      DomainGroup * __domain = (DomainGroup *) _domain;
+      __domain->data_i_index.getValue()->resize(_diindex_size);
+      __domain->set_data_i_index(__arr);
+   } else {
+      CDomain * __domain = (CDomain *) _domain;
+      __domain->data_i_index.getValue()->resize(_diindex_size);
+      __domain->set_data_i_index(__arr);
+   }
+}
+
+void xios_xml_set_domain_djindex(XPtr const _domain, XDType _dtype, int _djindex[], XSize _djindex_size)
+{
+   Array<int, 1> __arr(_djindex, shape(_djindex_size), neverDeleteData, FortranArray<1>());
+   if (_dtype >= 10 && _dtype <= 14)
+   {
+      DomainGroup * __domain = (DomainGroup *) _domain;
+      __domain->data_j_index.getValue()->resize(_djindex_size);
+      __domain->set_data_j_index(__arr);
+   } else {
+      CDomain * __domain = (CDomain *) _domain;
+      __domain->data_j_index.getValue()->resize(_djindex_size);
+      __domain->set_data_j_index(__arr);
+   }
+}
+
+void xios_xml_set_domain_lonvalue(XPtr const _domain, XDType _dtype, double _lonvalue[], XSize _lonvalue_Xsize, XSize _lonvalue_Ysize)
+{
+   XSize __size = (_lonvalue_Ysize == -1)
+                  ? _lonvalue_Xsize : (_lonvalue_Ysize*_lonvalue_Xsize);
+   Array<double, 1> __arr(_lonvalue, shape(__size), neverDeleteData, FortranArray<1>());
+   if (_dtype >= 10 && _dtype <= 14)
+   {
+      DomainGroup * __domain = (DomainGroup *) _domain;
+      __domain->lonvalue.getValue()->resize(__size);
+      __domain->set_lonvalue(__arr);
+   } else {
+      CDomain * __domain = (CDomain *) _domain;
+      __domain->lonvalue.getValue()->resize(__size);
+      __domain->set_lonvalue(__arr);
+   }
+}
+
+void xios_xml_set_domain_latvalue(XPtr const _domain, XDType _dtype, double _latvalue[], XSize _latvalue_Xsize, XSize _latvalue_Ysize)
+{
+   XSize __size = (_latvalue_Ysize == -1)
+                  ? _latvalue_Xsize : (_latvalue_Ysize*_latvalue_Xsize);
+   Array<double, 1> __arr(_latvalue, shape(__size), neverDeleteData, FortranArray<1>());
+   if (_dtype >= 10 && _dtype <= 14)
+   {
+      DomainGroup * __domain = (DomainGroup *) _domain;
+      __domain->latvalue.getValue()->resize(__size);
+      __domain->set_latvalue(__arr);
+   } else {
+      CDomain * __domain = (CDomain *) _domain;
+      __domain->latvalue.getValue()->resize(__size);
+      __domain->set_latvalue(__arr);
+   }
+}
+
+XML_SET_STRING(Domain, domain, domtype, domtype)
+
+/* ********************************************************** */
+/*                   DATA TREATMENT INTERFACE                 */
+/* ********************************************************** */
 static std::vector<DataTreatment *> AllDataTreatment;
 
@@ -101,18 +415,12 @@
 }
 
-void xios_dtreatment_new_(XHandle * const _dt, const XHandle * const _hd)
+void xios_dtreatment_start(XPtr const _context, XFileType filetype)
 {
    static bool called = false;
-
-   // Si le handle de traitement n'est pas initialisÃ© Ã  0, on ne fait aucun traitement.
-   if (!isNullHandle(*_dt) || (_hd->data_type != ECONTEXT)) return;
-   Context       * const __ctxt = (Context*) _hd->data_ptr;
+   Context       * const __ctxt = (Context *) _context;
    DataTreatment * const __dtrt =__ctxt->setDataTreatment<DataTreatment>();
-
    if (__dtrt != NULL)
    {
       AllDataTreatment.push_back(__dtrt);
-      _dt->data_type = DTREATMENT;
-      _dt->data_ptr  = __dtrt;
       if (!called)
       {
@@ -123,64 +431,5 @@
 }
 
-void xios_dtreatment_create_files_and_headers_(const XHandle * const _hd, const XFileType * const _ft)
-{
-   if (isNullHandle(*_hd) || (_hd->data_type != DTREATMENT)) return;
-   DataTreatment * const __dt = (DataTreatment*)_hd->data_ptr;
-   switch(*_ft)
-   {
-      case (NETCDF4):
-         __dt->createDataOutput<NetCDF4DataOutput>();
-         return;
-      // Autres formats de fichiers si disponibles...
-      default:
-         return;
-   }
-}
-
-/* ********************************************************** */
-/*                      CONTEXT INTERFACE                     */
-/* ********************************************************** */
-
-void xios_context_set_current_(const XHandle * const _ctxt, const bool * const _wswap)
-{
-   bool __wswap = (_wswap == NULL) ? false : *_wswap;
-   if (isNullHandle(*_ctxt) || (_ctxt->data_type != ECONTEXT)) return;
-   Context* const __ctxt = (Context*) _ctxt->data_ptr;
-   Context::SetCurrentContext(__ctxt->getId(), __wswap) ;
-}
-
-void xios_context_get_current_ (XHandle * _ctxt)
-{
-   // Si le handle de traitement n'est pas initialisÃ© Ã  0, on ne fait aucun traitement.
-   if ((Context::GetAllListObject().size() == 0) ||
-         !isNullHandle(*_ctxt)) return;
-   _ctxt->data_type = ECONTEXT;
-   _ctxt->data_ptr  = Context::GetCurrentContext();
-}
-
-void xios_context_get_calendar_(const XHandle * const _ctxt, XHandle * _cal)
-{
-   if (!isNullHandle(*_cal)  || isNullHandle(*_ctxt) ||
-      (_ctxt->data_type != ECONTEXT)) return;
-   Context* const __ctxt = (Context*) _ctxt->data_ptr;
-   AbstractCalendar * const __cal  = __ctxt->getCalendar();
-   if (__cal != NULL)
-   {
-      _cal->data_type = CALENDAR;
-      _cal->data_ptr  = __cal;
-   }
-}
-
-/* ********************************************************** */
-/*                      CALENDAR INTERFACE                    */
-/* ********************************************************** */
-
-void xios_calendar_set_timestep_(const XHandle * const _cal, const XDuration * const _dur)
-{
-   if (isNullHandle(*_cal) || (_cal->data_type != CALENDAR)) return;
-   const Duration __dur = durationXtoXMLIO(_dur);
-   AbstractCalendar * const __cal = (AbstractCalendar*) _cal->data_ptr;
-   __cal->setTimeStep(__dur);
-}
-
+#undef XML_SET
+#undef XML_SET_STRING
 #undef isNullHandle
Index: XMLIO_V2/dev/dev_rv/src/XMLIO/c_interface.f03
===================================================================
--- XMLIO_V2/dev/dev_rv/src/XMLIO/c_interface.f03	(revision 137)
+++ XMLIO_V2/dev/dev_rv/src/XMLIO/c_interface.f03	(revision 137)
@@ -0,0 +1,978 @@
+! ----------------------------------------------- !
+!                   IXHANDLE                      !
+!  Gestion des handle (rÃ©fÃ©rences sur objets C++) !
+! ----------------------------------------------- !
+MODULE IXHANDLE
+   USE ISO_C_BINDING
+
+   ! Ne jamais modifier les valeurs internes de ce type dans le code fortran.
+   TYPE XHandle
+      INTEGER(kind = C_INT) :: dtype
+      INTEGER(kind = C_INT) :: daddr
+   END TYPE XHandle
+
+   ! enum XDType
+   INTEGER(kind = C_INT), PARAMETER  :: NOTYPE = 0
+   INTEGER(kind = C_INT), PARAMETER  :: DTREATMENT = 1, DDATE = 2, CALENDAR = 3, ECONTEXT = 4
+   INTEGER(kind = C_INT), PARAMETER  :: EAXIS = 5 , EDOMAIN = 6 , EFIELD = 7 , EFILE = 8 , EGRID = 9
+   INTEGER(kind = C_INT), PARAMETER  :: GAXIS = 10, GDOMAIN = 11, GFIELD = 12, GFILE = 13, GGRID = 14
+
+   ! Autres constantes
+   TYPE(XHandle)  , PARAMETER :: NULLHANDLE = XHandle(0, 0)
+
+   INTERFACE ! Ne pas appeler directement/Interface FORTRAN 2003 <-> C99
+
+      SUBROUTINE xios_handle_create(ret, dtype, idt, idt_size) bind(C)
+         import C_CHAR, C_INT
+         INTEGER  (kind = C_INT)                :: ret
+         INTEGER  (kind = C_INT), VALUE         :: dtype
+         CHARACTER(kind = C_CHAR), DIMENSION(*) :: idt
+         INTEGER  (kind = C_INT), VALUE         :: idt_size
+      END SUBROUTINE xios_handle_create
+
+   END INTERFACE
+
+   CONTAINS
+
+   ! Permet de crÃ©er un handle sur un objet c++ Ã  partir d'un identifiant (dÃ©pend du contexte).
+   SUBROUTINE handle_create(ret, dtype, idt)
+         TYPE(XHandle), INTENT(OUT)     :: ret
+         INTEGER, INTENT(IN)            :: dtype
+         CHARACTER(len = *), INTENT(IN) :: idt
+      CALL xios_handle_create(ret%daddr, dtype, idt, len(idt))
+
+      IF (ret%daddr == 0) THEN
+         PRINT *, "(F2003 interface) Impossible de crÃ©er un handle sur l'Ã©lÃ©ment !"
+         STOP
+      ELSE
+         ret%dtype = dtype
+      END IF
+   END SUBROUTINE handle_create
+
+END MODULE IXHANDLE
+
+! --------------------------------------------- !
+!                   ICALENDAR                   !
+!        Prise en charge des calendriers        !
+! --------------------------------------------- !
+
+MODULE ICALENDAR
+   USE ISO_C_BINDING
+
+   ! enum XCalendarType
+   INTEGER(kind = C_INT), PARAMETER  :: D360 = 0 , ALLLEAP = 1 , NOLEAP = 2 , JULIAN = 3 , GREGORIAN = 4
+
+   TYPE XDate
+      INTEGER :: year, month, day, hour, minute, second
+   END TYPE XDate
+
+   TYPE XDuration
+      REAL(kind = 8) :: year, month, day, hour, minute, second
+   END TYPE XDuration
+
+END MODULE ICALENDAR
+
+! --------------------------------------------- !
+!                    IXMLTREE                   !
+!         Modification des document XML         !
+! --------------------------------------------- !
+MODULE IXMLTREE
+   USE ISO_C_BINDING
+
+   INTERFACE ! Ne pas appeler directement/Interface FORTRAN 2003 <-> C99
+
+      SUBROUTINE xios_xml_tree_add(parent_, parent_type, child_, child_type, child_id, child_id_size) bind(C)
+         import C_CHAR, C_INT
+         INTEGER  (kind = C_INT), VALUE         :: parent_
+         INTEGER  (kind = C_INT), VALUE         :: parent_type
+         INTEGER  (kind = C_INT)                :: child_
+         INTEGER  (kind = C_INT), VALUE         :: child_type
+         CHARACTER(kind = C_CHAR), DIMENSION(*) :: child_id
+         INTEGER  (kind = C_INT), VALUE         :: child_id_size
+      END SUBROUTINE xios_xml_tree_add
+
+      SUBROUTINE  xios_xml_tree_show(filename, filename_size) bind(C)
+         import C_CHAR, C_INT
+         CHARACTER(kind = C_CHAR), DIMENSION(*) :: filename
+         INTEGER  (kind = C_INT), VALUE         :: filename_size
+      END SUBROUTINE xios_xml_tree_show
+
+      !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+      ! Attribut des Ã©lÃ©ments de type field et field_group !
+      !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+      SUBROUTINE  xios_xml_set_field_name(field, ftype, fname, fname_size) bind(C)
+         import C_CHAR, C_INT
+         INTEGER  (kind = C_INT), VALUE         :: field, ftype
+         CHARACTER(kind = C_CHAR), DIMENSION(*) :: fname
+         INTEGER  (kind = C_INT), VALUE         :: fname_size
+      END SUBROUTINE xios_xml_set_field_name
+
+      SUBROUTINE  xios_xml_set_field_sname(field, ftype, fsname, fsname_size) bind(C)
+         import C_CHAR, C_INT
+         INTEGER  (kind = C_INT), VALUE         :: field, ftype
+         CHARACTER(kind = C_CHAR), DIMENSION(*) :: fsname
+         INTEGER  (kind = C_INT), VALUE         :: fsname_size
+      END SUBROUTINE xios_xml_set_field_sname
+
+      SUBROUTINE  xios_xml_set_field_lname(field, ftype, flname, flname_size) bind(C)
+         import C_CHAR, C_INT
+         INTEGER  (kind = C_INT), VALUE         :: field, ftype
+         CHARACTER(kind = C_CHAR), DIMENSION(*) :: flname
+         INTEGER  (kind = C_INT), VALUE         :: flname_size
+      END SUBROUTINE xios_xml_set_field_lname
+
+      SUBROUTINE  xios_xml_set_field_unit(field, ftype, funit, funit_size) bind(C)
+         import C_CHAR, C_INT
+         INTEGER  (kind = C_INT), VALUE         :: field, ftype
+         CHARACTER(kind = C_CHAR), DIMENSION(*) :: funit
+         INTEGER  (kind = C_INT), VALUE         :: funit_size
+      END SUBROUTINE xios_xml_set_field_unit
+
+      SUBROUTINE  xios_xml_set_field_operation(field, ftype, foperation, foperation_size) bind(C)
+         import C_CHAR, C_INT
+         INTEGER  (kind = C_INT), VALUE         :: field, ftype
+         CHARACTER(kind = C_CHAR), DIMENSION(*) :: foperation
+         INTEGER  (kind = C_INT), VALUE         :: foperation_size
+      END SUBROUTINE xios_xml_set_field_operation
+
+      SUBROUTINE  xios_xml_set_field_freq_op(field, ftype, year, month, day, hour, minute, second) bind(C)
+         import C_DOUBLE, C_INT
+         INTEGER (kind = C_INT), VALUE  :: field, ftype
+         REAL (kind = C_DOUBLE), VALUE  :: year, month, day, hour, minute, second
+      END SUBROUTINE xios_xml_set_field_freq_op
+
+      SUBROUTINE  xios_xml_set_field_level(field, ftype, flevel) bind(C)
+         import C_INT
+         INTEGER (kind = C_INT), VALUE  :: field, ftype
+         INTEGER (kind = C_INT), VALUE  :: flevel
+      END SUBROUTINE xios_xml_set_field_level
+
+      SUBROUTINE  xios_xml_set_field_prec(field, ftype, fprec) bind(C)
+         import C_INT
+         INTEGER (kind = C_INT), VALUE  :: field, ftype
+         INTEGER (kind = C_INT), VALUE  :: fprec
+      END SUBROUTINE xios_xml_set_field_prec
+
+      SUBROUTINE  xios_xml_set_field_enabled(field, ftype, fenabled) bind(C)
+         import C_INT, C_BOOL
+         INTEGER (kind = C_INT), VALUE  :: field, ftype
+         LOGICAL (kind = C_BOOL), VALUE :: fenabled
+      END SUBROUTINE xios_xml_set_field_enabled
+
+      SUBROUTINE  xios_xml_set_field_dref(field, ftype, fdref, fdref_size) bind(C)
+         import C_CHAR, C_INT
+         INTEGER  (kind = C_INT), VALUE         :: field, ftype
+         CHARACTER(kind = C_CHAR), DIMENSION(*) :: fdref
+         INTEGER  (kind = C_INT), VALUE         :: fdref_size
+      END SUBROUTINE xios_xml_set_field_dref
+
+      SUBROUTINE  xios_xml_set_field_aref(field, ftype, faref, faref_size) bind(C)
+         import C_CHAR, C_INT
+         INTEGER  (kind = C_INT), VALUE         :: field, ftype
+         CHARACTER(kind = C_CHAR), DIMENSION(*) :: faref
+         INTEGER  (kind = C_INT), VALUE         :: faref_size
+      END SUBROUTINE xios_xml_set_field_aref
+
+      SUBROUTINE  xios_xml_set_field_gref(field, ftype, fgref, fgref_size) bind(C)
+         import C_CHAR, C_INT
+         INTEGER  (kind = C_INT), VALUE         :: field, ftype
+         CHARACTER(kind = C_CHAR), DIMENSION(*) :: fgref
+         INTEGER  (kind = C_INT), VALUE         :: fgref_size
+      END SUBROUTINE xios_xml_set_field_gref
+
+      SUBROUTINE  xios_xml_set_field_zref(field, ftype, fzref, fzref_size) bind(C)
+         import C_CHAR, C_INT
+         INTEGER  (kind = C_INT), VALUE         :: field, ftype
+         CHARACTER(kind = C_CHAR), DIMENSION(*) :: fzref
+         INTEGER  (kind = C_INT), VALUE         :: fzref_size
+      END SUBROUTINE xios_xml_set_field_zref
+
+      SUBROUTINE  xios_xml_set_field_fref(field, ftype, ffref, ffref_size) bind(C)
+         import C_CHAR, C_INT
+         INTEGER  (kind = C_INT), VALUE         :: field, ftype
+         CHARACTER(kind = C_CHAR), DIMENSION(*) :: ffref
+         INTEGER  (kind = C_INT), VALUE         :: ffref_size
+      END SUBROUTINE xios_xml_set_field_fref
+
+      !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+      ! Attribut des Ã©lÃ©ments de type file et file_group !
+      !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+      SUBROUTINE  xios_xml_set_file_name(file_, ftype, fname, fname_size) bind(C)
+         import C_CHAR, C_INT
+         INTEGER  (kind = C_INT), VALUE         :: file_, ftype
+         CHARACTER(kind = C_CHAR), DIMENSION(*) :: fname
+         INTEGER  (kind = C_INT), VALUE         :: fname_size
+      END SUBROUTINE xios_xml_set_file_name
+
+      SUBROUTINE  xios_xml_set_file_description(file_, ftype, fdescription, fdescription_size) bind(C)
+         import C_CHAR, C_INT
+         INTEGER  (kind = C_INT), VALUE         :: file_, ftype
+         CHARACTER(kind = C_CHAR), DIMENSION(*) :: fdescription
+         INTEGER  (kind = C_INT), VALUE         :: fdescription_size
+      END SUBROUTINE xios_xml_set_file_description
+
+      SUBROUTINE  xios_xml_set_file_output_freq(file_, ftype, year, month, day, hour, minute, second) bind(C)
+         import C_DOUBLE, C_INT
+         INTEGER (kind = C_INT), VALUE :: file_, ftype
+         REAL (kind = C_DOUBLE), VALUE :: year, month, day, hour, minute, second
+      END SUBROUTINE xios_xml_set_file_output_freq
+
+      SUBROUTINE  xios_xml_set_file_olevel(file_, ftype, folevel) bind(C)
+         import C_INT
+         INTEGER (kind = C_INT), VALUE :: file_, ftype
+         INTEGER (kind = C_INT), VALUE :: folevel
+      END SUBROUTINE xios_xml_set_file_olevel
+
+      SUBROUTINE  xios_xml_set_file_enabled(file_, ftype, fenabled) bind(C)
+         import C_INT, C_BOOL
+         INTEGER (kind = C_INT), VALUE  :: file_, ftype
+         LOGICAL (kind = C_BOOL), VALUE :: fenabled
+      END SUBROUTINE xios_xml_set_file_enabled
+
+      !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+      ! Attribut des Ã©lÃ©ments de type grid et grid_group !
+      !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+      SUBROUTINE  xios_xml_set_grid_name(grid, ftype, gname, gname_size) bind(C)
+         import C_CHAR, C_INT
+         INTEGER  (kind = C_INT), VALUE         :: grid, ftype
+         CHARACTER(kind = C_CHAR), DIMENSION(*) :: gname
+         INTEGER  (kind = C_INT), VALUE         :: gname_size
+      END SUBROUTINE xios_xml_set_grid_name
+
+      SUBROUTINE  xios_xml_set_grid_description(grid, ftype, gdescription, gdescription_size) bind(C)
+         import C_CHAR, C_INT
+         INTEGER  (kind = C_INT), VALUE         :: grid, ftype
+         CHARACTER(kind = C_CHAR), DIMENSION(*) :: gdescription
+         INTEGER  (kind = C_INT), VALUE         :: gdescription_size
+      END SUBROUTINE xios_xml_set_grid_description
+
+      SUBROUTINE  xios_xml_set_grid_dref(grid, ftype, dref, dref_size) bind(C)
+         import C_CHAR, C_INT
+         INTEGER  (kind = C_INT), VALUE         :: grid, ftype
+         CHARACTER(kind = C_CHAR), DIMENSION(*) :: dref
+         INTEGER  (kind = C_INT), VALUE         :: dref_size
+      END SUBROUTINE xios_xml_set_grid_dref
+
+      SUBROUTINE  xios_xml_set_grid_aref(grid, ftype, aref, aref_size) bind(C)
+         import C_CHAR, C_INT
+         INTEGER  (kind = C_INT), VALUE         :: grid, ftype
+         CHARACTER(kind = C_CHAR), DIMENSION(*) :: aref
+         INTEGER  (kind = C_INT), VALUE         :: aref_size
+      END SUBROUTINE xios_xml_set_grid_aref
+
+      !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+      ! Attribut des Ã©lÃ©ments de type axis et axis_group !
+      !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+      SUBROUTINE  xios_xml_set_axis_name(axis, ftype, aname, aname_size) bind(C)
+         import C_CHAR, C_INT
+         INTEGER  (kind = C_INT), VALUE         :: axis, ftype
+         CHARACTER(kind = C_CHAR), DIMENSION(*) :: aname
+         INTEGER  (kind = C_INT), VALUE         :: aname_size
+      END SUBROUTINE xios_xml_set_axis_name
+
+      SUBROUTINE  xios_xml_set_axis_sname(axis, ftype, asname, asname_size) bind(C)
+         import C_CHAR, C_INT
+         INTEGER  (kind = C_INT), VALUE         :: axis, ftype
+         CHARACTER(kind = C_CHAR), DIMENSION(*) :: asname
+         INTEGER  (kind = C_INT), VALUE         :: asname_size
+      END SUBROUTINE xios_xml_set_axis_sname
+
+      SUBROUTINE  xios_xml_set_axis_lname(axis, ftype, alname, alname_size) bind(C)
+         import C_CHAR, C_INT
+         INTEGER  (kind = C_INT), VALUE         :: axis, ftype
+         CHARACTER(kind = C_CHAR), DIMENSION(*) :: alname
+         INTEGER  (kind = C_INT), VALUE         :: alname_size
+      END SUBROUTINE xios_xml_set_axis_lname
+
+      SUBROUTINE  xios_xml_set_axis_unit(axis, ftype, aunit, aunit_size) bind(C)
+         import C_CHAR, C_INT
+         INTEGER  (kind = C_INT), VALUE         :: axis, ftype
+         CHARACTER(kind = C_CHAR), DIMENSION(*) :: aunit
+         INTEGER  (kind = C_INT), VALUE         :: aunit_size
+      END SUBROUTINE xios_xml_set_axis_unit
+
+      SUBROUTINE  xios_xml_set_axis_value(axis, ftype, avalue, avalue_size) bind(C)
+         import C_DOUBLE, C_INT
+         INTEGER  (kind = C_INT), VALUE      :: axis, ftype
+         REAL(kind = C_DOUBLE), DIMENSION(*) :: avalue
+         INTEGER  (kind = C_INT), VALUE      :: avalue_size
+      END SUBROUTINE xios_xml_set_axis_value
+
+      !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+      ! Attribut des Ã©lÃ©ments de type domain et domain_group !
+      !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+      SUBROUTINE  xios_xml_set_domain_name(domain, ftype, dname, dname_size) bind(C)
+         import C_CHAR, C_INT
+         INTEGER  (kind = C_INT), VALUE         :: domain, ftype
+         CHARACTER(kind = C_CHAR), DIMENSION(*) :: dname
+         INTEGER  (kind = C_INT), VALUE         :: dname_size
+      END SUBROUTINE xios_xml_set_domain_name
+
+      SUBROUTINE  xios_xml_set_domain_sname(domain, ftype, dsname, dsname_size) bind(C)
+         import C_CHAR, C_INT
+         INTEGER  (kind = C_INT), VALUE         :: domain, ftype
+         CHARACTER(kind = C_CHAR), DIMENSION(*) :: dsname
+         INTEGER  (kind = C_INT), VALUE         :: dsname_size
+      END SUBROUTINE xios_xml_set_domain_sname
+
+      SUBROUTINE  xios_xml_set_domain_lname(domain, ftype, dlname, dlname_size) bind(C)
+         import C_CHAR, C_INT
+         INTEGER  (kind = C_INT), VALUE         :: domain, ftype
+         CHARACTER(kind = C_CHAR), DIMENSION(*) :: dlname
+         INTEGER  (kind = C_INT), VALUE         :: dlname_size
+      END SUBROUTINE xios_xml_set_domain_lname
+
+      SUBROUTINE  xios_xml_set_domain_niglo(domain, ftype, niglo) bind(C)
+         import C_INT
+         INTEGER  (kind = C_INT), VALUE :: domain, ftype, niglo
+      END SUBROUTINE xios_xml_set_domain_niglo
+
+      SUBROUTINE  xios_xml_set_domain_njglo(domain, ftype, njglo) bind(C)
+         import C_INT
+         INTEGER  (kind = C_INT), VALUE :: domain, ftype, njglo
+      END SUBROUTINE xios_xml_set_domain_njglo
+
+      SUBROUTINE  xios_xml_set_domain_ibegin(domain, ftype, ibegin) bind(C)
+         import C_INT
+         INTEGER  (kind = C_INT), VALUE :: domain, ftype, ibegin
+      END SUBROUTINE xios_xml_set_domain_ibegin
+
+      SUBROUTINE  xios_xml_set_domain_iend(domain, ftype, iend) bind(C)
+         import C_INT
+         INTEGER  (kind = C_INT), VALUE :: domain, ftype, iend
+      END SUBROUTINE xios_xml_set_domain_iend
+
+      SUBROUTINE  xios_xml_set_domain_ni(domain, ftype, ni) bind(C)
+         import C_INT
+         INTEGER  (kind = C_INT), VALUE :: domain, ftype, ni
+      END SUBROUTINE xios_xml_set_domain_ni
+
+      SUBROUTINE  xios_xml_set_domain_jbegin(domain, ftype, jbegin) bind(C)
+         import C_INT
+         INTEGER  (kind = C_INT), VALUE :: domain, ftype, jbegin
+      END SUBROUTINE xios_xml_set_domain_jbegin
+
+      SUBROUTINE  xios_xml_set_domain_jend(domain, ftype, jend) bind(C)
+         import C_INT
+         INTEGER  (kind = C_INT), VALUE :: domain, ftype, jend
+      END SUBROUTINE xios_xml_set_domain_jend
+
+      SUBROUTINE  xios_xml_set_domain_nj(domain, ftype, nj) bind(C)
+         import C_INT
+         INTEGER  (kind = C_INT), VALUE :: domain, ftype, nj
+      END SUBROUTINE xios_xml_set_domain_nj
+
+      SUBROUTINE  xios_xml_set_domain_mask(domain, ftype, mask, maskXsize, maskYsize) bind(C)
+         import C_BOOL, C_INT
+         INTEGER  (kind = C_INT), VALUE       :: domain, ftype
+         LOGICAL(kind = C_BOOL), DIMENSION(*) :: mask
+         INTEGER  (kind = C_INT), VALUE       :: maskXsize, maskYsize
+      END SUBROUTINE xios_xml_set_domain_mask
+
+      SUBROUTINE  xios_xml_set_domain_ddim(domain, ftype, dadim) bind(C)
+         import C_INT
+         INTEGER  (kind = C_INT), VALUE :: domain, ftype, dadim
+      END SUBROUTINE xios_xml_set_domain_ddim
+
+      SUBROUTINE  xios_xml_set_domain_dni(domain, ftype, dni) bind(C)
+         import C_INT
+         INTEGER  (kind = C_INT), VALUE :: domain, ftype, dni
+      END SUBROUTINE xios_xml_set_domain_dni
+
+      SUBROUTINE  xios_xml_set_domain_dnj(domain, ftype, dnj) bind(C)
+         import C_INT
+         INTEGER  (kind = C_INT), VALUE :: domain, ftype, dnj
+      END SUBROUTINE xios_xml_set_domain_dnj
+
+      SUBROUTINE  xios_xml_set_domain_dibegin(domain, ftype, dibegin) bind(C)
+         import C_INT
+         INTEGER  (kind = C_INT), VALUE :: domain, ftype, dibegin
+      END SUBROUTINE xios_xml_set_domain_dibegin
+
+      SUBROUTINE  xios_xml_set_domain_djbegin(domain, ftype, djbegin) bind(C)
+         import C_INT
+         INTEGER  (kind = C_INT), VALUE :: domain, ftype, djbegin
+      END SUBROUTINE xios_xml_set_domain_djbegin
+
+      SUBROUTINE  xios_xml_set_domain_dnindex(domain, ftype, dnindex) bind(C)
+         import C_INT
+         INTEGER  (kind = C_INT), VALUE :: domain, ftype, dnindex
+      END SUBROUTINE xios_xml_set_domain_dnindex
+
+      SUBROUTINE  xios_xml_set_domain_diindex(domain, ftype, diindex, diindex_size) bind(C)
+         import C_INT
+         INTEGER  (kind = C_INT), VALUE      :: domain, ftype
+         INTEGER(kind = C_INT), DIMENSION(*) :: diindex
+         INTEGER  (kind = C_INT), VALUE      :: diindex_size
+      END SUBROUTINE xios_xml_set_domain_diindex
+
+      SUBROUTINE  xios_xml_set_domain_djindex(domain, ftype, djindex, djindex_size) bind(C)
+         import C_INT
+         INTEGER  (kind = C_INT), VALUE      :: domain, ftype
+         INTEGER(kind = C_INT), DIMENSION(*) :: djindex
+         INTEGER  (kind = C_INT), VALUE      :: djindex_size
+      END SUBROUTINE xios_xml_set_domain_djindex
+
+      SUBROUTINE  xios_xml_set_domain_lonvalue(domain, ftype, lonvalue, lonvalue_xsize, lonvalue_ysize) bind(C)
+         import C_DOUBLE, C_INT
+         INTEGER  (kind = C_INT), VALUE      :: domain, ftype
+         REAL(kind = C_DOUBLE), DIMENSION(*) :: lonvalue
+         INTEGER  (kind = C_INT), VALUE      :: lonvalue_xsize, lonvalue_ysize
+      END SUBROUTINE xios_xml_set_domain_lonvalue
+
+      SUBROUTINE  xios_xml_set_domain_latvalue(domain, ftype, latvalue, latvalue_xsize, lonvalue_ysize) bind(C)
+         import C_DOUBLE, C_INT
+         INTEGER  (kind = C_INT), VALUE      :: domain, ftype
+         REAL(kind = C_DOUBLE), DIMENSION(*) :: latvalue
+         INTEGER  (kind = C_INT), VALUE      :: latvalue_xsize, lonvalue_ysize
+      END SUBROUTINE xios_xml_set_domain_latvalue
+
+      SUBROUTINE  xios_xml_set_domain_domtype(domain, ftype, domtype, domtype_size) bind(C)
+         import C_CHAR, C_INT
+         INTEGER  (kind = C_INT), VALUE         :: domain, ftype
+         CHARACTER(kind = C_CHAR), DIMENSION(*) :: domtype
+         INTEGER  (kind = C_INT), VALUE         :: domtype_size
+      END SUBROUTINE xios_xml_set_domain_domtype
+
+   END INTERFACE
+
+   CONTAINS ! Fonctions disponibles pour les utilisateurs.
+
+   SUBROUTINE xml_tree_add(parent_hdl, child_hdl, child_type, child_id)
+      USE IXHANDLE
+      TYPE(XHandle), INTENT(IN)                :: parent_hdl
+      TYPE(XHandle), INTENT(OUT)               :: child_hdl
+      INTEGER, INTENT(IN)                      :: child_type
+      CHARACTER(len = *), OPTIONAL, INTENT(IN) :: child_id
+      child_hdl = NULLHANDLE
+      IF (((parent_hdl%dtype >= 10) .AND. (parent_hdl%dtype <= 14) .AND.                     &
+          (parent_hdl%dtype == child_type) .OR. (parent_hdl%dtype == (child_type + 5))) .OR. &
+          ((parent_hdl%dtype == EFILE) .AND. ((child_type == EFIELD) .OR.                    &
+          (child_type == GFIELD)))) THEN
+         IF (PRESENT(child_id)) THEN
+            CALL xios_xml_tree_add(parent_hdl%daddr, parent_hdl%dtype, child_hdl%daddr, child_type, child_id, len(child_id))
+         ELSE
+            CALL xios_xml_tree_add(parent_hdl%daddr, parent_hdl%dtype, child_hdl%daddr, child_type, "NONE", -1)
+         END IF
+         IF (child_hdl%daddr == 0) THEN
+            PRINT *, "(F2003 interface) Impossible d'ajouter un Ã©lÃ©ment Ã  l'arborescence 0!"
+            STOP
+         ELSE
+            child_hdl%dtype = child_type
+         END IF
+      ELSE
+         PRINT *, "(F2003 interface) Impossible d'ajouter un Ã©lÃ©ment Ã  l'arborescence 1!"
+         STOP
+      END IF
+
+   END SUBROUTINE xml_tree_add
+
+   SUBROUTINE xml_tree_show(filename)
+      CHARACTER(len = *), OPTIONAL, INTENT(IN) :: filename
+      IF (PRESENT(filename)) THEN
+         CALL xios_xml_tree_show(filename, len(filename))
+      ELSE
+         CALL xios_xml_tree_show("NONE", -1)
+      END IF
+   END SUBROUTINE xml_tree_show
+
+   SUBROUTINE xml_field_addAttribut(field_hdl, fname, fstandard_name, flong_name, funit, foperation, ffreq_op, &
+                                    flevel, fprec, fenabled, fdomain_ref, faxis_ref, fgrid_ref, fzoom_ref, ffield_ref)
+      USE IXHANDLE
+      USE ICALENDAR
+      TYPE(XHandle), INTENT(IN)                :: field_hdl
+      CHARACTER(len = *), OPTIONAL, INTENT(IN) :: fname, fstandard_name, flong_name, funit, foperation
+      TYPE(XDuration), OPTIONAL, INTENT(IN)    :: ffreq_op
+      INTEGER, OPTIONAL, INTENT(IN)            :: flevel, fprec
+      LOGICAL (kind = 1), OPTIONAL, INTENT(IN) :: fenabled
+      CHARACTER(len = *), OPTIONAL, INTENT(IN) :: fdomain_ref, faxis_ref, fgrid_ref, fzoom_ref, ffield_ref
+      IF ((field_hdl%daddr == 0) .OR. &
+          .NOT.((field_hdl%dtype == EFIELD) .OR. (field_hdl%dtype == GFIELD))) THEN
+         PRINT *, "(F2003 interface) Impossible d'ajouter des attributs au champ !"
+         STOP
+      ELSE
+         IF (PRESENT(fname))          THEN
+            CALL xios_xml_set_field_name(field_hdl%daddr, field_hdl%dtype, fname, len(fname));
+         END IF
+         IF (PRESENT(fstandard_name)) THEN
+            CALL xios_xml_set_field_sname(field_hdl%daddr, field_hdl%dtype, fstandard_name, len(fstandard_name));
+         END IF
+         IF (PRESENT(flong_name))     THEN
+            CALL xios_xml_set_field_lname(field_hdl%daddr, field_hdl%dtype, flong_name, len(flong_name));
+         END IF
+         IF (PRESENT(funit))          THEN
+            CALL xios_xml_set_field_unit(field_hdl%daddr, field_hdl%dtype, funit, len(funit));
+         END IF
+         IF (PRESENT(foperation))     THEN
+            CALL xios_xml_set_field_operation(field_hdl%daddr, field_hdl%dtype, foperation, len(foperation));
+         END IF
+         IF (PRESENT(ffreq_op))       THEN
+            CALL xios_xml_set_field_freq_op(field_hdl%daddr, field_hdl%dtype,            &
+                                            ffreq_op%year, ffreq_op%month, ffreq_op%day, &
+                                            ffreq_op%hour, ffreq_op%minute, ffreq_op%second)
+         END IF
+         IF (PRESENT(flevel))         THEN
+            CALL xios_xml_set_field_level(field_hdl%daddr, field_hdl%dtype, flevel);
+         END IF
+         IF (PRESENT(fprec))          THEN
+            CALL xios_xml_set_field_prec(field_hdl%daddr, field_hdl%dtype, fprec);
+         END IF
+         IF (PRESENT(fenabled))       THEN
+            CALL xios_xml_set_field_enabled(field_hdl%daddr, field_hdl%dtype, fenabled);
+         END IF
+         IF (PRESENT(fdomain_ref))    THEN
+            CALL xios_xml_set_field_dref(field_hdl%daddr, field_hdl%dtype, fdomain_ref, len(fdomain_ref));
+         END IF
+         IF (PRESENT(faxis_ref))      THEN
+            CALL xios_xml_set_field_aref(field_hdl%daddr, field_hdl%dtype, faxis_ref, len(faxis_ref));
+         END IF
+         IF (PRESENT(fgrid_ref))      THEN
+            CALL xios_xml_set_field_gref(field_hdl%daddr, field_hdl%dtype, fgrid_ref, len(fgrid_ref));
+         END IF
+         IF (PRESENT(fzoom_ref))      THEN
+            CALL xios_xml_set_field_zref(field_hdl%daddr, field_hdl%dtype, fzoom_ref, len(fzoom_ref));
+         END IF
+         IF (PRESENT(ffield_ref))     THEN
+            CALL xios_xml_set_field_fref(field_hdl%daddr, field_hdl%dtype, ffield_ref, len(ffield_ref));
+         END IF
+      END IF
+   END SUBROUTINE xml_field_addAttribut
+
+   SUBROUTINE xml_group_field_addAttribut(gfield_hdl, fname, fstandard_name, flong_name, funit, foperation, ffreq_op, &
+                                          flevel, fprec, fenabled, fdomain_ref, faxis_ref, fgrid_ref, fzoom_ref, ffield_ref)
+      USE IXHANDLE
+      USE ICALENDAR
+      TYPE(XHandle), INTENT(IN)                :: gfield_hdl
+      CHARACTER(len = *), OPTIONAL, INTENT(IN) :: fname, fstandard_name, flong_name, funit, foperation
+      TYPE(XDuration), OPTIONAL, INTENT(IN)    :: ffreq_op
+      INTEGER, OPTIONAL, INTENT(IN)            :: flevel, fprec
+      LOGICAL (kind = 1), OPTIONAL, INTENT(IN) :: fenabled
+      CHARACTER(len = *), OPTIONAL, INTENT(IN) :: fdomain_ref, faxis_ref, fgrid_ref, fzoom_ref, ffield_ref
+      IF ((gfield_hdl%daddr == 0) .OR. .NOT.(gfield_hdl%dtype == GFIELD)) THEN
+         PRINT *, "(F2003 interface) Impossible d'ajouter des attributs au groupe de champs !"
+         STOP
+      ELSE
+        CALL xml_field_addAttribut(gfield_hdl, fname, fstandard_name, flong_name, funit, foperation, ffreq_op, &
+                                   flevel, fprec, fenabled, fdomain_ref, faxis_ref, fgrid_ref, fzoom_ref, ffield_ref)
+      END IF
+   END SUBROUTINE xml_group_field_addAttribut
+
+   SUBROUTINE xml_file_addAttribut(file_hdl, fname, fdescription, fofreq, folevel, fenabled)
+      USE IXHANDLE
+      USE ICALENDAR
+      TYPE(XHandle), INTENT(IN)                :: file_hdl
+      CHARACTER(len = *), OPTIONAL, INTENT(IN) :: fname, fdescription
+      TYPE(XDuration), OPTIONAL, INTENT(IN)    :: fofreq
+      INTEGER, OPTIONAL, INTENT(IN)            :: folevel
+      LOGICAL (kind = 1), OPTIONAL, INTENT(IN) :: fenabled
+      IF ((file_hdl%daddr == 0) .OR. &
+          .NOT.((file_hdl%dtype == EFILE) .OR. (file_hdl%dtype == GFILE))) THEN
+         PRINT *, "(F2003 interface) Impossible d'ajouter des attributs au fichier !"
+         STOP
+      ELSE
+         IF (PRESENT(fname))        THEN
+            CALL xios_xml_set_file_name(file_hdl%daddr, file_hdl%dtype, fname, len(fname));
+         END IF
+         IF (PRESENT(fdescription)) THEN
+            CALL xios_xml_set_file_description(file_hdl%daddr, file_hdl%dtype, fdescription, len(fdescription));
+         END IF
+         IF (PRESENT(fofreq))     THEN
+            CALL xios_xml_set_file_output_freq(file_hdl%daddr, file_hdl%dtype,        &
+                                               fofreq%year, fofreq%month, fofreq%day, &
+                                               fofreq%hour, fofreq%minute, fofreq%second)
+         END IF
+         IF (PRESENT(folevel))      THEN
+            CALL xios_xml_set_file_olevel(file_hdl%daddr, file_hdl%dtype, folevel);
+         END IF
+         IF (PRESENT(fenabled))     THEN
+            CALL xios_xml_set_file_enabled(file_hdl%daddr, file_hdl%dtype, fenabled);
+         END IF
+      END IF
+   END SUBROUTINE xml_file_addAttribut
+
+   SUBROUTINE xml_group_file_addAttribut(gfile_hdl, fname, fdescription, fofreq, folevel, fenabled)
+      USE IXHANDLE
+      USE ICALENDAR
+      TYPE(XHandle), INTENT(IN)                :: gfile_hdl
+      CHARACTER(len = *), OPTIONAL, INTENT(IN) :: fname, fdescription
+      TYPE(XDuration), OPTIONAL, INTENT(IN)    :: fofreq
+      INTEGER, OPTIONAL, INTENT(IN)            :: folevel
+      LOGICAL (kind = 1), OPTIONAL, INTENT(IN) :: fenabled
+      IF ((gfile_hdl%daddr == 0) .OR. .NOT.(gfile_hdl%dtype == GFILE)) THEN
+         PRINT *, "(F2003 interface) Impossible d'ajouter des attributs au groupe de fichiers !"
+         STOP
+      ELSE
+        CALL xml_file_addAttribut(gfile_hdl, fname, fdescription, fofreq, folevel, fenabled)
+      END IF
+   END SUBROUTINE xml_group_file_addAttribut
+
+   SUBROUTINE xml_grid_addAttribut(grid_hdl, gname, gdescription, gdomain_ref, gaxis_ref)
+      USE IXHANDLE
+      TYPE(XHandle), INTENT(IN)                :: grid_hdl
+      CHARACTER(len = *), OPTIONAL, INTENT(IN) :: gname, gdescription, gdomain_ref, gaxis_ref
+      IF ((grid_hdl%daddr == 0) .OR. &
+          .NOT.((grid_hdl%dtype == EGRID) .OR. (grid_hdl%dtype == GGRID))) THEN
+         PRINT *, "(F2003 interface) Impossible d'ajouter des attributs Ã  la grille !"
+         STOP
+      ELSE
+         IF (PRESENT(gname))        THEN
+            CALL xios_xml_set_grid_name(grid_hdl%daddr, grid_hdl%dtype, gname, len(gname));
+         END IF
+         IF (PRESENT(gdescription)) THEN
+            CALL xios_xml_set_grid_description(grid_hdl%daddr, grid_hdl%dtype, gdescription, len(gdescription));
+         END IF
+         IF (PRESENT(gdomain_ref))  THEN
+            CALL xios_xml_set_grid_dref(grid_hdl%daddr, grid_hdl%dtype, gdomain_ref, len(gdomain_ref));
+         END IF
+         IF (PRESENT(gaxis_ref))    THEN
+            CALL xios_xml_set_grid_aref(grid_hdl%daddr, grid_hdl%dtype, gaxis_ref, len(gaxis_ref));
+         END IF
+      END IF
+   END SUBROUTINE xml_grid_addAttribut
+
+   SUBROUTINE xml_group_grid_addAttribut(ggrid_hdl, gname, gdescription, gdomain_ref, gaxis_ref)
+      USE IXHANDLE
+      TYPE(XHandle), INTENT(IN)                :: ggrid_hdl
+      CHARACTER(len = *), OPTIONAL, INTENT(IN) :: gname, gdescription, gdomain_ref, gaxis_ref
+      IF ((ggrid_hdl%daddr == 0) .OR. .NOT.(ggrid_hdl%dtype == GGRID)) THEN
+         PRINT *, "(F2003 interface) Impossible d'ajouter des attributs au groupe de grilles !"
+         STOP
+      ELSE
+        CALL xml_grid_addAttribut(ggrid_hdl, gname, gdescription, gdomain_ref, gaxis_ref)
+      END IF
+   END SUBROUTINE xml_group_grid_addAttribut
+
+   SUBROUTINE xml_axis_addAttribut(axis_hdl, aname, astandard_name, along_name, aunit, avalue)
+      USE IXHANDLE
+      TYPE(XHandle), INTENT(IN)                          :: axis_hdl
+      CHARACTER(len = *), OPTIONAL, INTENT(IN)           :: aname, astandard_name, along_name, aunit
+      REAL(kind = 8), dimension(*), OPTIONAL, INTENT(IN) :: avalue(:)
+
+      IF ((axis_hdl%daddr == 0) .OR. &
+          .NOT.((axis_hdl%dtype == EAXIS) .OR. (axis_hdl%dtype == GAXIS))) THEN
+         PRINT *, "(F2003 interface) Impossible d'ajouter des attributs Ã  l'axe !"
+         STOP
+      ELSE
+         IF (PRESENT(aname))          THEN
+            CALL xios_xml_set_axis_name(axis_hdl%daddr, axis_hdl%dtype, aname, len(aname));
+         END IF
+         IF (PRESENT(astandard_name)) THEN
+            CALL xios_xml_set_axis_sname(axis_hdl%daddr, axis_hdl%dtype, astandard_name, len(astandard_name));
+         END IF
+         IF (PRESENT(along_name))     THEN
+            CALL xios_xml_set_axis_lname(axis_hdl%daddr, axis_hdl%dtype, along_name, len(along_name));
+         END IF
+         IF (PRESENT(aunit))          THEN
+            CALL xios_xml_set_axis_unit(axis_hdl%daddr, axis_hdl%dtype, aunit, len(aunit));
+         END IF
+         IF (PRESENT(avalue))         THEN
+            CALL xios_xml_set_axis_value(axis_hdl%daddr, axis_hdl%dtype, avalue, size(avalue))
+         END IF
+      END IF
+   END SUBROUTINE xml_axis_addAttribut
+
+   SUBROUTINE xml_group_axis_addAttribut(gaxis_hdl, aname, astandard_name, along_name, aunit, avalue)
+      USE IXHANDLE
+      TYPE(XHandle), INTENT(IN)                          :: gaxis_hdl
+      CHARACTER(len = *), OPTIONAL, INTENT(IN)           :: aname, astandard_name, along_name, aunit
+      REAL(kind = 8), dimension(*), OPTIONAL, INTENT(IN) :: avalue(:)
+
+      IF ((gaxis_hdl%daddr == 0) .OR. .NOT.(gaxis_hdl%dtype == GAXIS)) THEN
+         PRINT *, "(F2003 interface) Impossible d'ajouter des attributs au groupe d'axes' !"
+         STOP
+      ELSE
+        CALL xml_axis_addAttribut(gaxis_hdl, aname, astandard_name, along_name, aunit, avalue)
+      END IF
+   END SUBROUTINE xml_group_axis_addAttribut
+
+   SUBROUTINE xml_domain_addAttribut(domain_hdl, dname, dstandard_name, dlong_name,                      &
+                                     ni_glo, nj_glo, ibegin, iend, ni, jbegin, jend, nj, mask,           &
+                                     data_dim, data_ni, data_nj, data_ibegin, data_jbegin, data_n_index, &
+                                     data_i_index, data_j_index, lonvalue_rect, latvalue_rect,           &
+                                     lonvalue_curv, latvalue_curv, domtype)
+      USE IXHANDLE
+      TYPE(XHandle), INTENT(IN)                             :: domain_hdl
+      CHARACTER(len = *), OPTIONAL, INTENT(IN)              :: dname, dstandard_name, dlong_name
+      INTEGER, OPTIONAL, INTENT(IN)                         :: ni_glo, nj_glo, ibegin, iend, ni, jbegin, jend, nj
+      LOGICAL(kind = 1), DIMENSION(*), OPTIONAL, INTENT(IN) :: mask(:,:)
+      INTEGER, OPTIONAL, INTENT(IN)                         :: data_dim, data_ni, data_nj, data_ibegin, data_jbegin, data_n_index
+      INTEGER, DIMENSION(*), OPTIONAL, INTENT(IN)           :: data_i_index(:), data_j_index(:)
+      REAL(kind = 8), DIMENSION(*), OPTIONAL, INTENT(IN)    :: lonvalue_curv(:,:), latvalue_curv(:,:)
+      REAL(kind = 8), DIMENSION(*), OPTIONAL, INTENT(IN)    :: lonvalue_rect(:), latvalue_rect(:)
+      CHARACTER(len = *), OPTIONAL, INTENT(IN)              :: domtype
+
+      IF ((domain_hdl%daddr == 0) .OR. &
+          .NOT.((domain_hdl%dtype == EDOMAIN) .OR. (domain_hdl%dtype == GDOMAIN))) THEN
+         PRINT *, "(F2003 interface) Impossible d'ajouter des attributs au domain !"
+         STOP
+      ELSE
+         IF (PRESENT(dname))              THEN
+            CALL xios_xml_set_domain_name(domain_hdl%daddr, domain_hdl%dtype, dname, len(dname));
+         END IF
+         IF (PRESENT(dstandard_name))     THEN
+            CALL xios_xml_set_domain_sname(domain_hdl%daddr, domain_hdl%dtype, dstandard_name, len(dstandard_name));
+         END IF
+         IF (PRESENT(dlong_name))         THEN
+            CALL xios_xml_set_domain_lname(domain_hdl%daddr, domain_hdl%dtype, dlong_name, len(dlong_name));
+         END IF
+         IF (PRESENT(dlong_name))         THEN
+            CALL xios_xml_set_domain_lname(domain_hdl%daddr, domain_hdl%dtype, dlong_name, len(dlong_name));
+         END IF
+         IF (PRESENT(ni_glo))             THEN
+            CALL xios_xml_set_domain_niglo(domain_hdl%daddr, domain_hdl%dtype, ni_glo);
+         END IF
+         IF (PRESENT(nj_glo))             THEN
+            CALL xios_xml_set_domain_njglo(domain_hdl%daddr, domain_hdl%dtype, nj_glo);
+         END IF
+         IF (PRESENT(ibegin))             THEN
+            CALL xios_xml_set_domain_ibegin(domain_hdl%daddr, domain_hdl%dtype, ibegin);
+         END IF
+         IF (PRESENT(iend))               THEN
+            CALL xios_xml_set_domain_iend(domain_hdl%daddr, domain_hdl%dtype, iend);
+         END IF
+         IF (PRESENT(ni))                 THEN
+            CALL xios_xml_set_domain_ni(domain_hdl%daddr, domain_hdl%dtype, ni);
+         END IF
+         IF (PRESENT(jbegin))             THEN
+            CALL xios_xml_set_domain_jbegin(domain_hdl%daddr, domain_hdl%dtype, jbegin);
+         END IF
+         IF (PRESENT(jend))               THEN
+            CALL xios_xml_set_domain_jend(domain_hdl%daddr, domain_hdl%dtype, jend);
+         END IF
+         IF (PRESENT(nj))                 THEN
+            CALL xios_xml_set_domain_nj(domain_hdl%daddr, domain_hdl%dtype, nj);
+         END IF
+         IF (PRESENT(mask))               THEN
+            CALL xios_xml_set_domain_mask(domain_hdl%daddr, domain_hdl%dtype, mask, size(mask, 1), size(mask,2))
+         END IF
+         IF (PRESENT(data_dim))           THEN
+            CALL xios_xml_set_domain_ddim(domain_hdl%daddr, domain_hdl%dtype, data_dim)
+         END IF
+         IF (PRESENT(data_ni))            THEN
+            CALL xios_xml_set_domain_dni(domain_hdl%daddr, domain_hdl%dtype, data_ni)
+         END IF
+         IF (PRESENT(data_nj))            THEN
+            CALL xios_xml_set_domain_dnj(domain_hdl%daddr, domain_hdl%dtype, data_nj)
+         END IF
+         IF (PRESENT(data_ibegin))        THEN
+            CALL xios_xml_set_domain_dibegin(domain_hdl%daddr, domain_hdl%dtype, data_ibegin)
+         END IF
+         IF (PRESENT(data_jbegin))        THEN
+            CALL xios_xml_set_domain_djbegin(domain_hdl%daddr, domain_hdl%dtype, data_jbegin)
+         END IF
+         IF (PRESENT(data_n_index))       THEN
+            CALL xios_xml_set_domain_dnindex(domain_hdl%daddr, domain_hdl%dtype, data_n_index)
+         END IF
+         IF (PRESENT(data_i_index))       THEN
+            CALL xios_xml_set_domain_diindex(domain_hdl%daddr, domain_hdl%dtype, data_i_index, size(data_i_index))
+         END IF
+         IF (PRESENT(data_j_index))       THEN
+            CALL xios_xml_set_domain_djindex(domain_hdl%daddr, domain_hdl%dtype, data_j_index, size(data_j_index))
+         END IF
+         IF (PRESENT(lonvalue_curv))      THEN
+            CALL xios_xml_set_domain_lonvalue(domain_hdl%daddr, domain_hdl%dtype, lonvalue_curv, &
+                                              size(lonvalue_curv, 1), size(lonvalue_curv, 2))
+         ELSE IF (PRESENT(lonvalue_rect)) THEN
+            CALL xios_xml_set_domain_lonvalue(domain_hdl%daddr, domain_hdl%dtype, lonvalue_rect, size(lonvalue_rect, 1), -1)
+         END IF
+         IF (PRESENT(latvalue_curv))      THEN
+            CALL xios_xml_set_domain_latvalue(domain_hdl%daddr, domain_hdl%dtype, latvalue_curv, &
+                                              size(latvalue_curv, 1), size(latvalue_curv, 2))
+         ELSE IF (PRESENT(latvalue_rect)) THEN
+            CALL xios_xml_set_domain_latvalue(domain_hdl%daddr, domain_hdl%dtype, latvalue_rect, size(latvalue_rect, 1), -1)
+         END IF
+         IF (PRESENT(domtype))            THEN
+            CALL xios_xml_set_domain_domtype(domain_hdl%daddr, domain_hdl%dtype, domtype, len(domtype))
+         END IF
+      END IF
+   END SUBROUTINE xml_domain_addAttribut
+
+   SUBROUTINE xml_group_domain_addAttribut(gdomain_hdl, dname, dstandard_name, dlong_name,                     &
+                                           ni_glo, nj_glo, ibegin, iend, ni, jbegin, jend, nj, mask,           &
+                                           data_dim, data_ni, data_nj, data_ibegin, data_jbegin, data_n_index, &
+                                           data_i_index, data_j_index, lonvalue_rect, latvalue_rect,           &
+                                           lonvalue_curv, latvalue_curv, domtype)
+      USE IXHANDLE
+      TYPE(XHandle), INTENT(IN)                             :: gdomain_hdl
+      CHARACTER(len = *), OPTIONAL, INTENT(IN)              :: dname, dstandard_name, dlong_name
+      INTEGER, OPTIONAL, INTENT(IN)                         :: ni_glo, nj_glo, ibegin, iend, ni, jbegin, jend, nj
+      LOGICAL(kind = 1), DIMENSION(*), OPTIONAL, INTENT(IN) :: mask(:,:)
+      INTEGER, OPTIONAL, INTENT(IN)                         :: data_dim, data_ni, data_nj, data_ibegin, data_jbegin, data_n_index
+      INTEGER, DIMENSION(*), OPTIONAL, INTENT(IN)           :: data_i_index(:), data_j_index(:)
+      REAL(kind = 8), DIMENSION(*), OPTIONAL, INTENT(IN)    :: lonvalue_curv(:,:), latvalue_curv(:,:)
+      REAL(kind = 8), DIMENSION(*), OPTIONAL, INTENT(IN)    :: lonvalue_rect(:), latvalue_rect(:)
+      CHARACTER(len = *), OPTIONAL, INTENT(IN)              :: domtype
+
+      IF ((gdomain_hdl%daddr == 0) .OR. .NOT.(gdomain_hdl%dtype == GDOMAIN)) THEN
+         PRINT *, "(F2003 interface) Impossible d'ajouter des attributs au groupe de domaine !"
+         STOP
+      ELSE
+        CALL xml_domain_addAttribut(gdomain_hdl, dname, dstandard_name, dlong_name,                     &
+                                    ni_glo, nj_glo, ibegin, iend, ni, jbegin, jend, nj, mask,           &
+                                    data_dim, data_ni, data_nj, data_ibegin, data_jbegin, data_n_index, &
+                                    data_i_index, data_j_index, lonvalue_rect, latvalue_rect,           &
+                                    lonvalue_curv, latvalue_curv, domtype)
+      END IF
+   END SUBROUTINE xml_group_domain_addAttribut
+
+END MODULE IXMLTREE
+
+! --------------------------------------------- !
+!                     IXML                      !
+!       Prise en charge des document XML        !
+! --------------------------------------------- !
+MODULE IXML
+   USE ISO_C_BINDING
+
+   INTERFACE ! Ne pas appeler directement/Interface FORTRAN 2003 <-> C99
+
+      SUBROUTINE xios_xml_Parse_File(filename, filename_size) bind(C)
+         import C_CHAR, C_INT
+         CHARACTER(kind = C_CHAR), DIMENSION(*) :: filename
+         INTEGER  (kind = C_INT), VALUE         :: filename_size
+      END SUBROUTINE xios_xml_Parse_File
+
+      SUBROUTINE xios_xml_Parse_String(xmlcontent, xmlcontent_size) bind(C)
+         import C_CHAR, C_INT
+         CHARACTER(kind = C_CHAR), DIMENSION(*) :: xmlcontent
+         INTEGER  (kind = C_INT), VALUE         :: xmlcontent_size
+      END SUBROUTINE xios_xml_Parse_String
+
+   END INTERFACE
+
+   CONTAINS ! Fonctions disponibles pour les utilisateurs.
+
+   ! Parsing d'un document XML depuis un fichier dont le chemin est transmis en argument.
+   SUBROUTINE xml_Parse_File(filename)
+      CHARACTER(len = *), INTENT(IN) :: filename
+      CALL xios_xml_Parse_File(filename, len(filename))
+   END SUBROUTINE xml_Parse_File
+
+   ! Parsing d'un document XML depuis une chaÃ®ne de caractÃšre.
+   SUBROUTINE xml_Parse_String(xmlcontent)
+      CHARACTER(len = *), INTENT(IN) :: xmlcontent
+      CALL xios_xml_Parse_String(xmlcontent, len(xmlcontent))
+   END SUBROUTINE xml_Parse_String
+
+END MODULE IXML
+
+! ------------------------------------------------ !
+!                   ICONTEXT                       !
+! Ajout, suppression, ... de contextes Ã  la config !
+! ------------------------------------------------ !
+MODULE ICONTEXT
+   USE ISO_C_BINDING
+
+   INTERFACE ! Ne pas appeler directement/Interface FORTRAN 2003 <-> C99
+
+      SUBROUTINE xios_context_set_current(context, withswap) bind(C)
+         import C_BOOL, C_INT
+         INTEGER  (kind = C_INT), VALUE :: context
+         LOGICAL (kind = C_BOOL), VALUE :: withswap
+      END SUBROUTINE xios_context_set_current
+
+      SUBROUTINE xios_context_create(context, context_id, context_id_size, calendar_type) bind(C)
+         import C_CHAR, C_INT
+         INTEGER  (kind = C_INT)                :: context
+         CHARACTER(kind = C_CHAR), DIMENSION(*) :: context_id
+         INTEGER  (kind = C_INT), VALUE         :: context_id_size
+         INTEGER  (kind = C_INT), VALUE         :: calendar_type
+      END SUBROUTINE xios_context_create
+
+   END INTERFACE
+
+   CONTAINS ! Fonctions disponibles pour les utilisateurs.
+
+   ! Permet de changer de contexte de travail.
+   SUBROUTINE context_set_current(context, withswap)
+      USE IXHANDLE
+      TYPE(XHandle), INTENT(IN)                :: context
+      LOGICAL (kind = 1), OPTIONAL, INTENT(IN) :: withswap
+      LOGICAL (kind = 1)                       :: wswap
+      IF (PRESENT(withswap)) THEN
+         wswap = withswap
+      ELSE
+         wswap = .FALSE.
+      END IF
+      IF ((context%dtype .NE. ECONTEXT) .OR. (context%daddr .EQ. 0)) THEN
+         PRINT *, "(F2003 interface) Impossible de se placer dans le nouveau context car le handle est invalide !"
+         STOP
+      END IF
+      CALL xios_context_set_current(context%daddr, wswap)
+   END SUBROUTINE context_set_current
+
+   ! CrÃ©er un nouveau contexte Ã  partir d'un id, d'un type de calendrier et d'une date.
+   SUBROUTINE context_create(context_hdl, context_id, calendar_type)
+      USE IXHANDLE
+      TYPE(XHandle), INTENT(OUT)     :: context_hdl
+      CHARACTER(len = *), INTENT(IN) :: context_id
+      INTEGER, INTENT(IN)            :: calendar_type
+      CALL xios_context_create(context_hdl%daddr, context_id, len(context_id), calendar_type)
+      IF (context_hdl%daddr .EQ. 0) THEN
+         PRINT *, "(F2003 interface) Impossible de crÃ©er le context !"
+         STOP
+      ELSE
+         context_hdl%dtype = ECONTEXT
+      END IF
+   END SUBROUTINE context_create
+
+END MODULE ICONTEXT
+
+! --------------------------------------------- !
+!                   IDATATREATMENT              !
+!   Traitement des donnÃ©es issues des codes.    !
+! --------------------------------------------- !
+
+MODULE IDATATREATMENT
+   USE ISO_C_BINDING
+
+   ! enum XFileType
+   INTEGER, PARAMETER  :: NETCDF4 = 0
+
+   INTERFACE ! Ne pas appeler directement/Interface FORTRAN 2003 <-> C99
+
+      SUBROUTINE xios_dtreatment_start(context_hdl, filetype) bind(C)
+         import C_INT
+         INTEGER  (kind = C_INT), VALUE  :: context_hdl
+         INTEGER  (kind = C_INT), VALUE  :: filetype
+      END SUBROUTINE xios_dtreatment_start
+
+   END INTERFACE
+
+   CONTAINS ! Fonctions disponibles pour les utilisateurs.
+
+   SUBROUTINE dtreatment_start(context_hdl, filetype)
+      USE ICONTEXT
+      USE IXHANDLE
+      TYPE(XHandle), INTENT(IN), VALUE :: context_hdl
+      INTEGER, INTENT(IN), OPTIONAL    :: filetype
+      INTEGER                          :: filetype_
+      IF ((context_hdl%dtype .NE. ECONTEXT) .OR. (context_hdl%daddr .EQ. 0)) THEN
+         PRINT *, "(F2003 interface) Impossible de traiter un contexte invalide !"
+         STOP
+      END IF
+      IF (PRESENT(filetype)) THEN
+         filetype_ = filetype
+      ELSE
+         filetype_ = NETCDF4
+      END IF
+      CALL context_set_current(context_hdl)
+      CALL xios_dtreatment_start(context_hdl%daddr, filetype_)
+   END SUBROUTINE dtreatment_start
+
+END MODULE IDATATREATMENT
+
+! --------------------------------------------- !
+!                   IEXTENDED                   !
+!        Quelques fonctions pratiques  ...      !
+! --------------------------------------------- !
+
+MODULE IEXTENDED
+   USE ISO_C_BINDING
+
+
+
+END MODULE IEXTENDED
+
Index: XMLIO_V2/dev/dev_rv/src/XMLIO/c_interface.hpp
===================================================================
--- XMLIO_V2/dev/dev_rv/src/XMLIO/c_interface.hpp	(revision 134)
+++ XMLIO_V2/dev/dev_rv/src/XMLIO/c_interface.hpp	(revision 137)
@@ -7,4 +7,41 @@
 using namespace XMLIOSERVER::XML;
 
+typedef long int XInt, XSize; // Integer
+typedef bool     XBool;       // Logical
+typedef void   * XPtr;        // Pointeur C non typÃ©
+typedef char   * XString;     // Pointeur C non typÃ©
+
+typedef enum
+{
+   NOTYPE = 0,
+   DTREATMENT/* UNUSED */, DATE, CALENDAR, ECONTEXT,
+   EAXIS, EDOMAIN, EFIELD, EFILE, EGRID,
+   GAXIS, GDOMAIN, GFIELD, GFILE, GGRID
+} XDType;
+
+typedef enum
+{
+   NETCDF4 = 0
+} XFileType;
+
+typedef enum
+ { D360 = 0 , ALLLEAP, NOLEAP, JULIAN, GREGORIAN } XCalendarType ;
+
+typedef struct // RÃ©fÃ©rence C Ã  une objet de la bibliothÃšque.
+{ XDType data_type; XPtr data_ptr; } XHandle;
+
+#define MAKE_STRING(var_name, str_arg, int_arg)             \
+      std::string var_name##temp;                           \
+      var_name##temp.append (str_arg, int_arg);             \
+      size_t d = var_name##temp.find_first_not_of(' ');     \
+      size_t f = var_name##temp.find_last_not_of (' ');     \
+      std::string var_name = var_name##temp.substr(d, f-d+1)
+
+#define XML_SET(type, type_var, var, long_var) \
+   void xios_xml_set_##type##_##var(XPtr const _##type, XDType _dtype, type_var var)
+
+#define XML_SET_STRING(type, var, long_var) \
+   void xios_xml_set_##type##_##var(XPtr const _##type, XDType _dtype, const XString _##var, XSize _##var##_len)
+
 #ifdef __cplusplus
 extern"C"
@@ -12,57 +49,103 @@
 #endif //__cplusplus
 
-   typedef long int XInt; // Integer
-   typedef bool     XBool;// Logical
-   typedef void    *XPtr; // Pointeur C non typÃ©
+/* ******************** HANDLE INTERFACE ******************** */
+void xios_handle_create (XPtr * const _ret, XDType _dtype, const XString _id, XSize _id_len);
 
-   typedef enum _datatype
-   {
-      NOTYPE = 0,
-      DTREATMENT, DATE, CALENDAR, ECONTEXT,
-      EAXIS, EDOMAIN, EFIELD, EFILE, EGRID,
-      GAXIS, GDOMAIN, GFIELD, GFILE, GGRID
-   } XDType;
+/* ******************** XML INTERFACE *********************** */
+void xios_xml_parse_file  (const XString _filename, XSize _filename_len);
+void xios_xml_parse_string(const XString _xmlcontent, XSize _xmlcontent_len);
 
-   typedef enum _filetype
-   {
-      NETCDF4 = 0
-   } XFileType;
+/* ******************** CONTEXT INTERFACE ******************* */
+void xios_context_set_current (XPtr const _ctx, bool _wswap);
+void xios_context_create (XPtr * _ctx, const XString _ctx_id, XSize _ctx_id_len, XCalendarType _calType);
 
-   typedef struct _handle // RÃ©fÃ©rence C Ã  une objet de la bibliothÃšque.
-   { XDType data_type; XPtr data_ptr; } XHandle;
+/* ******************  XML TREE INTERFACE ******************* */
+void xios_xml_tree_add(const XPtr _parent, XDType _parent_type, XPtr * _child,
+                       XDType _child_type, const XString _child_id, XSize _child_id_len);
+void xios_xml_tree_show(const XString _filename, XSize _filename_len);
 
-   typedef struct _string // ChaÃ®ne de caractÃšres.
-   { char * str; int len;  } XString;
+// Attributs de field ou field_group
+XML_SET_STRING(field, name, name);
+XML_SET_STRING(field, sname, standard_name);
+XML_SET_STRING(field, lname, long_name);
+XML_SET_STRING(field, unit, unit);
+XML_SET_STRING(field, operation, operation);
 
-   typedef struct _ymdhms_int
-   { int year, month, day, hour, minute, second; } XDate;
+void xios_xml_set_field_freq_op(XPtr const _field, XDType _dtype,
+                                 double year, double month, double day,
+                                 double hour, double minute, double second);
 
-    typedef struct _ymdhms_double
-   { double year, month, day, hour, minute, second; } XDuration;
+XML_SET(field, int, level, level);
+XML_SET(field, int, prec, prec);
+XML_SET(field, bool, enabled, enabled);
 
-   const XHandle NULLHANDLE = { NOTYPE, NULL };
+XML_SET_STRING(field, dref, domain_ref);
+XML_SET_STRING(field, aref, axis_ref);
+XML_SET_STRING(field, gref, grid_ref);
+XML_SET_STRING(field, zref, zoom_ref);
+XML_SET_STRING(field, fref, field_ref);
 
-#define isNullHandle(hdl) \
-   ((hdl).data_type == NOTYPE && (hdl).data_ptr == NULL)
+// Attributs de file ou file_group
+XML_SET_STRING(file, name, name) ;
+XML_SET_STRING(file, description, description);
+void xios_xml_set_file_output_freq(XPtr const _file, XDType _dtype,
+                                   double year, double month, double day,
+                                   double hour, double minute, double second);
 
-   /* ******************** HANDLE INTERFACE ******************** */
-   void xios_handle_create_ (XHandle * const _ret, const XDType * const _dtype, const XString _id);
+XML_SET(file, int, olevel, output_level);
+XML_SET(file, bool, enabled, enabled);
 
-   /* ******************** XML INTERFACE *********************** */
-   void xios_xml_parse_file_  (const XString _filename);
-   void xios_xml_parse_string_(const XString _xmlcontent);
+// Attributs de grid ou grid_group
+XML_SET_STRING(grid, name, name) ;
+XML_SET_STRING(grid, description, description) ;
+XML_SET_STRING(grid, dref, domain_ref) ;
+XML_SET_STRING(grid, aref, axis_ref) ;
 
-   /* ******************** DATA TREATMENT INTERFACE ************ */
-   void xios_dtreatment_new_(XHandle * const _dt, const XHandle * const _hd);
-   void xios_dtreatment_create_files_and_headers_(const XHandle * const _hd, const XFileType * const _ft);
+// Attribut de axis ou axis_group
+XML_SET_STRING(axis, name, name) ;
+XML_SET_STRING(axis, sname, standard_name) ;
+XML_SET_STRING(axis, lname, long_name) ;
 
-   /* ******************** CONTEXT INTERFACE ******************* */
-   void xios_context_set_current_ (const XHandle * const _ctxt, const bool * const _wswap);
-   void xios_context_get_current_ (XHandle * _ctxt);
-   void xios_context_get_calendar_(const XHandle * const _ctxt, XHandle * _cal);
-   ///  void xios_context_ShowTree_  (void);
+XML_SET_STRING(axis, unit, unit) ;
 
-   /* ******************** CALENDAR INTERFACE ****************** */
-   void xios_calendar_set_timestep_(const XHandle * const _cal, const XDuration * const _dur);
+void xios_xml_set_axis_value(XPtr const _file, XDType _dtype, double value[], XSize value_size);
+
+
+// Attribut de domain ou domain_group
+XML_SET_STRING(domain, name, name) ;
+XML_SET_STRING(domain, sname, standard_name) ;
+XML_SET_STRING(domain, lname, long_name) ;
+
+XML_SET(domain, int, niglo, ni_glo);
+XML_SET(domain, int, njglo, nj_glo);
+
+XML_SET(domain, int, ibegin, ibegin);
+XML_SET(domain, int, iend, iend);
+XML_SET(domain, int, ni, ni);
+
+XML_SET(domain, int, jbegin, jbegin);
+XML_SET(domain, int, jend, jend);
+XML_SET(domain, int, nj, nj);
+
+void xios_xml_set_domain_mask(XPtr const _domain, XDType _dtype, bool * _mask , XSize _maskXsize, XSize _maskYsize);
+
+XML_SET(domain, int, ddim, data_dim);
+XML_SET(domain, int, dni, data_ni);
+XML_SET(domain, int, dnj, data_nj);
+XML_SET(domain, int, dibegin, data_ibegin);
+XML_SET(domain, int, djbegin, data_jbegin);
+
+XML_SET(domain, int, dnindex, data_n_index);
+
+void xios_xml_set_domain_diindex(XPtr const _domain, XDType _dtype, int _diindex[], XSize _diindex_size);
+void xios_xml_set_domain_djindex(XPtr const _domain, XDType _dtype, int _djindex[], XSize _djindex_size);
+
+void xios_xml_set_domain_lonvalue(XPtr const _domain, XDType _dtype, double _lonvalue[], XSize _lonvalue_Xsize, XSize _lonvalue_Ysize);
+void xios_xml_set_domain_latvalue(XPtr const _domain, XDType _dtype, double _latvalue[], XSize _latvalue_Xsize, XSize _latvalue_Ysize);
+
+XML_SET_STRING(domain, domtype, domtype) ;
+
+/* ******************  DATA TREATMENT INTERFACE ******************* */
+void xios_dtreatment_start(XPtr const _context, XFileType filetype);
 
 #ifdef __cplusplus
Index: XMLIO_V2/dev/dev_rv/src/XMLIO/context.hpp
===================================================================
--- XMLIO_V2/dev/dev_rv/src/XMLIO/context.hpp	(revision 134)
+++ XMLIO_V2/dev/dev_rv/src/XMLIO/context.hpp	(revision 137)
@@ -23,4 +23,20 @@
          { /* Ne rien faire de plus */ }
 
+         bool createDefinitions(void)
+         {
+            if (hasChild()) return false;
+            this->fieldDef  =
+               (FieldDefinition*) FieldDefinition ::CreateObject(FieldDefinition ::GetDefName());
+            this->fileDef   =
+               (FileDefinition*)  FileDefinition  ::CreateObject(FileDefinition  ::GetDefName());
+            this->axisDef   =
+               (AxisDefinition*)  AxisDefinition  ::CreateObject(AxisDefinition  ::GetDefName());
+            this->gridDef   =
+               (GridDefinition*)  GridDefinition  ::CreateObject(GridDefinition  ::GetDefName());
+            this->domainDef =
+               (DomainDefinition*)DomainDefinition::CreateObject(DomainDefinition::GetDefName());
+            return (true);
+         }
+
           FieldDefinition * getFieldDefinition (void) const { return (this->fieldDef ); }
            FileDefinition * getFileDefinition  (void) const { return (this->fileDef  ); }
@@ -31,4 +47,6 @@
          AbstractCalendar * getCalendar     (void) const { return (ccalendar ); }
          DataTreatment    * getDataTreatment(void) const { return (dtreatment); }
+
+         AbstractCalendar * setCalendar(AbstractCalendar * const _cal) { return (ccalendar = _cal);}
 
          AbstractCalendar * setCalendar(const string& _calName, const string& _dateStr)
@@ -82,5 +100,5 @@
             else
             {
-              do { // Parcours des contexts pour traitement.
+              do { // Parcours des contextes pour traitement.
 
                   string name = _node.getElementName();
Index: XMLIO_V2/dev/dev_rv/src/XMLIO/declare_attribut.hpp
===================================================================
--- XMLIO_V2/dev/dev_rv/src/XMLIO/declare_attribut.hpp	(revision 134)
+++ XMLIO_V2/dev/dev_rv/src/XMLIO/declare_attribut.hpp	(revision 137)
@@ -26,11 +26,6 @@
                                                                                     \
    const Attr_##att_name& getAttr_##att_name(void) const { return (att_name); }     \
-   const Attr_##att_name& get_##att_name(void)     const { return (att_name); }     \
-                                                                                    \
-   void setAttr##att_name(const Attr_##att_name& _newattr) { att_name = _newattr; } \
-   void set_##att_name   (const Attr_##att_name& _newattr) { att_name = _newattr; }\
-                                                                                    \
-   void setAttr##att_name(const att_type& _newattr) { att_name.setValue(_newattr); }\
-   void set_##att_name   (const att_type& _newattr) { att_name.setValue(_newattr); }\
+   void set_##att_name (const Attr_##att_name& _newattr) { att_name = _newattr; }   \
+   void set_##att_name (const att_type& _newattr) { att_name.setValue(_newattr); }  \
                                                                                     \
    Attr_##att_name att_name
Index: XMLIO_V2/dev/dev_rv/src/XMLIO/declare_group.hpp
===================================================================
--- XMLIO_V2/dev/dev_rv/src/XMLIO/declare_group.hpp	(revision 134)
+++ XMLIO_V2/dev/dev_rv/src/XMLIO/declare_group.hpp	(revision 137)
@@ -27,4 +27,3 @@
       typedef child_type##Group child_type##Definition;                    \
    }
-
 #endif // __DECLARE_GROUP__
Index: XMLIO_V2/dev/dev_rv/src/XMLIO/domain.hpp
===================================================================
--- XMLIO_V2/dev/dev_rv/src/XMLIO/domain.hpp	(revision 134)
+++ XMLIO_V2/dev/dev_rv/src/XMLIO/domain.hpp	(revision 137)
@@ -11,168 +11,150 @@
       public:
 
-         CDomain(void) : ObjectTemplate<CDomain>(), DomainAttribut()
-         { /* Ne rien faire de plus */ }
-         CDomain(const string& _id) : ObjectTemplate<CDomain>(_id), DomainAttribut()
+         CDomain(void)
+            : ObjectTemplate<CDomain>(), DomainAttribut()
          { /* Ne rien faire de plus */ }
 
-         static string GetName(void) {return ("domain"); }
+         CDomain(const string& _id)
+            : ObjectTemplate<CDomain>(_id), DomainAttribut()
+         { /* Ne rien faire de plus */ }
+
+         static string GetName(void)    { return ("domain"); }
          static string GetDefName(void) { return (CDomain::GetName()); }
 
          inline void check(void) ;
 
-         ~CDomain(void) { /* Ne rien faire de plus */ }
+         ~CDomain(void)
+         { /* Ne rien faire de plus */ }
 
    }; // class Domain
 
    void CDomain::check(void)
-   {
-      //static bool isChecked = false ;
+   { // RecodÃ©e en partie le 17/11/10
 
-      //if (isChecked) return; // Si la vÃ©rification a Ã©tÃ© faite, on arrÃªte tout.
+      // Domaine global //
+      if ((!ni_glo.hasValue() || ni_glo <= 0 ) ||
+          (!nj_glo.hasValue() || nj_glo <= 0 ))
+        ERROR("Le domaine global est mal dÃ©fini, vÃ©rifiez les valeurs de \'ni_glo\' et \'nj_glo\' !") ;
 
-      // domaine global
-      if (!ni_glo.hasValue() || ni_glo<=0 ) throw XMLIOSERVER::XMLIOUndefinedValueException("domaine global mal defini") ;
-      if (!nj_glo.hasValue() || nj_glo<=0 ) throw XMLIOSERVER::XMLIOUndefinedValueException("domaine global mal defini") ;
+      // Domaine local en i //
+      if (ni.hasValue() && ibegin.hasValue() && !iend.hasValue())
+         iend = ibegin + ni - 1 ;
+      else if (ni.hasValue() && iend.hasValue() && !ibegin.hasValue())
+         ibegin = ni - iend + 1 ;
+      else if (ibegin.hasValue() && iend.hasValue() && !ni.hasValue())
+         ni = iend - ibegin - 1 ;
+      else if (ibegin.hasValue() && iend.hasValue() &&
+               ni.hasValue() && (iend != ibegin + ni - 1))
+         ERROR("Le domaine est mal dÃ©fini, iend est diffÃ©rent de (ibegin + ni - 1) !") ;
+      else
+         ERROR("Le domaine est mal dÃ©fini, deux valeurs au moins parmis iend, ibegin, ni doivent Ãªtre dÃ©finies !") ;
 
-      //domaine local en i
-      if ( ni.hasValue() && ibegin.hasValue())
+      if (ni < 0 || ibegin > iend ||
+          ibegin < 1 || iend > ni_glo)
+         ERROR("Domaine local mal dÃ©fini, vÃ©rifiez les valeurs ni, ni_glo, ibegin, iend") ;
+
+      // Domaine local en j //
+      if (nj.hasValue() && jbegin.hasValue() && !jend.hasValue())
+         jend = jbegin + nj - 1 ;
+      else if (nj.hasValue() && jend.hasValue() && !jbegin.hasValue())
+         jbegin = nj - jend + 1 ;
+      else if (jbegin.hasValue() && jend.hasValue() && !nj.hasValue())
+         nj = jend - jbegin - 1 ;
+      else if (jbegin.hasValue() && jend.hasValue() &&
+               nj.hasValue() && (jend != jbegin + nj - 1))
+         ERROR("Le domaine est mal dÃ©fini, jend est diffÃ©rent de (jbegin + nj - 1) !") ;
+      else
+         ERROR("Le domaine est mal dÃ©fini, deux valeurs au moins parmis jend, jbegin, nj doivent Ãªtre dÃ©finjes !") ;
+
+      if (nj < 0 || jbegin > jend ||
+          jbegin < 1 || jend > nj_glo)
+         ERROR("Domaine local mal dÃ©fini, vÃ©rifiez les valeurs nj, nj_glo, jbegin, jend") ;
+
+      // Masque de domaine //
+      if (mask.hasValue())
       {
-         if (iend.hasValue() && iend!=ibegin+ni-1) throw XMLIOSERVER::XMLIOUndefinedValueException("domain local mal dÃ©fini 1") ;
-         iend = ibegin + ni - 1 ;
+         if ((mask->extent(0) != ni) ||
+             (mask->extent(1) != nj))
+            ERROR("Le masque n'a pas la mÃªme taille que le domaine local") ;
       }
-      else if (ni.hasValue() && iend.hasValue())
-      {
-         if (ibegin != ni-iend+1) throw XMLIOSERVER::XMLIOUndefinedValueException("domain local mal dÃ©fini 2") ;
-         ibegin = ni - iend + 1 ;
-      }
-      else if (ibegin.hasValue() && iend.hasValue())
-      {
-         if (ni!=iend-ibegin-1) throw XMLIOSERVER::XMLIOUndefinedValueException("domain local mal dÃ©fini 3") ;
-         ni = iend - ibegin - 1 ;
-      }
-      else throw XMLIOSERVER::XMLIOUndefinedValueException("domain local non dÃ©fini 4") ;
-
-      if (ni<0 || ibegin>iend || ibegin<1 || iend>ni_glo) throw XMLIOSERVER::XMLIOUndefinedValueException("domain local mal dÃ©fini 5") ;
-
-      //domaine local en j
-      if ( nj.hasValue() && jbegin.hasValue())
-      {
-         if (jend.hasValue() && jend!=jbegin+nj-1) throw XMLIOSERVER::XMLIOUndefinedValueException("domain local mal dÃ©fini 6") ;
-         jend = jbegin + nj - 1 ;
-      }
-      else if (nj.hasValue() && jend.hasValue())
-      {
-         if (jbegin!=nj-jend+1) throw XMLIOSERVER::XMLIOUndefinedValueException("domain local mal dÃ©fini 7") ;
-         jbegin = nj - jend + 1 ;
-      }
-      else if (jbegin.hasValue() && jend.hasValue())
-      {
-         if (nj!=jend-jbegin-1) throw XMLIOSERVER::XMLIOUndefinedValueException("domain local mal dÃ©fini 8") ;
-         nj = jend - jbegin - 1 ;
-      }
-      else throw XMLIOSERVER::XMLIOUndefinedValueException("domain local non dÃ©fini 9") ;
-
-      if (nj<0 || jbegin>jend || jbegin<1 || jend>nj_glo) throw XMLIOSERVER::XMLIOUndefinedValueException("domain local mal dÃ©fini 10") ;
-
-      //cout<<"mask ni "<<mask->extent(0)<<" nj "<<mask->extent(1)<<"  "<<mask<<endl ;
-      if (mask.hasValue())
-         if (mask->extent(0) != ni || mask->extent(1) != nj)
-            throw XMLIOSERVER::XMLIOUndefinedValueException("le champ mask n'a pas la mÃªme taille que le domaine local") ;
-
-      if (data_dim.hasValue())
-      {
-         if (!(data_dim==1 || data_dim==2)) throw XMLIOSERVER::XMLIOUndefinedValueException("dimension non comptatible (doit Ãªtre 1 ou 2)") ;
-      }
-      else throw XMLIOSERVER::XMLIOUndefinedValueException("Dimension des donnÃ©e non dÃ©finie") ;
-
-      if (data_ni.hasValue())
-      {
-         if (data_ni<=0) throw XMLIOSERVER::XMLIOUndefinedValueException("Dimension des donnÃ©es nÃ©gative") ;
-      }
-      else
-      {
-         if (data_dim==1) data_ni=ni*nj ;
-         else data_ni=(int) ni ;
+      else // (!mask.hasValue())
+      { // Si aucun masque n'est dÃ©fini, on en crÃ©e un nouveau qui valide l'intÃ©gralitÃ© du domaine.
+         Array<bool, 2> __arr(shape(ni, nj));
+         __arr = true ;
+         mask->resize(shape(ni,nj)) ;
+         this->set_mask(__arr);
       }
 
-      if (!data_ibegin.hasValue()) data_ibegin=0 ;
+      // DonnÃ©es du domaine //
+      if (!data_jbegin.hasValue()) data_jbegin = 0 ;
+      if (!data_ibegin.hasValue()) data_ibegin = 0 ;
 
-      if (data_nj.hasValue())
-      {
-         if (data_nj<=0) throw XMLIOSERVER::XMLIOUndefinedValueException("Dimension des donnÃ©es nÃ©gative") ;
-      }
-      else data_nj=(int) nj ;
+      if (data_dim.hasValue() &&
+        !(data_dim==1 || data_dim==2))
+         ERROR("Dimension des donnÃ©es non comptatible (doit Ãªtre 1 ou 2) !") ;
+      else if (! data_dim.hasValue())
+         ERROR("Dimension des donnÃ©es non dÃ©finie !") ;
 
-      if (!data_jbegin.hasValue()) data_jbegin=0 ;
+      if (data_ni.hasValue() && (data_ni <= 0))
+         ERROR("Dimension des donnÃ©es nÃ©gative (data_ni).") ;
+      else if (!data_ni.hasValue())
+         data_ni = (data_dim == 1) ? (ni * nj) : (int) ni;
 
-      if (!mask.hasValue())
-      { // Si aucun masque n'est dÃ©fini, on en crÃ©e un nouveau qui valide l'intÃ©gralitÃ© du domaine.
-         mask->resize(shape(ni,nj)) ;
-         *mask=true ;
-      }
+      if (data_nj.hasValue() && (data_nj <= 0))
+         ERROR("Dimension des donnÃ©es nÃ©gative (data_nj).") ;
+      else if (!data_nj.hasValue())
+         data_nj = (int) nj ;
 
-      // Gestion de la compression
-
+      // Gestion de la compression //
       if (data_i_index.hasValue())
       {
-         if (data_n_index.hasValue())
+         if (data_n_index.hasValue() &&
+            (data_n_index != data_i_index->extent(0)))
+            ERROR("Dimension data_i_index incompatible avec data_n_index.") ;
+         else if (!data_n_index.hasValue())
+            data_n_index = data_i_index->extent(0) ;
+
+         if (data_dim == 2)
          {
-            if (data_n_index!=data_i_index->extent(0))
-               throw XMLIOSERVER::XMLIOUndefinedValueException("Dimension data_i_index incompatible avec data_n_index") ;
-         }
-         else data_n_index=data_i_index->extent(0) ;
-
-         if (data_dim==2)
-         {
-            if (data_j_index.hasValue())
-            {
-               if (data_j_index->extent(0)!=data_i_index->extent(0))
-                  throw XMLIOSERVER::XMLIOUndefinedValueException("Dimension data_j_index incompatible avec data_i_index") ;
-            }
-            else throw XMLIOSERVER::XMLIOUndefinedValueException("data_j_index non dÃ©fini") ;
+            if (data_j_index.hasValue() &&
+               (data_j_index->extent(0) != data_i_index->extent(0)))
+               ERROR("Dimension data_j_index incompatible avec data_i_index.") ;
+            else if (!data_j_index.hasValue())
+               ERROR("La donnÃ©e data_j_index doit Ãªtre renseignÃ©e !") ;
          }
       }
       else
       {
-         if (data_n_index.hasValue() || (data_dim==2 && data_j_index.hasValue()))
-            throw XMLIOSERVER::XMLIOUndefinedValueException("data_i_index non dÃ©fini") ;
+         if (data_n_index.hasValue() ||
+            ((data_dim == 2) && (data_j_index.hasValue())))
+            ERROR("data_i_index non dÃ©fini") ;
       }
-      //cout<<"data_n_index.hasValue() "<<data_n_index.hasValue()<<endl ;
+
       if (!data_n_index.hasValue())
-      {
-         if (data_dim==1)
+      { // -> bloc re-vÃ©rfiÃ© OK
+         if (data_dim == 1)
          {
-            int i ;
-            data_n_index=*data_ni ;
-            //cout <<"data_n_index "<<data_n_index<<"  "<<data_ni<<" "<<data_nj<<endl ;
-
-            data_i_index->resize(data_n_index) ;
-
-            for (i=0;i<data_ni;i++) (*data_i_index)(i)=i ;
-            //cout <<"data_i_index "<<*data_i_index<<endl ;
+            const int dni = data_ni;
+            Array<int, 1> __arri(shape(dni));
+            this->set_data_n_index(dni) ;
+            for (int i = 0; i < dni; i++)
+               __arri(i) = i+1 ;
+            data_i_index->resize(dni) ;
+            this->set_data_i_index(__arri) ;
          }
-         else   // data_dim=2
+         else   // (data_dim == 2)
          {
-            int i ;
-            int j ;
-            int count ;
-
-            data_n_index = data_ni * data_nj ;
-            data_i_index -> resize(data_n_index) ;
-            data_j_index -> resize(data_n_index) ;
-            for(count=0,i=0; i<data_ni;i++)
-               for(j=0; j<data_nj;j++)
-               {
-                  (*data_i_index)(count)=i ;
-                 // cout<<count<<"  "<<(*data_i_index)(count)<<endl ;
-                  (*data_j_index)(count)=j ;
-                  //cout<<count<<"  "<<(*data_j_index)(count)<<endl ;
-                  count++ ;
-               }
-               //cout<<data_ni<<" "<<data_nj<<" "<<data_n_index<<" "<<*data_i_index<<" "<<*data_j_index<<endl ;
+            const int dni = data_ni * data_nj;
+            Array<int, 1> __arri(shape(dni)), __arrj(shape(dni));
+            this->set_data_n_index(dni) ;
+            for(int count = 0, i = 0; i  <data_ni; i++)
+               for(int j = 0; j < data_nj; j++, count++)
+               { __arri(count) = i+1 ;  __arrj(count) = j+1 ; }
+            data_i_index -> resize(dni) ;
+            data_j_index -> resize(dni) ;
+            this->set_data_i_index(__arri) ;
+            this->set_data_j_index(__arrj) ;
          }
       }
-
-      //isChecked = true ;
    }
 
Index: XMLIO_V2/dev/dev_rv/src/XMLIO/domain_attribut.hpp
===================================================================
--- XMLIO_V2/dev/dev_rv/src/XMLIO/domain_attribut.hpp	(revision 134)
+++ XMLIO_V2/dev/dev_rv/src/XMLIO/domain_attribut.hpp	(revision 137)
@@ -37,6 +37,7 @@
          DECLARE_ATTR(data_j_index  , Array(int, 1)) ;
 
-         DECLARE_ATTR(xvalue        , Array(double, 1)) ;
-         DECLARE_ATTR(yvalue        , Array(double, 1)) ;
+         DECLARE_ATTR(lonvalue      , Array(double, 1)) ;
+         DECLARE_ATTR(latvalue      , Array(double, 1)) ;
+         DECLARE_ATTR(domtype       , string);
 
          DomainAttribut(void) : AttributRegistrar()
@@ -69,6 +70,7 @@
             RegisterAttribut(&data_j_index) ;
 
-            RegisterAttribut(&xvalue) ;
-            RegisterAttribut(&yvalue) ;
+            RegisterAttribut(&lonvalue) ;
+            RegisterAttribut(&latvalue) ;
+            RegisterAttribut(&domtype) ;
          }
 
Index: XMLIO_V2/dev/dev_rv/src/XMLIO/duration.hpp
===================================================================
--- XMLIO_V2/dev/dev_rv/src/XMLIO/duration.hpp	(revision 134)
+++ XMLIO_V2/dev/dev_rv/src/XMLIO/duration.hpp	(revision 137)
@@ -28,5 +28,5 @@
             if(d.hour   != 0.0) { testValue = false; out << d.hour   << "h " ; }
             if(d.minute != 0.0) { testValue = false; out << d.minute << "mi "; }
-            if(d.second != 0.0 || testValue) { out << d.second << "s " ; }
+            if(d.second != 0.0 || testValue)       { out << d.second << "s " ; }
 
             _out << (out.str().substr(0, out.str().size()-1)); // << suppression de l'espace en fin de chaÃ®ne.
@@ -76,5 +76,5 @@
          }
 
-         struct _duration& resolve(const AbstractCalendar&);
+         inline struct _duration& resolve(const AbstractCalendar&);
 
          std::string toString(void) const
Index: XMLIO_V2/dev/dev_rv/src/XMLIO/exception.hpp
===================================================================
--- XMLIO_V2/dev/dev_rv/src/XMLIO/exception.hpp	(revision 134)
+++ XMLIO_V2/dev/dev_rv/src/XMLIO/exception.hpp	(revision 137)
@@ -34,6 +34,6 @@
          { /* Ne rien faire de plus */ }
 
-         ~XMLIOException() throw()
-         { /* Ne rien faire de plus */ }
+         ~XMLIOException(void) throw()
+         { std::cerr << displayText() << std::endl; }
 
          XMLIOException& operator = (const XMLIOException& _exc)
@@ -43,5 +43,5 @@
          virtual const char* className(void) const throw() { return (typeid(*this).name()); }
 
-         virtual Exception* clone(void) const {   return new XMLIOException(*this); }
+         virtual Exception* clone(void) const { return new XMLIOException(*this); }
          virtual void rethrow(void) const { throw *this; }
 
@@ -57,4 +57,7 @@
          const char* name(void) const throw()
          { return ("XMLIO>UndefinedValueException"); }
+
+         ~XMLIOUndefinedValueException(void) throw()
+         { std::cerr << displayText() << std::endl; }
 
    }; //class XMLIOUndefinedException
Index: XMLIO_V2/dev/dev_rv/src/XMLIO/file.hpp
===================================================================
--- XMLIO_V2/dev/dev_rv/src/XMLIO/file.hpp	(revision 134)
+++ XMLIO_V2/dev/dev_rv/src/XMLIO/file.hpp	(revision 137)
@@ -25,4 +25,11 @@
          const std::vector<CField*>& getEnabledFields    (void) const { return (enabledFields); }
 
+         FieldGroup * createVirtualFieldGroup(const std::string _id)
+         {
+            return (vfieldGroup == NULL)
+               ? vfieldGroup = (FieldGroup*) FieldGroup::CreateObject(_id)
+               : vfieldGroup;
+         }
+
          void initializeDataOutput(AbstractDataOutput* _output)
          {
@@ -94,5 +101,6 @@
                int default_outputlevel = 5, int default_level = 1, bool default_enabled = true )
          {
-            const int _outputlevel = (output_level.hasValue()) ? (int)output_level : default_outputlevel;
+            const int _outputlevel =
+               (output_level.hasValue()) ? (int)output_level : default_outputlevel;
             std::vector<CField*>::iterator it;
 
@@ -163,6 +171,9 @@
          }
 
-         virtual bool hasChild(void) const { return (vfieldGroup != NULL); }
-         virtual void printChild(ostream& out) const { out << *vfieldGroup << std::endl; }
+         virtual bool hasChild(void) const
+         { return (vfieldGroup != NULL); }
+
+         virtual void printChild(ostream& out) const
+         { out << *vfieldGroup << std::endl; }
 
          virtual void solveDescInheritance(const AttributRegistrar* const _parent = 0)
Index: XMLIO_V2/dev/dev_rv/src/XMLIO/group_template.hpp
===================================================================
--- XMLIO_V2/dev/dev_rv/src/XMLIO/group_template.hpp	(revision 134)
+++ XMLIO_V2/dev/dev_rv/src/XMLIO/group_template.hpp	(revision 137)
@@ -168,6 +168,9 @@
                   attributes.clear(); _node.getAttributes(attributes);
 
-                  if (name.compare(W::GetName()) == 0) { createGroupAndParse<W>(attributes, _node); continue; }
-                  if (name.compare(T::GetName()) == 0) { createChildAndParse<T>(attributes, _node); continue; }
+                  if (name.compare(W::GetName()) == 0)
+                  { createGroupAndParse<W>(attributes, _node); continue; }
+
+                  if (name.compare(T::GetName()) == 0)
+                  { createChildAndParse<T>(attributes, _node); continue; }
 
                   WARNING("Un objet de type \""+W::GetName()+"\" ne peut contenir qu'un object de type \""+T::GetName()+"\" ou \""+W::GetName()+"\" !");
Index: XMLIO_V2/dev/dev_rv/src/XMLIO/logger.hpp
===================================================================
--- XMLIO_V2/dev/dev_rv/src/XMLIO/logger.hpp	(revision 134)
+++ XMLIO_V2/dev/dev_rv/src/XMLIO/logger.hpp	(revision 137)
@@ -2,5 +2,4 @@
 #define __XMLIO_LOGGER__
 
-// EntÃªte Poco logging
 #include <csignal>
 
@@ -92,6 +91,9 @@
    }
 
-   std::ostream& IncIndent(std::ostream& out) { Indent++; return (NIndent(out)); }
-   std::ostream& DecEndl  (std::ostream& out) { Indent--; return (out); }
+   std::ostream& IncIndent(std::ostream& out)
+   { Indent++; return (NIndent(out)); }
+
+   std::ostream& DecEndl  (std::ostream& out)
+   { Indent--; return (out); }
    /////////////////////////////////////////////////////////////////////
 
Index: XMLIO_V2/dev/dev_rv/src/XMLIO/main.f90
===================================================================
--- XMLIO_V2/dev/dev_rv/src/XMLIO/main.f90	(revision 134)
+++ XMLIO_V2/dev/dev_rv/src/XMLIO/main.f90	(revision 137)
@@ -1,177 +1,186 @@
 ! --------------------------------------------------- !
-! ------------- XMLIO SERVER MAIN TEST  ------------- !
+!               XMLIO SERVER MAIN TEST                !
 ! --------------------------------------------------- !
 
-MODULE XTYPE
-   IMPLICIT NONE
-
-   ! Ne jamais modifier les valeurs internes de ce type dans le code fortran.
-   TYPE XHandle
-      INTEGER :: dtype
-      INTEGER :: daddr
-   END TYPE XHandle
-
-   TYPE XDate
-      INTEGER :: year, month, day, hour, minute, second
-   END TYPE XDate
-
-   TYPE XDuration
-      REAL(kind = 8) :: year, month, day, hour, minute, second
-   END TYPE XDuration
-
-   ! enum XDType
-   INTEGER, PARAMETER  :: NOTYPE = 0
-   INTEGER, PARAMETER  :: DTREATMENT = 1, DDATE = 2, CALENDAR = 3, ECONTEXT = 4
-   INTEGER, PARAMETER  :: EAXIS = 5 , EDOMAIN = 6 , EFIELD = 7 , EFILE = 8 , EGRID = 9
-   INTEGER, PARAMETER  :: GAXIS = 10, GDOMAIN = 11, GFIELD = 12, GFILE = 13, GGRID = 14
-
-   ! enum XFileType
-   INTEGER, PARAMETER  :: NETCDF4 = 0
-
-   ! Autres constantes
-   TYPE(XHandle)  , PARAMETER :: NULLHANDLE = XHandle(0, 0)
-   TYPE(XDuration), PARAMETER :: NONEDUR    = XDuration(0., 0., 0., 0., 0., 0.)
-
-END MODULE XTYPE
-
-MODULE IXHANDLE
-
-   INTERFACE
-
-      SUBROUTINE xios_handle_create(ret, dtype, idt)
-         USE XTYPE
-         TYPE(XHandle), INTENT(OUT) :: ret
-         INTEGER      , INTENT(IN)  :: dtype
-         CHARACTER*(*), INTENT(IN)  :: idt
-      END SUBROUTINE xios_handle_create
-
-   END INTERFACE
-
-END MODULE IXHANDLE
-
-MODULE IXML
-   IMPLICIT NONE
-   INTERFACE
-
-      SUBROUTINE xios_xml_Parse_File(filename)
-         CHARACTER*(*), INTENT(IN) :: filename
-      END SUBROUTINE xios_xml_Parse_File
-
-      SUBROUTINE xios_xml_Parse_String(xmlcontent)
-         CHARACTER*(*), INTENT(IN) :: xmlcontent
-      END SUBROUTINE xios_xml_Parse_String
-
-   END INTERFACE
-END MODULE IXML
-
-MODULE ICONTEXT
-   IMPLICIT NONE
-   INTERFACE
-
-      SUBROUTINE xios_context_set_current(context, withswap)
-         USE XTYPE
-         TYPE(XHandle),     INTENT(IN) :: context
-         LOGICAL, OPTIONAL, INTENT(IN) :: withswap
-      END SUBROUTINE xios_context_set_current
-
-      SUBROUTINE xios_context_get_current(context)
-         USE XTYPE
-         TYPE(XHandle), INTENT(IN) :: context
-      END SUBROUTINE xios_context_get_current
-
-      SUBROUTINE xios_context_get_calendar(context, calend)
-         USE XTYPE
-         TYPE(XHandle), INTENT(IN)  :: context
-         TYPE(XHandle), INTENT(OUT) :: calend
-      END SUBROUTINE xios_context_get_calendar
-
-   END INTERFACE
-
-END MODULE ICONTEXT
-
-MODULE ICALENDAR
-   IMPLICIT NONE
-   INTERFACE
-
-      SUBROUTINE xios_calendar_set_timestep(calend, dur)
-         USE XTYPE
-         TYPE(XHandle)  , INTENT(IN) :: calend
-         TYPE(XDuration), INTENT(IN) :: dur
-      END SUBROUTINE xios_calendar_set_timestep
-
-   END INTERFACE
-
-END MODULE ICALENDAR
-
-MODULE IDATATREATMENT
-   IMPLICIT NONE
-   INTERFACE
-
-      SUBROUTINE xios_dtreatment_new(dt, context)
-         USE XTYPE
-         TYPE(XHandle), INTENT(OUT) :: dt
-         TYPE(XHandle), INTENT(IN)  :: context
-      END SUBROUTINE xios_dtreatment_new
-
-      SUBROUTINE xios_dtreatment_create_files_and_headers(dt, ftype)
-         USE XTYPE
-         TYPE(XHandle), INTENT(IN) :: dt
-         INTEGER      , INTENT(IN) :: ftype
-      END SUBROUTINE xios_dtreatment_create_files_and_headers
-
-   END INTERFACE
-END MODULE IDATATREATMENT
-
 PROGRAM MAIN
-   USE XTYPE
    USE IXHANDLE
    USE IXML
+   USE IXMLTREE
    USE ICONTEXT
+   USE ICALENDAR
+   USE IEXTENDED
    USE IDATATREATMENT
-   USE ICALENDAR
 
-   IMPLICIT NONE
+   INTEGER       :: compt = 0
 
-   INTEGER         :: compt
-   TYPE(XHandle)   :: context1    = NULLHANDLE
-   TYPE(XHandle)   :: dtreat      = NULLHANDLE
-   TYPE(XHandle)   :: calend      = NULLHANDLE
+   TYPE(XHandle) :: nemo_style_ctxt     = NULLHANDLE, &
+                    orchidee_style_ctxt = NULLHANDLE, &
+                    lmdz_style_ctxt     = NULLHANDLE
+
+   TYPE(XHandle) :: temp_mod  = NULLHANDLE, &
+                    temp_mod_ = NULLHANDLE
+
+   ! Axes verticaux
+   REAL(kind = 8), DIMENSION(10) :: vaxis  = (/(i, i=1, 10)/)
+                                    !vvaxis = (/(i, i=1, 5)/)
+
+   ! Domaines horizontaux
+   REAL(kind = 8), DIMENSION(20) :: lonrect_orch0  = (/(i, i=11, 30)/),&
+                                    latrect_orch0  = (/(i, i=11, 30)/)
+
+   REAL(kind = 8), DIMENSION(10,10) :: loncurv_nemo0  = 1, &
+                                       latcurv_nemo0  = 1
+
+   ! Les durÃ©es
    TYPE(XDuration) :: timestep_1h = XDuration(0., 0., 0., 1., 0., 0.)
+                      !timestep_2h = XDuration(0., 0., 0., 2., 0., 0.)
+
+   ! Les masques
+   LOGICAL(kind = 1), DIMENSION(20, 20) :: mask0  = .TRUE._1
+
+   CHARACTER(len = *), PARAMETER :: filename = &
+            "/local/XMLIOSERVER_DEV/dev_rv/test/iodef_simple_test.xml"
+
+   !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
 
    ! Parsing du document xml depuis un fichier situÃ© sur le disque.
-   CALL xios_xml_Parse_File("/local/XMLIOSERVER_DEV/dev_rv/test/iodef_simple_test.xml")
+   CALL xml_Parse_File(filename)
 
-   ! Le calendrier doit Ãªtre initialisÃ© ici s'il ne l'a pas dÃ©jÃ  Ã©tÃ© depuis le document xml.
+   ! CrÃ©ation de handle sur les contextes exstants dans lequels on souhaite travailler.
+   CALL handle_create(nemo_style_ctxt, ECONTEXT, "nemo_style")
+   CALL context_set_current(nemo_style_ctxt)
 
-   ! CrÃ©ation d'un handle sur le contexte dans lequel on souhaite travailler, cÃ d 'context1' ici.
-   CALL xios_handle_create(context1, ECONTEXT, "context1")
-   iF ((context1%dtype == 0) .AND. (context1%daddr == 0)) THEN
-      PRINT *, "Impossible de crÃ©er un handle sur l'Ã©lÃ©ment context1 !"
-      STOP
-   END IF
+   CALL handle_create(temp_mod, EDOMAIN,  "domaine0")
+      CALL xml_domain_addAttribut(domain_hdl    = temp_mod,      &
+                                  lonvalue_curv = loncurv_nemo0, &
+                                  latvalue_curv = latcurv_nemo0, &
+                                  domtype       = "curvilinear")
+
+   CALL handle_create(lmdz_style_ctxt, ECONTEXT, "lmdz_style")
+   CALL context_set_current(lmdz_style_ctxt)
+
+   !!!!!!!!!!!!!!!!!!!! EXEMPLE RECONSTRUCTION !!!!!!!!!!!!!!!!!!!!!
+   ! On crÃ©e un nouveau context et on lui associe un handle.
+   CALL context_create(context_hdl   = orchidee_style_ctxt, &
+                       context_id    = "orchidee_style",    &
+                       calendar_type = GREGORIAN)
+
+   ! ---------> field_dÃ©finition
+   CALL handle_create(temp_mod, GFIELD,  "field_definition")
+      CALL xml_tree_add(parent_hdl = temp_mod,        &
+                        child_hdl  = temp_mod_,       &
+                        child_type = GFIELD,          &
+                        child_id   = "ss_fieldgroup")
+      CALL xml_group_field_addAttribut(gfield_hdl = temp_mod_, &
+                                       flevel     = 1,         &
+                                       fprec      = 4,         &
+                                       fenabled   = .TRUE._1)
+         CALL xml_tree_add(parent_hdl = temp_mod_,    &
+                           child_hdl  = temp_mod ,    &
+                           child_type = EFIELD,       &
+                           child_id   = "field0")
+         CALL xml_field_addAttribut(field_hdl      = temp_mod,       &
+                                    fname          = "field0_name",  &
+                                    fstandard_name = "field0_sname", &
+                                    flong_name     = "field0_lname", &
+                                    funit          = "Pa",           &
+                                    foperation     = "inst",         &
+                                    ffreq_op       = timestep_1h,    &
+                                    fgrid_ref      = "grid0")
+   ! ---------> axis_dÃ©finition
+   CALL handle_create(temp_mod, GAXIS,   "axis_definition")
+      CALL xml_tree_add(parent_hdl = temp_mod,        &
+                        child_hdl  = temp_mod_,       &
+                        child_type = GAXIS,           &
+                        child_id   = "ss_axisgroup")
+      CALL xml_group_axis_addAttribut(gaxis_hdl = temp_mod_, &
+                                      aunit     = "SI")
+         CALL xml_tree_add(parent_hdl = temp_mod_,    &
+                           child_hdl  = temp_mod ,    &
+                           child_type = EAXIS,        &
+                           child_id   = "axis0")
+         CALL xml_axis_addAttribut(axis_hdl       = temp_mod,             &
+                                   aname          = "saxev",              &
+                                   astandard_name = "saxev",              &
+                                   along_name     = "Simple axe vertical",&
+                                   avalue         = vaxis)
+
+   ! ---------> domain_dÃ©finition
+   CALL handle_create(temp_mod, GDOMAIN, "domain_definition")
+      CALL xml_tree_add(parent_hdl = temp_mod,        &
+                        child_hdl  = temp_mod_,       &
+                        child_type = GDOMAIN,         &
+                        child_id   = "ss_domaingroup")
+      CALL xml_group_domain_addAttribut(gdomain_hdl = temp_mod_, &
+                                        ni_glo      = 40,        &
+                                        nj_glo      = 40)
+         CALL xml_tree_add(parent_hdl = temp_mod_,    &
+                           child_hdl  = temp_mod ,    &
+                           child_type = EDOMAIN,      &
+                           child_id   = "domain0")
+         CALL xml_domain_addAttribut(domain_hdl     = temp_mod,             &
+                                     dname          = "Compressee",         &
+                                     dstandard_name = "DomOrchTest",        &
+                                     dlong_name     = "Test type orchidee", &
+                                     ibegin         = 10,                   &
+                                     iend           = 31,                   &
+                                     jbegin         = 10,                   &
+                                     jend           = 31,                   &
+                                     mask           = mask0,                &
+                                     data_dim       = 1,                    &
+                                     data_ni        = 400,                  &
+                                     data_ibegin    = 1,                    &
+                                     lonvalue_rect  = lonrect_orch0,        &
+                                     latvalue_rect  = latrect_orch0,        &
+                                     domtype        = "rectilinear")
+
+   ! ---------> file_dÃ©finition
+   CALL handle_create(temp_mod, GFILE,   "file_definition")
+      CALL xml_tree_add(parent_hdl = temp_mod,        &
+                        child_hdl  = temp_mod_,       &
+                        child_type = GFILE)
+      CALL xml_group_file_addAttribut(gfile_hdl = temp_mod_,   &
+                                      fofreq   = timestep_1h,  &
+                                      folevel   = 2,           &
+                                      fenabled  = .TRUE._1)
+         CALL xml_tree_add(parent_hdl = temp_mod_,    &
+                           child_hdl  = temp_mod ,    &
+                           child_type = EFILE,        &
+                           child_id   = "file0")
+         CALL xml_file_addAttribut(file_hdl     = temp_mod,                      &
+                                   fname        = "data/orchidee_test.nc",       &
+                                   fdescription = "Test sur grille type orchidee")
+            CALL xml_tree_add(parent_hdl = temp_mod , &
+                              child_hdl  = temp_mod_, &
+                              child_type = EFIELD)
+            CALL xml_field_addAttribut(field_hdl  = temp_mod_, &
+                                       ffield_ref = "field0")
+
+   ! ---------> grid_dÃ©finition
+   CALL handle_create(temp_mod, GGRID,   "grid_definition")
+      CALL xml_tree_add(parent_hdl = temp_mod,        &
+                        child_hdl  = temp_mod_,       &
+                        child_type = GGRID,           &
+                        child_id   = "ss_gridgroup")
+      CALL xml_group_grid_addAttribut(ggrid_hdl    = temp_mod_, &
+                                      gdomain_ref  = "domain0", &
+                                      gaxis_ref    = "axis0");
+         CALL xml_tree_add(parent_hdl = temp_mod_,    &
+                           child_hdl  = temp_mod ,    &
+                           child_type = EGRID,        &
+                           child_id   = "grid0")
+         CALL xml_grid_addAttribut(grid_hdl     = temp_mod,           &
+                                   gname        = "GRectiCompressee", &
+                                   gdescription = "Grille orchidee");
+
+   !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+   ! Affichage de l'arbre xml au niveau de la sortie.
+   CALL xml_tree_show("xmlio_tree_prev.log")
+   ! CALL xml_tree_show()
 
    ! ----------- DÃ©but du traitement ----------- !
-
-   CALL xios_context_set_current(context1, .TRUE.)
-
-   ! CrÃ©ation et initialisation d'une instance de traitement des donnÃ©es dans 'context1'.
-   CALL xios_dtreatment_new(dtreat, context1)
-   iF ((dtreat%dtype == 0) .AND. (dtreat%daddr == 0)) THEN
-      PRINT *, "Impossible d'initialiser l'instance de traitement !"
-      STOP
-   END IF
-
-   ! CrÃ©ation des fichiers et des entÃªtes dans le contexte.
-   CALL xios_dtreatment_create_files_and_headers(dtreat, NETCDF4)
-
-   ! On rÃ©cupÃ©re le calendrier associÃ© au contexte en cours de traitement.
-   CALL xios_context_get_calendar(context1, calend)
-   iF ((calend%dtype == 0) .AND. (calend%daddr == 0)) THEN
-      PRINT *, "Impossible de rÃ©cupÃ©rer le calendrier !"
-      STOP
-   END IF
-
-   ! On change la durÃ©e du timestep.
-   CALL xios_calendar_set_timestep(calend, timestep_1h)
+   ! On choisit le context dans lequel on va travailler et on commence le traitement des donnÃ©es.
+   CALL dtreatment_start(orchidee_style_ctxt, NETCDF4)
 
    ! ExÃ©cution de la boucle de calcul-Ã©criture.
@@ -180,3 +189,6 @@
    END DO
 
+   ! Affichage de l'arbre xml au niveau de la sortie.
+   CALL xml_tree_show("xmlio_tree_next.log")
+
 END PROGRAM MAIN
Index: XMLIO_V2/dev/dev_rv/src/XMLIO/object_template.hpp
===================================================================
--- XMLIO_V2/dev/dev_rv/src/XMLIO/object_template.hpp	(revision 134)
+++ XMLIO_V2/dev/dev_rv/src/XMLIO/object_template.hpp	(revision 137)
@@ -147,10 +147,15 @@
          }
 
-         static const StrHashMap<T>& GetCurrentListObject(void) { return (AllListObj[CurrContext]); }
-         static Poco::HashMap<string, StrHashMap<T> >& GetAllListObject(void) { return (AllListObj); }
-
-         static void SetContext(const string& id) { ObjectTemplate<T>::CurrContext = id; }
-
-         static string& GetCurrentContextId(void) { return (ObjectTemplate<T>::CurrContext); }
+         static const StrHashMap<T>& GetCurrentListObject(void)
+         { return (AllListObj[CurrContext]); }
+
+         static Poco::HashMap<string, StrHashMap<T> >& GetAllListObject(void)
+         { return (AllListObj); }
+
+         static void SetContext(const string& id)
+         { ObjectTemplate<T>::CurrContext = id; }
+
+         static string& GetCurrentContextId(void)
+         { return (ObjectTemplate<T>::CurrContext); }
 
       protected :
@@ -179,5 +184,6 @@
          }
 
-         template <class V> static V* CreateInstanceAndParse(XMLNode& _node, const char* defaultId, bool parseAttr = true )
+         template <class V>
+            static V* CreateInstanceAndParse(XMLNode& _node, const char* defaultId, bool parseAttr = true )
          {
             V* instance_ptr = NULL; string did(defaultId);
Index: XMLIO_V2/dev/dev_rv/src/XMLIO/xml_node.hpp
===================================================================
--- XMLIO_V2/dev/dev_rv/src/XMLIO/xml_node.hpp	(revision 134)
+++ XMLIO_V2/dev/dev_rv/src/XMLIO/xml_node.hpp	(revision 137)
@@ -36,5 +36,5 @@
             bool goToChildElement(void)
             {
-               Poco::XML::Node* nextElement = this->getCNode()->firstChild();
+               Poco::XML::Node * nextElement = this->getCNode()->firstChild();
 
                // On parcourt la liste des enfants jusqu'Ã  trouver un Ã©lÃ©ment quelconque.
