Index: ruby/trunk/lib/open_ehr/serializer.rb
===================================================================
--- ruby/trunk/lib/open_ehr/serializer.rb	(revision 407)
+++ ruby/trunk/lib/open_ehr/serializer.rb	(revision 408)
@@ -23,5 +23,5 @@
           hd << " (adl_version = #{@archetype.adl_version})"
         end
-        hd << NL+INDENT + "#{@archetype.archetype_id.value}"+NL+NL
+        hd << NL+INDENT + "#{@archetype.archetype_id.value}"+NL*2
         hd << 'concept'+NL+ INDENT+"[#{@archetype.concept}]"+NL
         hd << NL+'language'+NL+INDENT+'original_language = <['+
@@ -32,5 +32,50 @@
 
       def description
-
+        desc = ''
+        if @archetype.description
+          ad = @archetype.description
+          desc << 'description' + NL
+          desc << INDENT + 'original_author = <' + NL
+          ad.original_author.each do |k,v|
+            desc << INDENT+INDENT+'["'+k+'"] = <"'+v+'">'+NL
+          end
+          desc << INDENT+'>'+NL
+          desc << INDENT+'lifecycle_state = <"'+ad.lifecycle_state+'">'+NL
+          desc << INDENT+'details = <'+NL
+          ad.details.each do |lang,item|
+            desc << INDENT*2+'["'+lang+'"] = <'+NL
+            desc << INDENT*3+'language = <['+
+              item.language.terminology_id.value+'::'+
+              item.language.code_string+']>'+NL
+            desc << INDENT*3+'purpose = <"'+item.purpose+'">'+NL
+            if item.keywords then
+              desc << INDENT*3+'keywords = <'
+              item.keywords.each do |word|
+                desc << '"'+word+'",'
+              end
+              desc.chop! << '>'+NL
+            end
+            desc << INDENT*3+'use = <"'+item.use+'">'+NL if item.use
+            desc << INDENT*3+'misuse = <"'+item.misuse+'">'+NL if item.misuse
+            desc << INDENT*3+'copyright = <"'+item.copyright+'">'+NL if item.copyright
+            if item.original_resource_uri
+              desc << INDENT*3 + 'original_resource_uri = <'
+              item.original_resource_uri.each do |k,v|
+                desc << INDENT*4+'["'+k+'"] = <"'+v+'">'+NL
+              end
+              desc << INDENT*3+'>'+NL
+            end
+            if item.other_details
+              desc << INDENT*3 + 'other_details = <'
+              item.original_resource_uri.each do |k,v|
+                desc << INDENT*4+'["'+k+'"] = <"'+v+'">'+NL
+              end
+              desc << INDENT*3+'>'+NL
+            end
+            desc << INDENT*2+'>'+NL
+          end
+          desc << INDENT+'>'+NL
+        end
+        return desc
       end
 
@@ -59,8 +104,8 @@
         xml.concept @archetype.concept
         xml.original_language do
-          xml.code_string @archetype.original_language.code_string
           xml.terminology_id do
             xml.value @archetype.original_language.terminology_id.value
           end
+          xml.code_string @archetype.original_language.code_string
         end
         return header
@@ -68,5 +113,40 @@
 
       def description
-        
+        desc = ''
+        xml = Builder::XmlMarkup.new(:indent => 2, :target => desc)
+        ad = @archetype.description
+        if ad
+          xml.description do
+            ad.original_author.each do |key,value|
+              xml.original_author(value,"id"=>key)
+            end
+            if ad.other_contributors
+              ad.other_contributors.each do |co|
+                xml.other_contributors co
+              end
+            end
+            xml.lifecycle_state ad.lifecycle_state
+            xml.details do
+              ad.details.each do |lang, item|
+                xml.language do
+                  xml.terminology_id do
+                    xml.value item.language.terminology_id.value
+                  end
+                  xml.code_string lang
+                end
+                xml.purpose item.purpose
+                xml.use item.use if item.use
+                xml.misuse item.misuse if item.misuse
+                xml.copyright item.copyright if item.copyright
+                if ad.other_details
+                  ad.other_details.each do |key,value|
+                    xml.other_details(value, "id"=>key)
+                  end
+                end
+              end
+            end
+          end
+        end
+        return desc
       end
 
Index: ruby/trunk/spec/lib/open_ehr/serializer/adl_serializer_spec.rb
===================================================================
--- ruby/trunk/spec/lib/open_ehr/serializer/adl_serializer_spec.rb	(revision 407)
+++ ruby/trunk/spec/lib/open_ehr/serializer/adl_serializer_spec.rb	(revision 408)
@@ -13,5 +13,5 @@
     adl = adl_file.readlines
     @sample_header = adl[0..7].join
-    @sample_description = adl[8..24].join
+    @sample_description = adl[9..22].join
     adl_file.close
   end
@@ -28,3 +28,7 @@
     @adl_serializer.header.should == @sample_header
   end
+
+  it 'description should return archetype description' do
+    @adl_serializer.description.should == @sample_description
+  end
 end
Index: ruby/trunk/spec/lib/open_ehr/serializer/openEHR-EHR-SECTION.test.v1.adl
===================================================================
--- ruby/trunk/spec/lib/open_ehr/serializer/openEHR-EHR-SECTION.test.v1.adl	(revision 407)
+++ ruby/trunk/spec/lib/open_ehr/serializer/openEHR-EHR-SECTION.test.v1.adl	(revision 408)
@@ -6,16 +6,16 @@
 
 language
-    original_language = <[openEHR::ja]>
+    original_language = <[ISO_639-1::ja]>
 
 description
     original_author = <
+        ["name"] = <"Shinji KOBAYASHI">
+        ["organisation"] = <"openEHR.jp">
         ["email"] = <"skoba@moss.gr.jp">
-        ["organisation"] = <"openEHR.jp">
-        ["name"] = <"Shinji KOBAYASHI">
     >
     lifecycle_state = <"draft">
     details = <
         ["ja"] = <
-            language = <[openEHR::ja]>
+            language = <[ISO_639-1::ja]>
             purpose = <"Serializer test">
             misuse = <"evaluate message">
Index: ruby/trunk/spec/lib/open_ehr/serializer/sample_archetype_spec.rb
===================================================================
--- ruby/trunk/spec/lib/open_ehr/serializer/sample_archetype_spec.rb	(revision 407)
+++ ruby/trunk/spec/lib/open_ehr/serializer/sample_archetype_spec.rb	(revision 408)
@@ -24,5 +24,5 @@
     archetype_id = ArchetypeID.new(:value => 
                                    'openEHR-EHR-SECTION.test.v1')
-    terminology_id = TerminologyID.new(:value => 'openEHR')
+    terminology_id = TerminologyID.new(:value => 'ISO_639-1')
     original_language = CodePhrase.new(:code_string => 'ja',
                                        :terminology_id => terminology_id)
@@ -40,7 +40,7 @@
                                   :misuse => 'evaluate message')
     details = {'ja' => resource_description_item}
-    decription = ResourceDescription.new(:original_author => original_author,
-                                         :lifecycle_state => 'draft',
-                                         :details => details)
+    description = ResourceDescription.new(:original_author => original_author,
+                                          :lifecycle_state => 'draft',
+                                          :details => details)
     @archetype = Archetype.new(:archetype_id => archetype_id,
                                :concept => 'at0000',
Index: ruby/trunk/spec/lib/open_ehr/serializer/xml_serializer_spec.rb
===================================================================
--- ruby/trunk/spec/lib/open_ehr/serializer/xml_serializer_spec.rb	(revision 407)
+++ ruby/trunk/spec/lib/open_ehr/serializer/xml_serializer_spec.rb	(revision 408)
@@ -22,10 +22,31 @@
 <concept>at0000</concept>
 <original_language>
+  <terminology_id>
+    <value>ISO_639-1</value>
+  </terminology_id>
   <code_string>ja</code_string>
-  <terminology_id>
-    <value>openEHR</value>
-  </terminology_id>
 </original_language>
 END
   end
+
+  it 'should return XML formatted description' do
+    @xml_serializer.description.should == <<END
+<description>
+  <original_author id="name">Shinji KOBAYASHI</original_author>
+  <original_author id="organisation">openEHR.jp</original_author>
+  <original_author id="email">skoba@moss.gr.jp</original_author>
+  <lifecycle_state>draft</lifecycle_state>
+  <details>
+    <language>
+      <terminology_id>
+        <value>ISO_639-1</value>
+      </terminology_id>
+      <code_string>ja</code_string>
+    </language>
+    <purpose>Serializer test</purpose>
+    <misuse>evaluate message</misuse>
+  </details>
+</description>
+END
+  end
 end
