24
25
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
69
70
71
72
73
74
75
76
77
78
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
108
109
110
111
112
113
|
# File 'lib/adiwg/mdtranslator/writers/iso19115_3/classes/class_contact.rb', line 24
def writeXML(hContact)
phoneClass = CI_Telephone.new(@xml, @hResponseObj)
addressClass = CI_Address.new(@xml, @hResponseObj)
emailClass = Email.new(@xml, @hResponseObj)
resourceClass = CI_OnlineResource.new(@xml, @hResponseObj)
outContext = 'contact information'
outContext += ' ' + hContact[:name] unless hContact[:name].nil?
outContext += ' (' + hContact[:contactId] + ')' unless hContact[:contactId].nil?
@xml.tag!('cit:CI_Contact') do
unless hContact[:phones].empty?
phoneClass.writeXML(hContact[:phones], outContext)
end
if hContact[:phones].empty? && @hResponseObj[:writerShowTags]
@xml.tag!('cit:phone')
end
aAddress = hContact[:addresses]
aAddress.each do |hAddress|
@xml.tag!('cit:address') do
addressClass.writeXML(hAddress)
end
end
if aAddress.empty? && @hResponseObj[:writerShowTags]
@xml.tag!('cit:address')
end
unless hContact[:eMailList].empty?
@xml.tag!('cit:address') do
emailClass.writeXML(hContact[:eMailList])
end
end
aOlResources = hContact[:onlineResources]
aOlResources.each do |hOnline|
@xml.tag!('cit:onlineResource') do
resourceClass.writeXML(hOnline, outContext)
end
end
if aOlResources.empty? && @hResponseObj[:writerShowTags]
@xml.tag!('cit:onlineResource')
end
aHours = hContact[:hoursOfService]
aHours.each do |hours|
@xml.tag!('cit:hoursOfService') do
@xml.tag!('gco:CharacterString', hours)
end
end
if aHours.empty? && @hResponseObj[:writerShowTags]
@xml.tag!('cit:hoursOfService')
end
unless hContact[:contactInstructions].nil?
@xml.tag!('cit:contactInstructions') do
@xml.tag!('gco:CharacterString', hContact[:contactInstructions])
end
end
if hContact[:contactInstructions].nil? && @hResponseObj[:writerShowTags]
@xml.tag!('cit:contactInstructions')
end
unless hContact[:contactType].nil?
@xml.tag!('cit:contactType') do
@xml.tag!('gco:CharacterString', hContact[:contactType])
end
end
if hContact[:contactType].nil? && @hResponseObj[:writerShowTags]
@xml.tag!('cit:contactType')
end
end
end
|