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