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 "qxsdschemaparsercontext_p.h" |
41 | |
42 | QT_BEGIN_NAMESPACE |
43 | |
44 | using namespace QPatternist; |
45 | |
46 | XsdSchemaParserContext::XsdSchemaParserContext(const NamePool::Ptr &namePool, const XsdSchemaContext::Ptr &context) |
47 | : m_namePool(namePool) |
48 | , m_schema(new XsdSchema(m_namePool)) |
49 | , m_checker(new XsdSchemaChecker(context, this)) |
50 | , m_resolver(new XsdSchemaResolver(context, this)) |
51 | , m_elementDescriptions(setupElementDescriptions()) |
52 | { |
53 | } |
54 | |
55 | NamePool::Ptr XsdSchemaParserContext::namePool() const |
56 | { |
57 | return m_namePool; |
58 | } |
59 | |
60 | XsdSchemaResolver::Ptr XsdSchemaParserContext::resolver() const |
61 | { |
62 | return m_resolver; |
63 | } |
64 | |
65 | XsdSchemaChecker::Ptr XsdSchemaParserContext::checker() const |
66 | { |
67 | return m_checker; |
68 | } |
69 | |
70 | XsdSchema::Ptr XsdSchemaParserContext::schema() const |
71 | { |
72 | return m_schema; |
73 | } |
74 | |
75 | ElementDescription<XsdSchemaToken, XsdTagScope::Type>::Hash XsdSchemaParserContext::elementDescriptions() const |
76 | { |
77 | return m_elementDescriptions; |
78 | } |
79 | |
80 | QXmlName XsdSchemaParserContext::createAnonymousName(const QString &targetNamespace) const |
81 | { |
82 | m_anonymousNameCounter.ref(); |
83 | |
84 | const QString name = QString::fromLatin1(str: "__AnonymousClass_%1" ).arg(a: m_anonymousNameCounter.loadRelaxed()); |
85 | |
86 | return m_namePool->allocateQName(uri: targetNamespace, localName: name); |
87 | } |
88 | |
89 | ElementDescription<XsdSchemaToken, XsdTagScope::Type>::Hash XsdSchemaParserContext::setupElementDescriptions() |
90 | { |
91 | enum |
92 | { |
93 | ReservedForElements = 60 |
94 | }; |
95 | |
96 | ElementDescription<XsdSchemaToken, XsdTagScope::Type>::Hash elementDescriptions; |
97 | elementDescriptions.reserve(asize: ReservedForElements); |
98 | |
99 | { |
100 | ElementDescription<XsdSchemaToken, XsdTagScope::Type> &description = elementDescriptions[XsdTagScope::Schema]; |
101 | description.optionalAttributes.reserve(asize: 10); |
102 | //description.tagToken = XsdSchemaToken::Schema; |
103 | description.optionalAttributes.insert(value: XsdSchemaToken::AttributeFormDefault); |
104 | description.optionalAttributes.insert(value: XsdSchemaToken::BlockDefault); |
105 | description.optionalAttributes.insert(value: XsdSchemaToken::DefaultAttributes); |
106 | description.optionalAttributes.insert(value: XsdSchemaToken::XPathDefaultNamespace); |
107 | description.optionalAttributes.insert(value: XsdSchemaToken::ElementFormDefault); |
108 | description.optionalAttributes.insert(value: XsdSchemaToken::FinalDefault); |
109 | description.optionalAttributes.insert(value: XsdSchemaToken::Id); |
110 | description.optionalAttributes.insert(value: XsdSchemaToken::TargetNamespace); |
111 | description.optionalAttributes.insert(value: XsdSchemaToken::Version); |
112 | description.optionalAttributes.insert(value: XsdSchemaToken::XmlLanguage); |
113 | } |
114 | |
115 | { |
116 | ElementDescription<XsdSchemaToken, XsdTagScope::Type> &description = elementDescriptions[XsdTagScope::Include]; |
117 | //description.tagToken = XsdSchemaToken::Include; |
118 | description.requiredAttributes.insert(value: XsdSchemaToken::SchemaLocation); |
119 | description.optionalAttributes.insert(value: XsdSchemaToken::Id); |
120 | } |
121 | |
122 | { |
123 | ElementDescription<XsdSchemaToken, XsdTagScope::Type> &description = elementDescriptions[XsdTagScope::Import]; |
124 | //description.tagToken = XsdSchemaToken::Import; |
125 | description.optionalAttributes.insert(value: XsdSchemaToken::Id); |
126 | description.optionalAttributes.insert(value: XsdSchemaToken::Namespace); |
127 | description.optionalAttributes.insert(value: XsdSchemaToken::SchemaLocation); |
128 | } |
129 | |
130 | { |
131 | ElementDescription<XsdSchemaToken, XsdTagScope::Type> &description = elementDescriptions[XsdTagScope::Redefine]; |
132 | //description.tagToken = XsdSchemaToken::Redefine; |
133 | description.optionalAttributes.insert(value: XsdSchemaToken::Id); |
134 | description.requiredAttributes.insert(value: XsdSchemaToken::SchemaLocation); |
135 | } |
136 | |
137 | { |
138 | ElementDescription<XsdSchemaToken, XsdTagScope::Type> &description = elementDescriptions[XsdTagScope::Override]; |
139 | //description.tagToken = XsdSchemaToken::Override; |
140 | description.optionalAttributes.insert(value: XsdSchemaToken::Id); |
141 | description.requiredAttributes.insert(value: XsdSchemaToken::SchemaLocation); |
142 | } |
143 | |
144 | { |
145 | ElementDescription<XsdSchemaToken, XsdTagScope::Type> &description = elementDescriptions[XsdTagScope::Annotation]; |
146 | //description.tagToken = XsdSchemaToken::Annotation; |
147 | description.optionalAttributes.insert(value: XsdSchemaToken::Id); |
148 | } |
149 | |
150 | { |
151 | ElementDescription<XsdSchemaToken, XsdTagScope::Type> &description = elementDescriptions[XsdTagScope::AppInfo]; |
152 | //description.tagToken = XsdSchemaToken::Appinfo; |
153 | description.optionalAttributes.insert(value: XsdSchemaToken::Source); |
154 | } |
155 | |
156 | { |
157 | ElementDescription<XsdSchemaToken, XsdTagScope::Type> &description = elementDescriptions[XsdTagScope::Documentation]; |
158 | //description.tagToken = XsdSchemaToken::Documentation; |
159 | description.optionalAttributes.insert(value: XsdSchemaToken::Source); |
160 | } |
161 | |
162 | { |
163 | ElementDescription<XsdSchemaToken, XsdTagScope::Type> &description = elementDescriptions[XsdTagScope::GlobalSimpleType]; |
164 | //description.tagToken = XsdSchemaToken::SimpleType; |
165 | description.optionalAttributes.insert(value: XsdSchemaToken::Final); |
166 | description.optionalAttributes.insert(value: XsdSchemaToken::Id); |
167 | description.requiredAttributes.insert(value: XsdSchemaToken::Name); |
168 | } |
169 | |
170 | { |
171 | ElementDescription<XsdSchemaToken, XsdTagScope::Type> &description = elementDescriptions[XsdTagScope::LocalSimpleType]; |
172 | //description.tagToken = XsdSchemaToken::SimpleType; |
173 | description.optionalAttributes.insert(value: XsdSchemaToken::Id); |
174 | } |
175 | |
176 | { |
177 | ElementDescription<XsdSchemaToken, XsdTagScope::Type> &description = elementDescriptions[XsdTagScope::SimpleRestriction]; |
178 | //description.tagToken = XsdSchemaToken::Restriction; |
179 | description.optionalAttributes.insert(value: XsdSchemaToken::Base); |
180 | description.optionalAttributes.insert(value: XsdSchemaToken::Id); |
181 | } |
182 | |
183 | { |
184 | ElementDescription<XsdSchemaToken, XsdTagScope::Type> &description = elementDescriptions[XsdTagScope::List]; |
185 | //description.tagToken = XsdSchemaToken::List; |
186 | description.optionalAttributes.insert(value: XsdSchemaToken::Id); |
187 | description.optionalAttributes.insert(value: XsdSchemaToken::ItemType); |
188 | } |
189 | |
190 | { |
191 | ElementDescription<XsdSchemaToken, XsdTagScope::Type> &description = elementDescriptions[XsdTagScope::Union]; |
192 | //description.tagToken = XsdSchemaToken::Union; |
193 | description.optionalAttributes.insert(value: XsdSchemaToken::Id); |
194 | description.optionalAttributes.insert(value: XsdSchemaToken::MemberTypes); |
195 | } |
196 | |
197 | { |
198 | ElementDescription<XsdSchemaToken, XsdTagScope::Type> &description = elementDescriptions[XsdTagScope::MinExclusiveFacet]; |
199 | //description.tagToken = XsdSchemaToken::MinExclusive; |
200 | description.optionalAttributes.insert(value: XsdSchemaToken::Fixed); |
201 | description.optionalAttributes.insert(value: XsdSchemaToken::Id); |
202 | description.requiredAttributes.insert(value: XsdSchemaToken::Value); |
203 | } |
204 | |
205 | { |
206 | ElementDescription<XsdSchemaToken, XsdTagScope::Type> &description = elementDescriptions[XsdTagScope::MinInclusiveFacet]; |
207 | //description.tagToken = XsdSchemaToken::MinInclusive; |
208 | description.optionalAttributes.insert(value: XsdSchemaToken::Fixed); |
209 | description.optionalAttributes.insert(value: XsdSchemaToken::Id); |
210 | description.requiredAttributes.insert(value: XsdSchemaToken::Value); |
211 | } |
212 | |
213 | { |
214 | ElementDescription<XsdSchemaToken, XsdTagScope::Type> &description = elementDescriptions[XsdTagScope::MaxExclusiveFacet]; |
215 | //description.tagToken = XsdSchemaToken::MaxExclusive; |
216 | description.optionalAttributes.insert(value: XsdSchemaToken::Fixed); |
217 | description.optionalAttributes.insert(value: XsdSchemaToken::Id); |
218 | description.requiredAttributes.insert(value: XsdSchemaToken::Value); |
219 | } |
220 | |
221 | { |
222 | ElementDescription<XsdSchemaToken, XsdTagScope::Type> &description = elementDescriptions[XsdTagScope::MaxInclusiveFacet]; |
223 | //description.tagToken = XsdSchemaToken::MaxInclusive; |
224 | description.optionalAttributes.insert(value: XsdSchemaToken::Fixed); |
225 | description.optionalAttributes.insert(value: XsdSchemaToken::Id); |
226 | description.requiredAttributes.insert(value: XsdSchemaToken::Value); |
227 | } |
228 | |
229 | { |
230 | ElementDescription<XsdSchemaToken, XsdTagScope::Type> &description = elementDescriptions[XsdTagScope::TotalDigitsFacet]; |
231 | //description.tagToken = XsdSchemaToken::TotalDigits; |
232 | description.optionalAttributes.insert(value: XsdSchemaToken::Fixed); |
233 | description.optionalAttributes.insert(value: XsdSchemaToken::Id); |
234 | description.requiredAttributes.insert(value: XsdSchemaToken::Value); |
235 | } |
236 | |
237 | { |
238 | ElementDescription<XsdSchemaToken, XsdTagScope::Type> &description = elementDescriptions[XsdTagScope::FractionDigitsFacet]; |
239 | //description.tagToken = XsdSchemaToken::FractionDigits; |
240 | description.optionalAttributes.insert(value: XsdSchemaToken::Fixed); |
241 | description.optionalAttributes.insert(value: XsdSchemaToken::Id); |
242 | description.requiredAttributes.insert(value: XsdSchemaToken::Value); |
243 | } |
244 | |
245 | { |
246 | ElementDescription<XsdSchemaToken, XsdTagScope::Type> &description = elementDescriptions[XsdTagScope::LengthFacet]; |
247 | //description.tagToken = XsdSchemaToken::Length; |
248 | description.optionalAttributes.insert(value: XsdSchemaToken::Fixed); |
249 | description.optionalAttributes.insert(value: XsdSchemaToken::Id); |
250 | description.requiredAttributes.insert(value: XsdSchemaToken::Value); |
251 | } |
252 | |
253 | { |
254 | ElementDescription<XsdSchemaToken, XsdTagScope::Type> &description = elementDescriptions[XsdTagScope::MinLengthFacet]; |
255 | //description.tagToken = XsdSchemaToken::MinLength; |
256 | description.optionalAttributes.insert(value: XsdSchemaToken::Fixed); |
257 | description.optionalAttributes.insert(value: XsdSchemaToken::Id); |
258 | description.requiredAttributes.insert(value: XsdSchemaToken::Value); |
259 | } |
260 | |
261 | { |
262 | ElementDescription<XsdSchemaToken, XsdTagScope::Type> &description = elementDescriptions[XsdTagScope::MaxLengthFacet]; |
263 | //description.tagToken = XsdSchemaToken::MaxLength; |
264 | description.optionalAttributes.insert(value: XsdSchemaToken::Fixed); |
265 | description.optionalAttributes.insert(value: XsdSchemaToken::Id); |
266 | description.requiredAttributes.insert(value: XsdSchemaToken::Value); |
267 | } |
268 | |
269 | { |
270 | ElementDescription<XsdSchemaToken, XsdTagScope::Type> &description = elementDescriptions[XsdTagScope::EnumerationFacet]; |
271 | //description.tagToken = XsdSchemaToken::Enumeration; |
272 | description.optionalAttributes.insert(value: XsdSchemaToken::Id); |
273 | description.requiredAttributes.insert(value: XsdSchemaToken::Value); |
274 | } |
275 | |
276 | { |
277 | ElementDescription<XsdSchemaToken, XsdTagScope::Type> &description = elementDescriptions[XsdTagScope::WhiteSpaceFacet]; |
278 | //description.tagToken = XsdSchemaToken::WhiteSpace; |
279 | description.optionalAttributes.insert(value: XsdSchemaToken::Fixed); |
280 | description.optionalAttributes.insert(value: XsdSchemaToken::Id); |
281 | description.requiredAttributes.insert(value: XsdSchemaToken::Value); |
282 | } |
283 | |
284 | { |
285 | ElementDescription<XsdSchemaToken, XsdTagScope::Type> &description = elementDescriptions[XsdTagScope::PatternFacet]; |
286 | //description.tagToken = XsdSchemaToken::Pattern; |
287 | description.optionalAttributes.insert(value: XsdSchemaToken::Id); |
288 | description.requiredAttributes.insert(value: XsdSchemaToken::Value); |
289 | } |
290 | |
291 | { |
292 | ElementDescription<XsdSchemaToken, XsdTagScope::Type> &description = elementDescriptions[XsdTagScope::GlobalComplexType]; |
293 | description.optionalAttributes.reserve(asize: 7); |
294 | //description.tagToken = XsdSchemaToken::ComplexType; |
295 | description.optionalAttributes.insert(value: XsdSchemaToken::Abstract); |
296 | description.optionalAttributes.insert(value: XsdSchemaToken::Block); |
297 | description.optionalAttributes.insert(value: XsdSchemaToken::DefaultAttributesApply); |
298 | description.optionalAttributes.insert(value: XsdSchemaToken::Final); |
299 | description.optionalAttributes.insert(value: XsdSchemaToken::Id); |
300 | description.optionalAttributes.insert(value: XsdSchemaToken::Mixed); |
301 | description.requiredAttributes.insert(value: XsdSchemaToken::Name); |
302 | } |
303 | |
304 | { |
305 | ElementDescription<XsdSchemaToken, XsdTagScope::Type> &description = elementDescriptions[XsdTagScope::LocalComplexType]; |
306 | //description.tagToken = XsdSchemaToken::ComplexType; |
307 | description.optionalAttributes.insert(value: XsdSchemaToken::Id); |
308 | description.optionalAttributes.insert(value: XsdSchemaToken::Mixed); |
309 | } |
310 | |
311 | { |
312 | ElementDescription<XsdSchemaToken, XsdTagScope::Type> &description = elementDescriptions[XsdTagScope::SimpleContent]; |
313 | //description.tagToken = XsdSchemaToken::SimpleContent; |
314 | description.optionalAttributes.insert(value: XsdSchemaToken::Id); |
315 | } |
316 | |
317 | { |
318 | ElementDescription<XsdSchemaToken, XsdTagScope::Type> &description = elementDescriptions[XsdTagScope::SimpleContentRestriction]; |
319 | //description.tagToken = XsdSchemaToken::Restriction; |
320 | description.requiredAttributes.insert(value: XsdSchemaToken::Base); |
321 | description.optionalAttributes.insert(value: XsdSchemaToken::Id); |
322 | } |
323 | |
324 | { |
325 | ElementDescription<XsdSchemaToken, XsdTagScope::Type> &description = elementDescriptions[XsdTagScope::SimpleContentExtension]; |
326 | //description.tagToken = XsdSchemaToken::Extension; |
327 | description.requiredAttributes.insert(value: XsdSchemaToken::Base); |
328 | description.optionalAttributes.insert(value: XsdSchemaToken::Id); |
329 | } |
330 | |
331 | { |
332 | ElementDescription<XsdSchemaToken, XsdTagScope::Type> &description = elementDescriptions[XsdTagScope::ComplexContent]; |
333 | //description.tagToken = XsdSchemaToken::ComplexContent; |
334 | description.optionalAttributes.insert(value: XsdSchemaToken::Id); |
335 | description.optionalAttributes.insert(value: XsdSchemaToken::Mixed); |
336 | } |
337 | |
338 | { |
339 | ElementDescription<XsdSchemaToken, XsdTagScope::Type> &description = elementDescriptions[XsdTagScope::ComplexContentRestriction]; |
340 | //description.tagToken = XsdSchemaToken::Restriction; |
341 | description.requiredAttributes.insert(value: XsdSchemaToken::Base); |
342 | description.optionalAttributes.insert(value: XsdSchemaToken::Id); |
343 | } |
344 | |
345 | { |
346 | ElementDescription<XsdSchemaToken, XsdTagScope::Type> &description = elementDescriptions[XsdTagScope::ComplexContentExtension]; |
347 | //description.tagToken = XsdSchemaToken::Extension; |
348 | description.requiredAttributes.insert(value: XsdSchemaToken::Base); |
349 | description.optionalAttributes.insert(value: XsdSchemaToken::Id); |
350 | } |
351 | |
352 | { |
353 | ElementDescription<XsdSchemaToken, XsdTagScope::Type> &description = elementDescriptions[XsdTagScope::NamedGroup]; |
354 | //description.tagToken = XsdSchemaToken::Group; |
355 | description.optionalAttributes.insert(value: XsdSchemaToken::Id); |
356 | description.requiredAttributes.insert(value: XsdSchemaToken::Name); |
357 | } |
358 | |
359 | { |
360 | ElementDescription<XsdSchemaToken, XsdTagScope::Type> &description = elementDescriptions[XsdTagScope::ReferredGroup]; |
361 | description.optionalAttributes.reserve(asize: 4); |
362 | //description.tagToken = XsdSchemaToken::Group; |
363 | description.optionalAttributes.insert(value: XsdSchemaToken::Id); |
364 | description.optionalAttributes.insert(value: XsdSchemaToken::MaxOccurs); |
365 | description.optionalAttributes.insert(value: XsdSchemaToken::MinOccurs); |
366 | description.requiredAttributes.insert(value: XsdSchemaToken::Ref); |
367 | } |
368 | |
369 | { |
370 | ElementDescription<XsdSchemaToken, XsdTagScope::Type> &description = elementDescriptions[XsdTagScope::All]; |
371 | //description.tagToken = XsdSchemaToken::All; |
372 | description.optionalAttributes.insert(value: XsdSchemaToken::Id); |
373 | } |
374 | |
375 | { |
376 | ElementDescription<XsdSchemaToken, XsdTagScope::Type> &description = elementDescriptions[XsdTagScope::LocalAll]; |
377 | //description.tagToken = XsdSchemaToken::All; |
378 | description.optionalAttributes.insert(value: XsdSchemaToken::Id); |
379 | description.optionalAttributes.insert(value: XsdSchemaToken::MaxOccurs); |
380 | description.optionalAttributes.insert(value: XsdSchemaToken::MinOccurs); |
381 | } |
382 | |
383 | { |
384 | ElementDescription<XsdSchemaToken, XsdTagScope::Type> &description = elementDescriptions[XsdTagScope::Choice]; |
385 | //description.tagToken = XsdSchemaToken::Choice; |
386 | description.optionalAttributes.insert(value: XsdSchemaToken::Id); |
387 | } |
388 | |
389 | { |
390 | ElementDescription<XsdSchemaToken, XsdTagScope::Type> &description = elementDescriptions[XsdTagScope::LocalChoice]; |
391 | //description.tagToken = XsdSchemaToken::Choice; |
392 | description.optionalAttributes.insert(value: XsdSchemaToken::Id); |
393 | description.optionalAttributes.insert(value: XsdSchemaToken::MaxOccurs); |
394 | description.optionalAttributes.insert(value: XsdSchemaToken::MinOccurs); |
395 | } |
396 | |
397 | { |
398 | ElementDescription<XsdSchemaToken, XsdTagScope::Type> &description = elementDescriptions[XsdTagScope::Sequence]; |
399 | //description.tagToken = XsdSchemaToken::Sequence; |
400 | description.optionalAttributes.insert(value: XsdSchemaToken::Id); |
401 | } |
402 | |
403 | { |
404 | ElementDescription<XsdSchemaToken, XsdTagScope::Type> &description = elementDescriptions[XsdTagScope::LocalSequence]; |
405 | //description.tagToken = XsdSchemaToken::Sequence; |
406 | description.optionalAttributes.insert(value: XsdSchemaToken::Id); |
407 | description.optionalAttributes.insert(value: XsdSchemaToken::MaxOccurs); |
408 | description.optionalAttributes.insert(value: XsdSchemaToken::MinOccurs); |
409 | } |
410 | |
411 | { |
412 | ElementDescription<XsdSchemaToken, XsdTagScope::Type> &description = elementDescriptions[XsdTagScope::GlobalAttribute]; |
413 | description.optionalAttributes.reserve(asize: 5); |
414 | //description.tagToken = XsdSchemaToken::Attribute; |
415 | description.optionalAttributes.insert(value: XsdSchemaToken::Default); |
416 | description.optionalAttributes.insert(value: XsdSchemaToken::Fixed); |
417 | description.optionalAttributes.insert(value: XsdSchemaToken::Id); |
418 | description.requiredAttributes.insert(value: XsdSchemaToken::Name); |
419 | description.optionalAttributes.insert(value: XsdSchemaToken::Type); |
420 | } |
421 | |
422 | { |
423 | ElementDescription<XsdSchemaToken, XsdTagScope::Type> &description = elementDescriptions[XsdTagScope::LocalAttribute]; |
424 | description.optionalAttributes.reserve(asize: 8); |
425 | //description.tagToken = XsdSchemaToken::Attribute; |
426 | description.optionalAttributes.insert(value: XsdSchemaToken::Default); |
427 | description.optionalAttributes.insert(value: XsdSchemaToken::Fixed); |
428 | description.optionalAttributes.insert(value: XsdSchemaToken::Form); |
429 | description.optionalAttributes.insert(value: XsdSchemaToken::Id); |
430 | description.optionalAttributes.insert(value: XsdSchemaToken::Name); |
431 | description.optionalAttributes.insert(value: XsdSchemaToken::Ref); |
432 | description.optionalAttributes.insert(value: XsdSchemaToken::Type); |
433 | description.optionalAttributes.insert(value: XsdSchemaToken::Use); |
434 | } |
435 | |
436 | { |
437 | ElementDescription<XsdSchemaToken, XsdTagScope::Type> &description = elementDescriptions[XsdTagScope::NamedAttributeGroup]; |
438 | //description.tagToken = XsdSchemaToken::AttributeGroup; |
439 | description.optionalAttributes.insert(value: XsdSchemaToken::Id); |
440 | description.requiredAttributes.insert(value: XsdSchemaToken::Name); |
441 | } |
442 | |
443 | { |
444 | ElementDescription<XsdSchemaToken, XsdTagScope::Type> &description = elementDescriptions[XsdTagScope::ReferredAttributeGroup]; |
445 | //description.tagToken = XsdSchemaToken::AttributeGroup; |
446 | description.optionalAttributes.insert(value: XsdSchemaToken::Id); |
447 | description.requiredAttributes.insert(value: XsdSchemaToken::Ref); |
448 | } |
449 | |
450 | { |
451 | ElementDescription<XsdSchemaToken, XsdTagScope::Type> &description = elementDescriptions[XsdTagScope::LocalElement]; |
452 | description.optionalAttributes.reserve(asize: 11); |
453 | //description.tagToken = XsdSchemaToken::Element; |
454 | description.optionalAttributes.insert(value: XsdSchemaToken::Block); |
455 | description.optionalAttributes.insert(value: XsdSchemaToken::Default); |
456 | description.optionalAttributes.insert(value: XsdSchemaToken::Fixed); |
457 | description.optionalAttributes.insert(value: XsdSchemaToken::Form); |
458 | description.optionalAttributes.insert(value: XsdSchemaToken::Id); |
459 | description.optionalAttributes.insert(value: XsdSchemaToken::MinOccurs); |
460 | description.optionalAttributes.insert(value: XsdSchemaToken::MaxOccurs); |
461 | description.optionalAttributes.insert(value: XsdSchemaToken::Name); |
462 | description.optionalAttributes.insert(value: XsdSchemaToken::Nillable); |
463 | description.optionalAttributes.insert(value: XsdSchemaToken::Ref); |
464 | description.optionalAttributes.insert(value: XsdSchemaToken::Type); |
465 | } |
466 | |
467 | { |
468 | ElementDescription<XsdSchemaToken, XsdTagScope::Type> &description = elementDescriptions[XsdTagScope::GlobalElement]; |
469 | description.optionalAttributes.reserve(asize: 10); |
470 | //description.tagToken = XsdSchemaToken::Element; |
471 | description.optionalAttributes.insert(value: XsdSchemaToken::Abstract); |
472 | description.optionalAttributes.insert(value: XsdSchemaToken::Block); |
473 | description.optionalAttributes.insert(value: XsdSchemaToken::Default); |
474 | description.optionalAttributes.insert(value: XsdSchemaToken::Final); |
475 | description.optionalAttributes.insert(value: XsdSchemaToken::Fixed); |
476 | description.optionalAttributes.insert(value: XsdSchemaToken::Id); |
477 | description.requiredAttributes.insert(value: XsdSchemaToken::Name); |
478 | description.optionalAttributes.insert(value: XsdSchemaToken::Nillable); |
479 | description.optionalAttributes.insert(value: XsdSchemaToken::SubstitutionGroup); |
480 | description.optionalAttributes.insert(value: XsdSchemaToken::Type); |
481 | } |
482 | |
483 | { |
484 | ElementDescription<XsdSchemaToken, XsdTagScope::Type> &description = elementDescriptions[XsdTagScope::Unique]; |
485 | //description.tagToken = XsdSchemaToken::Unique; |
486 | description.optionalAttributes.insert(value: XsdSchemaToken::Id); |
487 | description.requiredAttributes.insert(value: XsdSchemaToken::Name); |
488 | } |
489 | |
490 | { |
491 | ElementDescription<XsdSchemaToken, XsdTagScope::Type> &description = elementDescriptions[XsdTagScope::Key]; |
492 | //description.tagToken = XsdSchemaToken::Key; |
493 | description.optionalAttributes.insert(value: XsdSchemaToken::Id); |
494 | description.requiredAttributes.insert(value: XsdSchemaToken::Name); |
495 | } |
496 | |
497 | { |
498 | ElementDescription<XsdSchemaToken, XsdTagScope::Type> &description = elementDescriptions[XsdTagScope::KeyRef]; |
499 | //description.tagToken = XsdSchemaToken::Keyref; |
500 | description.optionalAttributes.insert(value: XsdSchemaToken::Id); |
501 | description.requiredAttributes.insert(value: XsdSchemaToken::Name); |
502 | description.requiredAttributes.insert(value: XsdSchemaToken::Refer); |
503 | } |
504 | |
505 | { |
506 | ElementDescription<XsdSchemaToken, XsdTagScope::Type> &description = elementDescriptions[XsdTagScope::Selector]; |
507 | //description.tagToken = XsdSchemaToken::Selector; |
508 | description.optionalAttributes.insert(value: XsdSchemaToken::Id); |
509 | description.requiredAttributes.insert(value: XsdSchemaToken::Xpath); |
510 | description.optionalAttributes.insert(value: XsdSchemaToken::XPathDefaultNamespace); |
511 | } |
512 | |
513 | { |
514 | ElementDescription<XsdSchemaToken, XsdTagScope::Type> &description = elementDescriptions[XsdTagScope::Field]; |
515 | //description.tagToken = XsdSchemaToken::Field; |
516 | description.optionalAttributes.insert(value: XsdSchemaToken::Id); |
517 | description.requiredAttributes.insert(value: XsdSchemaToken::Xpath); |
518 | description.optionalAttributes.insert(value: XsdSchemaToken::XPathDefaultNamespace); |
519 | } |
520 | |
521 | { |
522 | ElementDescription<XsdSchemaToken, XsdTagScope::Type> &description = elementDescriptions[XsdTagScope::Notation]; |
523 | description.optionalAttributes.reserve(asize: 4); |
524 | //description.tagToken = XsdSchemaToken::Notation; |
525 | description.optionalAttributes.insert(value: XsdSchemaToken::Id); |
526 | description.requiredAttributes.insert(value: XsdSchemaToken::Name); |
527 | description.optionalAttributes.insert(value: XsdSchemaToken::Public); |
528 | description.optionalAttributes.insert(value: XsdSchemaToken::System); |
529 | } |
530 | |
531 | { |
532 | ElementDescription<XsdSchemaToken, XsdTagScope::Type> &description = elementDescriptions[XsdTagScope::Any]; |
533 | description.optionalAttributes.reserve(asize: 7); |
534 | //description.tagToken = XsdSchemaToken::Any; |
535 | description.optionalAttributes.insert(value: XsdSchemaToken::Id); |
536 | description.optionalAttributes.insert(value: XsdSchemaToken::MaxOccurs); |
537 | description.optionalAttributes.insert(value: XsdSchemaToken::MinOccurs); |
538 | description.optionalAttributes.insert(value: XsdSchemaToken::Namespace); |
539 | description.optionalAttributes.insert(value: XsdSchemaToken::NotNamespace); |
540 | description.optionalAttributes.insert(value: XsdSchemaToken::NotQName); |
541 | description.optionalAttributes.insert(value: XsdSchemaToken::ProcessContents); |
542 | } |
543 | |
544 | { |
545 | ElementDescription<XsdSchemaToken, XsdTagScope::Type> &description = elementDescriptions[XsdTagScope::AnyAttribute]; |
546 | description.optionalAttributes.reserve(asize: 5); |
547 | //description.tagToken = XsdSchemaToken::AnyAttribute; |
548 | description.optionalAttributes.insert(value: XsdSchemaToken::Id); |
549 | description.optionalAttributes.insert(value: XsdSchemaToken::Namespace); |
550 | description.optionalAttributes.insert(value: XsdSchemaToken::NotNamespace); |
551 | description.optionalAttributes.insert(value: XsdSchemaToken::NotQName); |
552 | description.optionalAttributes.insert(value: XsdSchemaToken::ProcessContents); |
553 | } |
554 | |
555 | { |
556 | ElementDescription<XsdSchemaToken, XsdTagScope::Type> &description = elementDescriptions[XsdTagScope::Alternative]; |
557 | //description.tagToken = XsdSchemaToken::Alternative; |
558 | description.optionalAttributes.insert(value: XsdSchemaToken::Id); |
559 | description.optionalAttributes.insert(value: XsdSchemaToken::Test); |
560 | description.optionalAttributes.insert(value: XsdSchemaToken::Type); |
561 | description.optionalAttributes.insert(value: XsdSchemaToken::XPathDefaultNamespace); |
562 | } |
563 | |
564 | { |
565 | ElementDescription<XsdSchemaToken, XsdTagScope::Type> &description = elementDescriptions[XsdTagScope::OpenContent]; |
566 | //description.tagToken = XsdSchemaToken::OpenContent; |
567 | description.optionalAttributes.insert(value: XsdSchemaToken::Id); |
568 | description.optionalAttributes.insert(value: XsdSchemaToken::Mode); |
569 | } |
570 | |
571 | { |
572 | ElementDescription<XsdSchemaToken, XsdTagScope::Type> &description = elementDescriptions[XsdTagScope::DefaultOpenContent]; |
573 | //description.tagToken = XsdSchemaToken::DefaultOpenContent; |
574 | description.optionalAttributes.insert(value: XsdSchemaToken::AppliesToEmpty); |
575 | description.optionalAttributes.insert(value: XsdSchemaToken::Id); |
576 | description.optionalAttributes.insert(value: XsdSchemaToken::Mode); |
577 | } |
578 | |
579 | { |
580 | ElementDescription<XsdSchemaToken, XsdTagScope::Type> &description = elementDescriptions[XsdTagScope::Assert]; |
581 | //description.tagToken = XsdSchemaToken::Assert; |
582 | description.optionalAttributes.insert(value: XsdSchemaToken::Id); |
583 | description.requiredAttributes.insert(value: XsdSchemaToken::Test); |
584 | description.optionalAttributes.insert(value: XsdSchemaToken::XPathDefaultNamespace); |
585 | } |
586 | |
587 | { |
588 | ElementDescription<XsdSchemaToken, XsdTagScope::Type> &description = elementDescriptions[XsdTagScope::Assertion]; |
589 | //description.tagToken = XsdSchemaToken::Assertion; |
590 | description.optionalAttributes.insert(value: XsdSchemaToken::Id); |
591 | description.requiredAttributes.insert(value: XsdSchemaToken::Test); |
592 | description.optionalAttributes.insert(value: XsdSchemaToken::XPathDefaultNamespace); |
593 | } |
594 | |
595 | Q_ASSERT_X(elementDescriptions.count() == ReservedForElements, Q_FUNC_INFO, |
596 | qPrintable(QString::fromLatin1("Expected is %1, actual is %2." ).arg(ReservedForElements).arg(elementDescriptions.count()))); |
597 | |
598 | return elementDescriptions; |
599 | } |
600 | |
601 | QT_END_NAMESPACE |
602 | |