Class: OpenEHR::Serializer::XMLSerializer
Constant Summary
collapse
- Primitive =
OpenEHR::AM::Archetype::ConstraintModel::Primitive
- OpenEHRProfile =
OpenEHR::AM::OpenEHRProfile
Instance Method Summary
collapse
#initialize, #serialize
Instance Method Details
#definition ⇒ Object
70
71
72
73
74
75
76
77
|
# File 'lib/openehr/serializer/xml_serializer.rb', line 70
def definition
definition = +''
xml = Builder::XmlMarkup.new(:indent => 2, :target => definition)
xml.definition do
emit_c_object_body(xml, @archetype.definition)
end
return definition
end
|
#description ⇒ Object
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
|
# File 'lib/openehr/serializer/xml_serializer.rb', line 26
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
if item.keywords then
item.keywords.each do |word|
xml.keywords word
end
end
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
|
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
# File 'lib/openehr/serializer/xml_serializer.rb', line 10
def
= +''
xml = Builder::XmlMarkup.new(:indent => 2, :target => )
xml.archetype_id do
xml.value @archetype.archetype_id.value
end
xml.concept @archetype.concept
xml.original_language do
xml.terminology_id do
xml.value @archetype.original_language.terminology_id.value
end
xml.code_string @archetype.original_language.code_string
end
return
end
|
#merge ⇒ Object
109
110
111
112
113
114
115
|
# File 'lib/openehr/serializer/xml_serializer.rb', line 109
def merge
archetype = "<?xml version='1.0' encoding='UTF-8'?>" + NL +
"<archetype xmlns=\"http://schemas.openehr.org/v1\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\">" + NL +
+ description + definition +
ontology + '</archetype>'
return archetype
end
|
#ontology ⇒ Object
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
|
# File 'lib/openehr/serializer/xml_serializer.rb', line 79
def ontology
ontology = +''
ao = @archetype.ontology
xml = Builder::XmlMarkup.new(:indent => 2, :target => ontology)
xml.ontology do
xml.specialisation_depth ao.specialisation_depth
(ao.languages_available || []).each { |lang| xml.languages_available lang }
(ao.terminologies_available || []).each { |t| xml.terminologies_available t }
xml.term_definitions do
ao.term_definitions.each do |lang, terms|
xml.language lang
xml.terms do
terms.each do |code, term|
xml.code code
xml.items do
term.items.each do |key, value|
xml.item do
xml.key key
xml.value value
end
end
end
end
end
end
end
emit_term_bindings(xml, ao.term_bindings)
end
end
|