Ignore:
Timestamp:
May 22, 2010, 12:57:55 PM (14 years ago)
Author:
KOBAYASHI, Shinji
Message:

My X window system corrupsed.
However, only character is not so bad.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • ruby/trunk/lib/open_ehr/serializer.rb

    r412 r413  
    121121      end
    122122
    123       def envelope
    124       end
    125 
    126123      def merge
    127         return header + description + definition + ontology
     124        return header + NL + description + NL + definition + NL + ontology
    128125      end
    129126
     
    138135
    139136    class XMLSerializer < BaseSerializer
    140 
    141137      def header
    142138        header = ''
     
    216212          xml.node_id ad.node_id
    217213        end
     214        return definition
     215      end
     216
     217      def ontology
     218        ontology = ''
     219        ao = @archetype.ontology
     220        xml = Builder::XmlMarkup.new(:indent => 2, :target => ontology)
     221        xml.ontology do
     222          xml.specialisation_depth ao.specialisation_depth
     223          xml.term_definitions do
     224            ao.term_definitions.each do |lang, terms|
     225              xml.language lang
     226              xml.terms do
     227                terms.each do |term|
     228                  xml.code term.code
     229                  xml.items do
     230                    term.items.each do |key, value|
     231                      xml.item do
     232                        xml.key key
     233                        xml.value value
     234                      end
     235                    end
     236                  end
     237                end
     238              end
     239            end
     240          end
     241        end
    218242      end
    219243
    220244      def merge
    221 
     245        archetype = "<?xml version='1.0' encoding='UTF-8'?>" + NL +
     246          "<archetype xmlns=\"http://schemas.openehr.org/v1\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\">" + NL +
     247          header + description + definition +
     248          ontology + '</archetype>'
     249        return archetype
    222250      end
    223251    end
Note: See TracChangeset for help on using the changeset viewer.