Class: VPMSSchemaInterpreter
Instance Method Summary
collapse
Methods inherited from DslContext
bubble, execute, polish_text
Instance Method Details
#coverage(*args) ⇒ Object
114
115
116
117
118
119
120
121
122
|
# File 'lib/VPMSSchemaInterpreter.rb', line 114
def coverage(*args)
@erbAry = []
@metaProps = {}
@erb = ""
@metaprop = ""
@argName = "#{args[0]}"
io = open(File.join(COVERAGE_DEF_ROOT,"/#{@argName}PropertyHash"),'r' )
@prdhash = YAML::load(io)
end
|
#endComplexType ⇒ Object
94
95
96
97
98
99
|
# File 'lib/VPMSSchemaInterpreter.rb', line 94
def endComplexType
endElement = ""
endElement << endSequence
endElement << "</xs:complexType>\n"
endElement
end
|
#endcoverage(*args) ⇒ Object
124
125
|
# File 'lib/VPMSSchemaInterpreter.rb', line 124
def endcoverage(*args)
end
|
#endElement ⇒ Object
80
81
82
83
84
|
# File 'lib/VPMSSchemaInterpreter.rb', line 80
def endElement
endElement = ""
endElement << "</xs:element>\n"
endElement
end
|
#endSchema ⇒ Object
49
50
51
52
53
|
# File 'lib/VPMSSchemaInterpreter.rb', line 49
def endSchema
endSchema = ""
endSchema << "</xs:schema>\n"
endSchema
end
|
#endSequence ⇒ Object
108
109
110
111
112
|
# File 'lib/VPMSSchemaInterpreter.rb', line 108
def endSequence
endElement = ""
endElement << "</xs:sequence>\n"
endElement
end
|
#getResult ⇒ Object
14
15
16
17
18
19
20
21
22
23
|
# File 'lib/VPMSSchemaInterpreter.rb', line 14
def getResult
getResult = ""
getResult << startSchema
@erbAry.each do |a|
b = a.to_s
getResult << "\t"
getResult << processXPath(a, b)
end
getResult << endSchema
end
|
#processXPath(*args) ⇒ Object
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
|
# File 'lib/VPMSSchemaInterpreter.rb', line 25
def processXPath(*args)
processXpath = ""
xpath = args[0]
boolEndOfPath = (args[0].length == 1)
processXpath << "\t"
processXpath << startElement(args[0].first, args[1], boolEndOfPath)
xpath.delete_at(0)
if xpath.length > 0
processXpath << startComplexType
processXpath << processXPath(xpath, args[1])
processXpath << endComplexType
end
processXpath << endElement
processXpath
end
|
#startComplexType ⇒ Object
86
87
88
89
90
91
92
|
# File 'lib/VPMSSchemaInterpreter.rb', line 86
def startComplexType
openElement = ""
openElement << "<xs:complexType>\n"
openElement << startSequence
openElement
end
|
#startElement(*args) ⇒ Object
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
|
# File 'lib/VPMSSchemaInterpreter.rb', line 55
def startElement(*args)
openElement = ""
openElement << "<xs:element name=\"#{args[0]}\""
if (args[2] == true) then
openElement << " type=\"xs:string\">\n"
else
openElement << ">\n"
end
openElement
end
|
#startSchema ⇒ Object
41
42
43
44
45
46
47
|
# File 'lib/VPMSSchemaInterpreter.rb', line 41
def startSchema
openSchema = ""
openSchema << "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>\n"
openSchema << "<xs:schema xmlns:xs=\"http://www.w3.org/2001/XMLSchema\">\n"
openSchema
end
|
#startSequence ⇒ Object
101
102
103
104
105
106
|
# File 'lib/VPMSSchemaInterpreter.rb', line 101
def startSequence
openElement = ""
openElement << "<xs:sequence>\n"
openElement
end
|
#use(*args) ⇒ Object
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
|
# File 'lib/VPMSSchemaInterpreter.rb', line 127
def use(*args)
h = ""
lasth = ""
lasta = ""
args.each do |a|
unless a.class == Hash
lasth = String.new(h)
h << "#{a}"
lasta = a
end
end
hashname = @argName + h
specificProperty = false
myHash = @prdhash["#{hashname}"].clone
if (myHash.length == 1)
hashname = @argName + lasth
specificProperty = true
myHash = @prdhash["#{hashname}"].clone
end
@erb << myHash["#{'xpath'}"]
myHash.each do |property, value|
if (property != 'xpath' and (property =~ /MD$/) == nil) then
if (value == "" && (!specificProperty || (specificProperty && property == "#{lasta}"))) then
@erb << "/"
@erb << property
end
end
end
erbTemp = @erb.split('/')
@erbAry.push(erbTemp)
@erb = ""
end
|