1 /****************************************************************************
2 **
3 ** Copyright (C) 2016 The Qt Company Ltd.
4 ** Contact: https://www.qt.io/licensing/
5 **
6 ** This file is part of the QtXmlPatterns module of the Qt Toolkit.
7 **
8 ** $QT_BEGIN_LICENSE:LGPL$
9 ** Commercial License Usage
10 ** Licensees holding valid commercial Qt licenses may use this file in
11 ** accordance with the commercial license agreement provided with the
12 ** Software or, alternatively, in accordance with the terms contained in
13 ** a written agreement between you and The Qt Company. For licensing terms
14 ** and conditions see https://www.qt.io/terms-conditions. For further
15 ** information use the contact form at https://www.qt.io/contact-us.
16 **
17 ** GNU Lesser General Public License Usage
18 ** Alternatively, this file may be used under the terms of the GNU Lesser
19 ** General Public License version 3 as published by the Free Software
20 ** Foundation and appearing in the file LICENSE.LGPL3 included in the
21 ** packaging of this file. Please review the following information to
22 ** ensure the GNU Lesser General Public License version 3 requirements
23 ** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
24 **
25 ** GNU General Public License Usage
26 ** Alternatively, this file may be used under the terms of the GNU
27 ** General Public License version 2.0 or (at your option) the GNU General
28 ** Public license version 3 or any later version approved by the KDE Free
29 ** Qt Foundation. The licenses are as published by the Free Software
30 ** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
31 ** included in the packaging of this file. Please review the following
32 ** information to ensure the GNU General Public License requirements will
33 ** be met: https://www.gnu.org/licenses/gpl-2.0.html and
34 ** https://www.gnu.org/licenses/gpl-3.0.html.
35 **
36 ** $QT_END_LICENSE$
37 **
38 ****************************************************************************/
39
40 #include "qxsdschemacontext_p.h"
41
42 #include "qderivedinteger_p.h"
43 #include "qderivedstring_p.h"
44 #include "qxsdschematypesfactory_p.h"
45
46 QT_BEGIN_NAMESPACE
47
48 using namespace QPatternist;
49
XsdSchemaContext(const NamePool::Ptr & namePool)50 XsdSchemaContext::XsdSchemaContext(const NamePool::Ptr &namePool)
51 : m_namePool(namePool)
52 , m_networkAccessManager(0)
53 , m_uriResolver(0)
54 , m_messageHandler(0)
55 {
56 }
57
namePool() const58 NamePool::Ptr XsdSchemaContext::namePool() const
59 {
60 return m_namePool;
61 }
62
baseURI() const63 QUrl XsdSchemaContext::baseURI() const
64 {
65 return m_baseURI;
66 }
67
setBaseURI(const QUrl & uri)68 void XsdSchemaContext::setBaseURI(const QUrl &uri)
69 {
70 m_baseURI = uri;
71 }
72
setNetworkAccessManager(QNetworkAccessManager * accessManager)73 void XsdSchemaContext::setNetworkAccessManager(QNetworkAccessManager *accessManager)
74 {
75 m_networkAccessManager = accessManager;
76 }
77
networkAccessManager() const78 QNetworkAccessManager* XsdSchemaContext::networkAccessManager() const
79 {
80 return m_networkAccessManager;
81 }
82
setMessageHandler(QAbstractMessageHandler * handler)83 void XsdSchemaContext::setMessageHandler(QAbstractMessageHandler *handler)
84 {
85 m_messageHandler = handler;
86 }
87
messageHandler() const88 QAbstractMessageHandler* XsdSchemaContext::messageHandler() const
89 {
90 return m_messageHandler;
91 }
92
locationFor(const SourceLocationReflection * const) const93 QSourceLocation XsdSchemaContext::locationFor(const SourceLocationReflection *const) const
94 {
95 return QSourceLocation();
96 }
97
setUriResolver(const QAbstractUriResolver * uriResolver)98 void XsdSchemaContext::setUriResolver(const QAbstractUriResolver *uriResolver)
99 {
100 m_uriResolver = uriResolver;
101 }
102
uriResolver() const103 const QAbstractUriResolver* XsdSchemaContext::uriResolver() const
104 {
105 return m_uriResolver;
106 }
107
facetsForType(const AnySimpleType::Ptr & type) const108 XsdFacet::Hash XsdSchemaContext::facetsForType(const AnySimpleType::Ptr &type) const
109 {
110 if (type->isDefinedBySchema())
111 return XsdSimpleType::Ptr(type)->facets();
112 else {
113 if (m_builtinTypesFacetList.isEmpty())
114 m_builtinTypesFacetList = setupBuiltinTypesFacetList();
115
116 return m_builtinTypesFacetList.value(type);
117 }
118 }
119
schemaTypeFactory() const120 SchemaTypeFactory::Ptr XsdSchemaContext::schemaTypeFactory() const
121 {
122 if (!m_schemaTypeFactory)
123 m_schemaTypeFactory = SchemaTypeFactory::Ptr(new XsdSchemaTypesFactory(m_namePool));
124
125 return m_schemaTypeFactory;
126 }
127
setupBuiltinTypesFacetList() const128 QHash<SchemaType::Ptr, XsdFacet::Hash> XsdSchemaContext::setupBuiltinTypesFacetList() const
129 {
130 QHash<SchemaType::Ptr, XsdFacet::Hash> hash;
131
132 const XsdFacet::Ptr fixedCollapseWhiteSpace(new XsdFacet());
133 fixedCollapseWhiteSpace->setType(XsdFacet::WhiteSpace);
134 fixedCollapseWhiteSpace->setValue(DerivedString<TypeString>::fromLexical(m_namePool, XsdSchemaToken::toString(XsdSchemaToken::Collapse)));
135 fixedCollapseWhiteSpace->setFixed(true);
136
137 const XsdFacet::Ptr collapseWhiteSpace(new XsdFacet());
138 collapseWhiteSpace->setType(XsdFacet::WhiteSpace);
139 collapseWhiteSpace->setValue(DerivedString<TypeString>::fromLexical(m_namePool, XsdSchemaToken::toString(XsdSchemaToken::Collapse)));
140 collapseWhiteSpace->setFixed(false);
141
142 const XsdFacet::Ptr preserveWhiteSpace(new XsdFacet());
143 preserveWhiteSpace->setType(XsdFacet::WhiteSpace);
144 preserveWhiteSpace->setValue(DerivedString<TypeString>::fromLexical(m_namePool, XsdSchemaToken::toString(XsdSchemaToken::Preserve)));
145 preserveWhiteSpace->setFixed(false);
146
147 const XsdFacet::Ptr replaceWhiteSpace(new XsdFacet());
148 replaceWhiteSpace->setType(XsdFacet::WhiteSpace);
149 replaceWhiteSpace->setValue(DerivedString<TypeString>::fromLexical(m_namePool, XsdSchemaToken::toString(XsdSchemaToken::Replace)));
150 replaceWhiteSpace->setFixed(false);
151
152 const XsdFacet::Ptr fixedZeroFractionDigits(new XsdFacet());
153 fixedZeroFractionDigits->setType(XsdFacet::FractionDigits);
154 fixedZeroFractionDigits->setValue(DerivedInteger<TypeNonNegativeInteger>::fromValue(m_namePool, 0));
155 fixedZeroFractionDigits->setFixed(true);
156
157 {
158 XsdFacet::Hash &facets = hash[BuiltinTypes::xsString];
159 facets.insert(preserveWhiteSpace->type(), preserveWhiteSpace);
160 }
161
162 {
163 XsdFacet::Hash &facets = hash[BuiltinTypes::xsBoolean];
164 facets.insert(fixedCollapseWhiteSpace->type(), fixedCollapseWhiteSpace);
165 }
166
167 {
168 XsdFacet::Hash &facets = hash[BuiltinTypes::xsDecimal];
169 facets.insert(fixedCollapseWhiteSpace->type(), fixedCollapseWhiteSpace);
170 }
171
172 {
173 XsdFacet::Hash &facets = hash[BuiltinTypes::xsFloat];
174 facets.insert(fixedCollapseWhiteSpace->type(), fixedCollapseWhiteSpace);
175 }
176
177 {
178 XsdFacet::Hash &facets = hash[BuiltinTypes::xsDouble];
179 facets.insert(fixedCollapseWhiteSpace->type(), fixedCollapseWhiteSpace);
180 }
181
182 {
183 XsdFacet::Hash &facets = hash[BuiltinTypes::xsDuration];
184 facets.insert(fixedCollapseWhiteSpace->type(), fixedCollapseWhiteSpace);
185 }
186
187 {
188 XsdFacet::Hash &facets = hash[BuiltinTypes::xsDateTime];
189 facets.insert(fixedCollapseWhiteSpace->type(), fixedCollapseWhiteSpace);
190 }
191
192 {
193 XsdFacet::Hash &facets = hash[BuiltinTypes::xsTime];
194 facets.insert(fixedCollapseWhiteSpace->type(), fixedCollapseWhiteSpace);
195 }
196
197 {
198 XsdFacet::Hash &facets = hash[BuiltinTypes::xsDate];
199 facets.insert(fixedCollapseWhiteSpace->type(), fixedCollapseWhiteSpace);
200 }
201
202 {
203 XsdFacet::Hash &facets = hash[BuiltinTypes::xsGYearMonth];
204 facets.insert(fixedCollapseWhiteSpace->type(), fixedCollapseWhiteSpace);
205 }
206
207 {
208 XsdFacet::Hash &facets = hash[BuiltinTypes::xsGYear];
209 facets.insert(fixedCollapseWhiteSpace->type(), fixedCollapseWhiteSpace);
210 }
211
212 {
213 XsdFacet::Hash &facets = hash[BuiltinTypes::xsGMonthDay];
214 facets.insert(fixedCollapseWhiteSpace->type(), fixedCollapseWhiteSpace);
215 }
216
217 {
218 XsdFacet::Hash &facets = hash[BuiltinTypes::xsGDay];
219 facets.insert(fixedCollapseWhiteSpace->type(), fixedCollapseWhiteSpace);
220 }
221
222 {
223 XsdFacet::Hash &facets = hash[BuiltinTypes::xsGMonth];
224 facets.insert(fixedCollapseWhiteSpace->type(), fixedCollapseWhiteSpace);
225 }
226
227 {
228 XsdFacet::Hash &facets = hash[BuiltinTypes::xsHexBinary];
229 facets.insert(fixedCollapseWhiteSpace->type(), fixedCollapseWhiteSpace);
230 }
231
232 {
233 XsdFacet::Hash &facets = hash[BuiltinTypes::xsBase64Binary];
234 facets.insert(fixedCollapseWhiteSpace->type(), fixedCollapseWhiteSpace);
235 }
236
237 {
238 XsdFacet::Hash &facets = hash[BuiltinTypes::xsAnyURI];
239 facets.insert(fixedCollapseWhiteSpace->type(), fixedCollapseWhiteSpace);
240 }
241
242 {
243 XsdFacet::Hash &facets = hash[BuiltinTypes::xsQName];
244 facets.insert(fixedCollapseWhiteSpace->type(), fixedCollapseWhiteSpace);
245 }
246
247 {
248 XsdFacet::Hash &facets = hash[BuiltinTypes::xsNOTATION];
249 facets.insert(fixedCollapseWhiteSpace->type(), fixedCollapseWhiteSpace);
250 }
251
252 {
253 XsdFacet::Hash &facets = hash[BuiltinTypes::xsNormalizedString];
254 facets.insert(replaceWhiteSpace->type(), replaceWhiteSpace);
255 }
256
257 {
258 XsdFacet::Hash &facets = hash[BuiltinTypes::xsToken];
259 facets.insert(collapseWhiteSpace->type(), collapseWhiteSpace);
260 }
261
262 {
263 XsdFacet::Hash &facets = hash[BuiltinTypes::xsLanguage];
264 facets.insert(collapseWhiteSpace->type(), collapseWhiteSpace);
265
266 const XsdFacet::Ptr pattern(new XsdFacet());
267 pattern->setType(XsdFacet::Pattern);
268 pattern->setMultiValue(AtomicValue::List() << DerivedString<TypeString>::fromLexical(m_namePool, QString::fromLatin1("[a-zA-Z]{1,8}(-[a-zA-Z0-9]{1,8})*")));
269 facets.insert(pattern->type(), pattern);
270 }
271
272 {
273 XsdFacet::Hash &facets = hash[BuiltinTypes::xsNMTOKEN];
274 facets.insert(collapseWhiteSpace->type(), collapseWhiteSpace);
275
276 const XsdFacet::Ptr pattern(new XsdFacet());
277 pattern->setType(XsdFacet::Pattern);
278 pattern->setMultiValue(AtomicValue::List() << DerivedString<TypeString>::fromLexical(m_namePool, QString::fromLatin1("\\c+")));
279 facets.insert(pattern->type(), pattern);
280 }
281
282 {
283 XsdFacet::Hash &facets = hash[BuiltinTypes::xsName];
284 facets.insert(collapseWhiteSpace->type(), collapseWhiteSpace);
285
286 const XsdFacet::Ptr pattern(new XsdFacet());
287 pattern->setType(XsdFacet::Pattern);
288 pattern->setMultiValue(AtomicValue::List() << DerivedString<TypeString>::fromLexical(m_namePool, QString::fromLatin1("\\i\\c*")));
289 facets.insert(pattern->type(), pattern);
290 }
291
292 const XsdFacet::Ptr ncNamePattern(new XsdFacet());
293 {
294 ncNamePattern->setType(XsdFacet::Pattern);
295 AtomicValue::List patterns;
296 patterns << DerivedString<TypeString>::fromLexical(m_namePool, QString::fromLatin1("\\i\\c*"));
297 patterns << DerivedString<TypeString>::fromLexical(m_namePool, QString::fromLatin1("[\\i-[:]][\\c-[:]]*"));
298 ncNamePattern->setMultiValue(patterns);
299 }
300
301 {
302 XsdFacet::Hash &facets = hash[BuiltinTypes::xsNCName];
303 facets.insert(collapseWhiteSpace->type(), collapseWhiteSpace);
304 facets.insert(ncNamePattern->type(), ncNamePattern);
305 }
306
307 {
308 XsdFacet::Hash &facets = hash[BuiltinTypes::xsID];
309 facets.insert(collapseWhiteSpace->type(), collapseWhiteSpace);
310 facets.insert(ncNamePattern->type(), ncNamePattern);
311 }
312
313 {
314 XsdFacet::Hash &facets = hash[BuiltinTypes::xsIDREF];
315 facets.insert(collapseWhiteSpace->type(), collapseWhiteSpace);
316 facets.insert(ncNamePattern->type(), ncNamePattern);
317 }
318
319 {
320 XsdFacet::Hash &facets = hash[BuiltinTypes::xsENTITY];
321 facets.insert(collapseWhiteSpace->type(), collapseWhiteSpace);
322 facets.insert(ncNamePattern->type(), ncNamePattern);
323 }
324
325 const XsdFacet::Ptr integerPattern(new XsdFacet());
326 integerPattern->setType(XsdFacet::Pattern);
327 integerPattern->setMultiValue(AtomicValue::List() << DerivedString<TypeString>::fromLexical(m_namePool, QString::fromLatin1("[\\-+]?[0-9]+")));
328
329 {
330 XsdFacet::Hash &facets = hash[BuiltinTypes::xsInteger];
331 facets.insert(fixedCollapseWhiteSpace->type(), fixedCollapseWhiteSpace);
332 facets.insert(fixedZeroFractionDigits->type(), fixedZeroFractionDigits);
333 facets.insert(integerPattern->type(), integerPattern);
334 }
335
336 {
337 XsdFacet::Hash &facets = hash[BuiltinTypes::xsNonPositiveInteger];
338 facets.insert(fixedCollapseWhiteSpace->type(), fixedCollapseWhiteSpace);
339 facets.insert(fixedZeroFractionDigits->type(), fixedZeroFractionDigits);
340 facets.insert(integerPattern->type(), integerPattern);
341
342 const XsdFacet::Ptr maxInclusive(new XsdFacet());
343 maxInclusive->setType(XsdFacet::MaximumInclusive);
344 maxInclusive->setValue(DerivedString<TypeString>::fromLexical(m_namePool, QString::fromLatin1("0")));
345 facets.insert(maxInclusive->type(), maxInclusive);
346 }
347
348 {
349 XsdFacet::Hash &facets = hash[BuiltinTypes::xsNegativeInteger];
350 facets.insert(fixedCollapseWhiteSpace->type(), fixedCollapseWhiteSpace);
351 facets.insert(fixedZeroFractionDigits->type(), fixedZeroFractionDigits);
352 facets.insert(integerPattern->type(), integerPattern);
353
354 const XsdFacet::Ptr maxInclusive(new XsdFacet());
355 maxInclusive->setType(XsdFacet::MaximumInclusive);
356 maxInclusive->setValue(DerivedString<TypeString>::fromLexical(m_namePool, QString::fromLatin1("-1")));
357 facets.insert(maxInclusive->type(), maxInclusive);
358 }
359
360 {
361 XsdFacet::Hash &facets = hash[BuiltinTypes::xsLong];
362 facets.insert(fixedCollapseWhiteSpace->type(), fixedCollapseWhiteSpace);
363 facets.insert(fixedZeroFractionDigits->type(), fixedZeroFractionDigits);
364 facets.insert(integerPattern->type(), integerPattern);
365
366 const XsdFacet::Ptr maxInclusive(new XsdFacet());
367 maxInclusive->setType(XsdFacet::MaximumInclusive);
368 maxInclusive->setValue(DerivedString<TypeString>::fromLexical(m_namePool, QString::fromLatin1("9223372036854775807")));
369 facets.insert(maxInclusive->type(), maxInclusive);
370
371 const XsdFacet::Ptr minInclusive(new XsdFacet());
372 minInclusive->setType(XsdFacet::MinimumInclusive);
373 minInclusive->setValue(DerivedString<TypeString>::fromLexical(m_namePool, QString::fromLatin1("-9223372036854775808")));
374 facets.insert(minInclusive->type(), minInclusive);
375 }
376
377 {
378 XsdFacet::Hash &facets = hash[BuiltinTypes::xsInt];
379 facets.insert(fixedCollapseWhiteSpace->type(), fixedCollapseWhiteSpace);
380 facets.insert(fixedZeroFractionDigits->type(), fixedZeroFractionDigits);
381 facets.insert(integerPattern->type(), integerPattern);
382
383 const XsdFacet::Ptr maxInclusive(new XsdFacet());
384 maxInclusive->setType(XsdFacet::MaximumInclusive);
385 maxInclusive->setValue(DerivedString<TypeString>::fromLexical(m_namePool, QString::fromLatin1("2147483647")));
386 facets.insert(maxInclusive->type(), maxInclusive);
387
388 const XsdFacet::Ptr minInclusive(new XsdFacet());
389 minInclusive->setType(XsdFacet::MinimumInclusive);
390 minInclusive->setValue(DerivedString<TypeString>::fromLexical(m_namePool, QString::fromLatin1("-2147483648")));
391 facets.insert(minInclusive->type(), minInclusive);
392 }
393
394 {
395 XsdFacet::Hash &facets = hash[BuiltinTypes::xsShort];
396 facets.insert(fixedCollapseWhiteSpace->type(), fixedCollapseWhiteSpace);
397 facets.insert(fixedZeroFractionDigits->type(), fixedZeroFractionDigits);
398 facets.insert(integerPattern->type(), integerPattern);
399
400 const XsdFacet::Ptr maxInclusive(new XsdFacet());
401 maxInclusive->setType(XsdFacet::MaximumInclusive);
402 maxInclusive->setValue(DerivedString<TypeString>::fromLexical(m_namePool, QString::fromLatin1("32767")));
403 facets.insert(maxInclusive->type(), maxInclusive);
404
405 const XsdFacet::Ptr minInclusive(new XsdFacet());
406 minInclusive->setType(XsdFacet::MinimumInclusive);
407 minInclusive->setValue(DerivedString<TypeString>::fromLexical(m_namePool, QString::fromLatin1("-32768")));
408 facets.insert(minInclusive->type(), minInclusive);
409 }
410
411 {
412 XsdFacet::Hash &facets = hash[BuiltinTypes::xsByte];
413 facets.insert(fixedCollapseWhiteSpace->type(), fixedCollapseWhiteSpace);
414 facets.insert(fixedZeroFractionDigits->type(), fixedZeroFractionDigits);
415 facets.insert(integerPattern->type(), integerPattern);
416
417 const XsdFacet::Ptr maxInclusive(new XsdFacet());
418 maxInclusive->setType(XsdFacet::MaximumInclusive);
419 maxInclusive->setValue(DerivedString<TypeString>::fromLexical(m_namePool, QString::fromLatin1("127")));
420 facets.insert(maxInclusive->type(), maxInclusive);
421
422 const XsdFacet::Ptr minInclusive(new XsdFacet());
423 minInclusive->setType(XsdFacet::MinimumInclusive);
424 minInclusive->setValue(DerivedString<TypeString>::fromLexical(m_namePool, QString::fromLatin1("-128")));
425 facets.insert(minInclusive->type(), minInclusive);
426 }
427
428 const XsdFacet::Ptr unsignedMinInclusive(new XsdFacet());
429 unsignedMinInclusive->setType(XsdFacet::MinimumInclusive);
430 unsignedMinInclusive->setValue(DerivedString<TypeString>::fromLexical(m_namePool, QString::fromLatin1("0")));
431
432 {
433 XsdFacet::Hash &facets = hash[BuiltinTypes::xsNonNegativeInteger];
434 facets.insert(fixedCollapseWhiteSpace->type(), fixedCollapseWhiteSpace);
435 facets.insert(fixedZeroFractionDigits->type(), fixedZeroFractionDigits);
436 facets.insert(integerPattern->type(), integerPattern);
437 facets.insert(unsignedMinInclusive->type(), unsignedMinInclusive);
438 }
439
440 {
441 XsdFacet::Hash &facets = hash[BuiltinTypes::xsUnsignedLong];
442 facets.insert(fixedCollapseWhiteSpace->type(), fixedCollapseWhiteSpace);
443 facets.insert(fixedZeroFractionDigits->type(), fixedZeroFractionDigits);
444 facets.insert(integerPattern->type(), integerPattern);
445 facets.insert(unsignedMinInclusive->type(), unsignedMinInclusive);
446
447 const XsdFacet::Ptr maxInclusive(new XsdFacet());
448 maxInclusive->setType(XsdFacet::MaximumInclusive);
449 maxInclusive->setValue(DerivedString<TypeString>::fromLexical(m_namePool, QString::fromLatin1("18446744073709551615")));
450 facets.insert(maxInclusive->type(), maxInclusive);
451 }
452
453 {
454 XsdFacet::Hash &facets = hash[BuiltinTypes::xsUnsignedInt];
455 facets.insert(fixedCollapseWhiteSpace->type(), fixedCollapseWhiteSpace);
456 facets.insert(fixedZeroFractionDigits->type(), fixedZeroFractionDigits);
457 facets.insert(integerPattern->type(), integerPattern);
458 facets.insert(unsignedMinInclusive->type(), unsignedMinInclusive);
459
460 const XsdFacet::Ptr maxInclusive(new XsdFacet());
461 maxInclusive->setType(XsdFacet::MaximumInclusive);
462 maxInclusive->setValue(DerivedString<TypeString>::fromLexical(m_namePool, QString::fromLatin1("4294967295")));
463 facets.insert(maxInclusive->type(), maxInclusive);
464 }
465
466 {
467 XsdFacet::Hash &facets = hash[BuiltinTypes::xsUnsignedShort];
468 facets.insert(fixedCollapseWhiteSpace->type(), fixedCollapseWhiteSpace);
469 facets.insert(fixedZeroFractionDigits->type(), fixedZeroFractionDigits);
470 facets.insert(integerPattern->type(), integerPattern);
471 facets.insert(unsignedMinInclusive->type(), unsignedMinInclusive);
472
473 const XsdFacet::Ptr maxInclusive(new XsdFacet());
474 maxInclusive->setType(XsdFacet::MaximumInclusive);
475 maxInclusive->setValue(DerivedString<TypeString>::fromLexical(m_namePool, QString::fromLatin1("65535")));
476 facets.insert(maxInclusive->type(), maxInclusive);
477 }
478
479 {
480 XsdFacet::Hash &facets = hash[BuiltinTypes::xsUnsignedByte];
481 facets.insert(fixedCollapseWhiteSpace->type(), fixedCollapseWhiteSpace);
482 facets.insert(fixedZeroFractionDigits->type(), fixedZeroFractionDigits);
483 facets.insert(integerPattern->type(), integerPattern);
484 facets.insert(unsignedMinInclusive->type(), unsignedMinInclusive);
485
486 const XsdFacet::Ptr maxInclusive(new XsdFacet());
487 maxInclusive->setType(XsdFacet::MaximumInclusive);
488 maxInclusive->setValue(DerivedString<TypeString>::fromLexical(m_namePool, QString::fromLatin1("255")));
489 facets.insert(maxInclusive->type(), maxInclusive);
490 }
491
492 {
493 XsdFacet::Hash &facets = hash[BuiltinTypes::xsPositiveInteger];
494 facets.insert(fixedCollapseWhiteSpace->type(), fixedCollapseWhiteSpace);
495 facets.insert(fixedZeroFractionDigits->type(), fixedZeroFractionDigits);
496
497 const XsdFacet::Ptr minInclusive(new XsdFacet());
498 minInclusive->setType(XsdFacet::MinimumInclusive);
499 minInclusive->setValue(DerivedString<TypeString>::fromLexical(m_namePool, QString::fromLatin1("1")));
500 facets.insert(minInclusive->type(), minInclusive);
501 }
502
503 {
504 XsdFacet::Hash &facets = hash[BuiltinTypes::xsYearMonthDuration];
505 facets.insert(fixedCollapseWhiteSpace->type(), fixedCollapseWhiteSpace);
506
507 const XsdFacet::Ptr pattern(new XsdFacet());
508 pattern->setType(XsdFacet::Pattern);
509 pattern->setMultiValue(AtomicValue::List() << DerivedString<TypeString>::fromLexical(m_namePool, QString::fromLatin1("[^DT]*")));
510 facets.insert(pattern->type(), pattern);
511 }
512
513 {
514 XsdFacet::Hash &facets = hash[BuiltinTypes::xsDayTimeDuration];
515 facets.insert(fixedCollapseWhiteSpace->type(), fixedCollapseWhiteSpace);
516
517 const XsdFacet::Ptr pattern(new XsdFacet());
518 pattern->setType(XsdFacet::Pattern);
519 pattern->setMultiValue(AtomicValue::List() << DerivedString<TypeString>::fromLexical(m_namePool, QString::fromLatin1("[^YM]*(T.*)?")));
520 facets.insert(pattern->type(), pattern);
521 }
522
523 return hash;
524 }
525
526 QT_END_NAMESPACE
527