Sync with 5.4.3
[deliverable/titan.core.git] / regression_test / XML / HR49727 / XSD.ttcn
1 /*******************************************************************************
2 * Copyright (c) 2000-2016 Ericsson Telecom AB
3 *
4 * XSD to TTCN-3 Translator version: CRL 113 200/5 R4C
5 *
6 * All rights reserved. This program and the accompanying materials
7 * are made available under the terms of the Eclipse Public License v1.0
8 * which accompanies this distribution, and is available at
9 * http://www.eclipse.org/legal/epl-v10.html
10 *******************************************************************************/
11 //
12 // File: XSD.ttcn
13 // Description:
14 // References:
15 // Rev:
16 // Prodnr:
17 // Updated:
18 // Contact: http://ttcn.ericsson.se
19 //
20 ////////////////////////////////////////////////////////////////////////////////
21 module XSD {
22
23 import from UsefulTtcn3Types all;
24
25 //These constants are used in the XSD date/time type definitions
26 const charstring
27 dash := "-",
28 cln := ":",
29 year := "[0-9]#4",
30 yearExpansion := "(-([1-9][0-9]#(0,))#(,1))#(,1)",
31 month := "(0[1-9]|1[0-2])",
32 dayOfMonth := "(0[1-9]|[12][0-9]|3[01])",
33 hour := "([01][0-9]|2[0-3])",
34 minute := "([0-5][0-9])",
35 second := "([0-5][0-9])",
36 sFraction := "(.[0-9]#(1,))#(,1)",
37 endOfDayExt := "24:00:00(.0#(1,))#(,1)",
38 nums := "[0-9]#(1,)",
39 ZorTimeZoneExt := "(Z|[+-]((0[0-9]|1[0-3]):[0-5][0-9]|14:00))#(,1)",
40 durTime := "(T[0-9]#(1,)"&
41 "(H([0-9]#(1,)(M([0-9]#(1,)(S|.[0-9]#(1,)S))#(,1)|.[0-9]#(1,)S|S))#(,1)|"&
42 "M([0-9]#(1,)(S|.[0-9]#(1,)S)|.[0-9]#(1,)M)#(,1)|"&
43 "S|"&
44 ".[0-9]#(1,)S))"
45
46 //anySimpleType
47
48 type XMLCompatibleString AnySimpleType
49 with {
50 variant "XSD:anySimpleType";
51 };
52
53 //anyType;
54
55 type record AnyType
56 {
57 record of String embed_values optional,
58 record of String attr optional,
59 record of String elem_list
60 }
61 with {
62 variant "XSD:anyType";
63 variant "embedValues";
64 variant (attr) "anyAttributes";
65 variant (elem_list) "anyElement";
66 };
67 // String types
68
69 type XMLCompatibleString String
70 with {
71 variant "XSD:string";
72 };
73
74 type XMLStringWithNoCRLFHT NormalizedString
75 with {
76 variant "XSD:normalizedString";
77 };
78
79 type NormalizedString Token
80 with {
81 variant "XSD:token";
82 };
83
84 type XMLStringWithNoWhitespace Name
85 with {
86 variant "XSD:Name";
87 };
88
89 type XMLStringWithNoWhitespace NMTOKEN
90 with {
91 variant "XSD:NMTOKEN";
92 };
93
94 type Name NCName
95 with {
96 variant "XSD:NCName";
97 };
98
99 type NCName ID
100 with {
101 variant "XSD:ID";
102 };
103
104 type NCName IDREF
105 with {
106 variant "XSD:IDREF";
107 };
108
109 type NCName ENTITY
110 with {
111 variant "XSD:ENTITY";
112 };
113
114 type octetstring HexBinary
115 with {
116 variant "XSD:hexBinary";
117 };
118
119 type octetstring Base64Binary
120 with {
121 variant "XSD:base64Binary";
122 };
123
124 type XMLStringWithNoCRLFHT AnyURI
125 with {
126 variant "XSD:anyURI";
127 };
128
129 type charstring Language (pattern "[a-zA-Z]#(1,8)(-\w#(1,8))#(0,)")
130 with {
131 variant "XSD:language";
132 };
133 // Integer types
134
135 type integer Integer
136 with {
137 variant "XSD:integer";
138 };
139
140 type integer PositiveInteger (1 .. infinity)
141 with {
142 variant "XSD:positiveInteger";
143 };
144
145 type integer NonPositiveInteger (-infinity .. 0)
146 with {
147 variant "XSD:nonPositiveInteger";
148 };
149
150 type integer NegativeInteger (-infinity .. -1)
151 with {
152 variant "XSD:negativeInteger";
153 };
154
155 type integer NonNegativeInteger (0 .. infinity)
156 with {
157 variant "XSD:nonNegativeInteger";
158 };
159
160 type longlong Long
161 with {
162 variant "XSD:long";
163 };
164
165 type unsignedlonglong UnsignedLong
166 with {
167 variant "XSD:unsignedLong";
168 };
169
170 type long Int
171 with {
172 variant "XSD:int";
173 };
174
175 type unsignedlong UnsignedInt
176 with {
177 variant "XSD:unsignedInt";
178 };
179
180 type short Short
181 with {
182 variant "XSD:short";
183 };
184
185 type unsignedshort UnsignedShort
186 with {
187 variant "XSD:unsignedShort";
188 };
189
190 type byte Byte
191 with {
192 variant "XSD:byte";
193 };
194
195 type unsignedbyte UnsignedByte
196 with {
197 variant "XSD:unsignedByte";
198 };
199
200 // Float types
201
202 type float Decimal
203 with {
204 variant "XSD:decimal";
205 };
206
207 type IEEE754float Float
208 with {
209 variant "XSD:float";
210 };
211
212 type IEEE754double Double
213 with {
214 variant "XSD:double";
215 };
216
217 // Time types
218
219 type charstring Duration (pattern
220 "{dash}#(,1)P({nums}(Y({nums}(M({nums}D{durTime}#(,1)|{durTime}#(,1))|D{durTime}#(,1))|" &
221 "{durTime}#(,1))|M({nums}D{durTime}#(,1)|{durTime}#(,1))|D{durTime}#(,1))|{durTime})")
222 with {
223 variant "XSD:duration";
224 };
225
226 type charstring DateTime (pattern
227 "{yearExpansion}{year}{dash}{month}{dash}{dayOfMonth}T({hour}{cln}{minute}{cln}{second}" &
228 "{sFraction}|{endOfDayExt}){ZorTimeZoneExt}" )
229 with {
230 variant "XSD:dateTime";
231 };
232
233 type charstring Time (pattern
234 "({hour}{cln}{minute}{cln}{second}{sFraction}|{endOfDayExt}){ZorTimeZoneExt}" )
235 with {
236 variant "XSD:time";
237 };
238
239 type charstring Date (pattern
240 "{yearExpansion}{year}{dash}{month}{dash}{dayOfMonth}{ZorTimeZoneExt}" )
241 with {
242 variant "XSD:date";
243 };
244
245 type charstring GYearMonth (pattern
246 "{yearExpansion}{year}{dash}{month}{ZorTimeZoneExt}" )
247 with {
248 variant "XSD:gYearMonth";
249 };
250
251 type charstring GYear (pattern
252 "{yearExpansion}{year}{ZorTimeZoneExt}" )
253 with {
254 variant "XSD:gYear";
255 };
256
257 type charstring GMonthDay (pattern
258 "{dash}{dash}{month}{dash}{dayOfMonth}{ZorTimeZoneExt}" )
259 with {
260 variant "XSD:gMonthDay";
261 };
262
263 type charstring GDay (pattern
264 "{dash}{dash}{dash}{dayOfMonth}{ZorTimeZoneExt}" )
265 with {
266 variant "XSD:gDay";
267 };
268
269 type charstring GMonth (pattern
270 "{dash}{dash}{month}{ZorTimeZoneExt}" )
271 with {
272 variant "XSD:gMonth";
273 };
274
275 // Sequence types
276
277 type record of NMTOKEN NMTOKENS
278 with {
279 variant "XSD:NMTOKENS";
280 };
281
282 type record of IDREF IDREFS
283 with {
284 variant "XSD:IDREFS";
285 };
286
287 type record of ENTITY ENTITIES
288 with {
289 variant "XSD:ENTITIES";
290 };
291
292 type record QName
293 {
294 AnyURI uri optional,
295 NCName name
296 }
297 with {
298 variant "XSD:QName";
299 };
300
301 // Boolean type
302
303 type boolean Boolean
304 with {
305 variant "XSD:boolean";
306 };
307
308 //TTCN-3 type definitions supporting the mapping of W3C XML Schema built-in datatypes
309
310 type utf8string XMLCompatibleString
311 (
312 char(0,0,0,9)..char(0,0,0,9),
313 char(0,0,0,10)..char(0,0,0,10),
314 char(0,0,0,12)..char(0,0,0,12),
315 char(0,0,0,32)..char(0,0,215,255),
316 char(0,0,224,0)..char(0,0,255,253),
317 char(0,1,0,0)..char(0,16,255,253)
318 )
319
320 type utf8string XMLStringWithNoWhitespace
321 (
322 char(0,0,0,33)..char(0,0,215,255),
323 char(0,0,224,0)..char(0,0,255,253),
324 char(0,1,0,0)..char(0,16,255,253)
325 )
326
327 type utf8string XMLStringWithNoCRLFHT
328 (
329 char(0,0,0,32)..char(0,0,215,255),
330 char(0,0,224,0)..char(0,0,255,253),
331 char(0,1,0,0)..char(0,16,255,253)
332 )
333
334 }
335 with{
336 encode "XML"
337 }
This page took 0.037395 seconds and 5 git commands to generate.