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