1 /****************************************************************************
3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
4 ** All rights reserved.
5 ** Contact: Nokia Corporation (qt-info@nokia.com)
7 ** This file is part of the QtXmlPatterns module of the Qt Toolkit.
9 ** $QT_BEGIN_LICENSE:LGPL$
10 ** No Commercial Usage
11 ** This file contains pre-release code and may not be distributed.
12 ** You may use this file in accordance with the terms and conditions
13 ** contained in the Technology Preview License Agreement accompanying
16 ** GNU Lesser General Public License Usage
17 ** Alternatively, this file may be used under the terms of the GNU Lesser
18 ** General Public License version 2.1 as published by the Free Software
19 ** Foundation and appearing in the file LICENSE.LGPL included in the
20 ** packaging of this file. Please review the following information to
21 ** ensure the GNU Lesser General Public License version 2.1 requirements
22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
24 ** In addition, as a special exception, Nokia gives you certain additional
25 ** rights. These rights are described in the Nokia Qt LGPL Exception
26 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
28 ** If you have questions regarding the use of this file, please contact
29 ** Nokia at qt-info@nokia.com.
40 ****************************************************************************/
42 #include "qxsdschemachecker_p.h"
46 using namespace QPatternist
;
48 void XsdSchemaChecker::setupAllowedAtomicFacets()
52 QSet
<XsdFacet::Type
> facets
;
53 facets
<< XsdFacet::Length
54 << XsdFacet::MinimumLength
55 << XsdFacet::MaximumLength
57 << XsdFacet::Enumeration
58 << XsdFacet::WhiteSpace
59 << XsdFacet::Assertion
;
61 m_allowedAtomicFacets
.insert(BuiltinTypes::xsString
->name(m_namePool
), facets
);
66 QSet
<XsdFacet::Type
> facets
;
67 facets
<< XsdFacet::Pattern
68 << XsdFacet::WhiteSpace
69 << XsdFacet::Assertion
;
71 m_allowedAtomicFacets
.insert(BuiltinTypes::xsBoolean
->name(m_namePool
), facets
);
76 QSet
<XsdFacet::Type
> facets
;
77 facets
<< XsdFacet::Pattern
78 << XsdFacet::Enumeration
79 << XsdFacet::WhiteSpace
80 << XsdFacet::MaximumInclusive
81 << XsdFacet::MaximumExclusive
82 << XsdFacet::MinimumInclusive
83 << XsdFacet::MinimumExclusive
84 << XsdFacet::Assertion
;
86 m_allowedAtomicFacets
.insert(BuiltinTypes::xsFloat
->name(m_namePool
), facets
);
91 QSet
<XsdFacet::Type
> facets
;
92 facets
<< XsdFacet::Pattern
93 << XsdFacet::Enumeration
94 << XsdFacet::WhiteSpace
95 << XsdFacet::MaximumInclusive
96 << XsdFacet::MaximumExclusive
97 << XsdFacet::MinimumInclusive
98 << XsdFacet::MinimumExclusive
99 << XsdFacet::Assertion
;
101 m_allowedAtomicFacets
.insert(BuiltinTypes::xsDouble
->name(m_namePool
), facets
);
106 QSet
<XsdFacet::Type
> facets
;
107 facets
<< XsdFacet::TotalDigits
108 << XsdFacet::FractionDigits
110 << XsdFacet::Enumeration
111 << XsdFacet::WhiteSpace
112 << XsdFacet::MaximumInclusive
113 << XsdFacet::MaximumExclusive
114 << XsdFacet::MinimumInclusive
115 << XsdFacet::MinimumExclusive
116 << XsdFacet::Assertion
;
118 m_allowedAtomicFacets
.insert(BuiltinTypes::xsDecimal
->name(m_namePool
), facets
);
123 QSet
<XsdFacet::Type
> facets
;
124 facets
<< XsdFacet::Pattern
125 << XsdFacet::Enumeration
126 << XsdFacet::WhiteSpace
127 << XsdFacet::MaximumInclusive
128 << XsdFacet::MaximumExclusive
129 << XsdFacet::MinimumInclusive
130 << XsdFacet::MinimumExclusive
131 << XsdFacet::Assertion
;
133 m_allowedAtomicFacets
.insert(BuiltinTypes::xsDuration
->name(m_namePool
), facets
);
138 QSet
<XsdFacet::Type
> facets
;
139 facets
<< XsdFacet::Pattern
140 << XsdFacet::Enumeration
141 << XsdFacet::WhiteSpace
142 << XsdFacet::MaximumInclusive
143 << XsdFacet::MaximumExclusive
144 << XsdFacet::MinimumInclusive
145 << XsdFacet::MinimumExclusive
146 << XsdFacet::Assertion
;
148 m_allowedAtomicFacets
.insert(BuiltinTypes::xsDateTime
->name(m_namePool
), facets
);
153 QSet
<XsdFacet::Type
> facets
;
154 facets
<< XsdFacet::Pattern
155 << XsdFacet::Enumeration
156 << XsdFacet::WhiteSpace
157 << XsdFacet::MaximumInclusive
158 << XsdFacet::MaximumExclusive
159 << XsdFacet::MinimumInclusive
160 << XsdFacet::MinimumExclusive
161 << XsdFacet::Assertion
;
163 m_allowedAtomicFacets
.insert(BuiltinTypes::xsTime
->name(m_namePool
), facets
);
168 QSet
<XsdFacet::Type
> facets
;
169 facets
<< XsdFacet::Pattern
170 << XsdFacet::Enumeration
171 << XsdFacet::WhiteSpace
172 << XsdFacet::MaximumInclusive
173 << XsdFacet::MaximumExclusive
174 << XsdFacet::MinimumInclusive
175 << XsdFacet::MinimumExclusive
176 << XsdFacet::Assertion
;
178 m_allowedAtomicFacets
.insert(BuiltinTypes::xsDate
->name(m_namePool
), facets
);
183 QSet
<XsdFacet::Type
> facets
;
184 facets
<< XsdFacet::Pattern
185 << XsdFacet::Enumeration
186 << XsdFacet::WhiteSpace
187 << XsdFacet::MaximumInclusive
188 << XsdFacet::MaximumExclusive
189 << XsdFacet::MinimumInclusive
190 << XsdFacet::MinimumExclusive
191 << XsdFacet::Assertion
;
193 m_allowedAtomicFacets
.insert(BuiltinTypes::xsGYearMonth
->name(m_namePool
), facets
);
198 QSet
<XsdFacet::Type
> facets
;
199 facets
<< XsdFacet::Pattern
200 << XsdFacet::Enumeration
201 << XsdFacet::WhiteSpace
202 << XsdFacet::MaximumInclusive
203 << XsdFacet::MaximumExclusive
204 << XsdFacet::MinimumInclusive
205 << XsdFacet::MinimumExclusive
206 << XsdFacet::Assertion
;
208 m_allowedAtomicFacets
.insert(BuiltinTypes::xsGYear
->name(m_namePool
), facets
);
213 QSet
<XsdFacet::Type
> facets
;
214 facets
<< XsdFacet::Pattern
215 << XsdFacet::Enumeration
216 << XsdFacet::WhiteSpace
217 << XsdFacet::MaximumInclusive
218 << XsdFacet::MaximumExclusive
219 << XsdFacet::MinimumInclusive
220 << XsdFacet::MinimumExclusive
221 << XsdFacet::Assertion
;
223 m_allowedAtomicFacets
.insert(BuiltinTypes::xsGMonthDay
->name(m_namePool
), facets
);
228 QSet
<XsdFacet::Type
> facets
;
229 facets
<< XsdFacet::Pattern
230 << XsdFacet::Enumeration
231 << XsdFacet::WhiteSpace
232 << XsdFacet::MaximumInclusive
233 << XsdFacet::MaximumExclusive
234 << XsdFacet::MinimumInclusive
235 << XsdFacet::MinimumExclusive
236 << XsdFacet::Assertion
;
238 m_allowedAtomicFacets
.insert(BuiltinTypes::xsGDay
->name(m_namePool
), facets
);
243 QSet
<XsdFacet::Type
> facets
;
244 facets
<< XsdFacet::Pattern
245 << XsdFacet::Enumeration
246 << XsdFacet::WhiteSpace
247 << XsdFacet::MaximumInclusive
248 << XsdFacet::MaximumExclusive
249 << XsdFacet::MinimumInclusive
250 << XsdFacet::MinimumExclusive
251 << XsdFacet::Assertion
;
253 m_allowedAtomicFacets
.insert(BuiltinTypes::xsGMonth
->name(m_namePool
), facets
);
258 QSet
<XsdFacet::Type
> facets
;
259 facets
<< XsdFacet::Length
260 << XsdFacet::MinimumLength
261 << XsdFacet::MaximumLength
263 << XsdFacet::Enumeration
264 << XsdFacet::WhiteSpace
265 << XsdFacet::Assertion
;
267 m_allowedAtomicFacets
.insert(BuiltinTypes::xsHexBinary
->name(m_namePool
), facets
);
272 QSet
<XsdFacet::Type
> facets
;
273 facets
<< XsdFacet::Length
274 << XsdFacet::MinimumLength
275 << XsdFacet::MaximumLength
277 << XsdFacet::Enumeration
278 << XsdFacet::WhiteSpace
279 << XsdFacet::Assertion
;
281 m_allowedAtomicFacets
.insert(BuiltinTypes::xsBase64Binary
->name(m_namePool
), facets
);
286 QSet
<XsdFacet::Type
> facets
;
287 facets
<< XsdFacet::Length
288 << XsdFacet::MinimumLength
289 << XsdFacet::MaximumLength
291 << XsdFacet::Enumeration
292 << XsdFacet::WhiteSpace
293 << XsdFacet::Assertion
;
295 m_allowedAtomicFacets
.insert(BuiltinTypes::xsAnyURI
->name(m_namePool
), facets
);
300 QSet
<XsdFacet::Type
> facets
;
301 facets
<< XsdFacet::Length
302 << XsdFacet::MinimumLength
303 << XsdFacet::MaximumLength
305 << XsdFacet::Enumeration
306 << XsdFacet::WhiteSpace
307 << XsdFacet::Assertion
;
309 m_allowedAtomicFacets
.insert(BuiltinTypes::xsQName
->name(m_namePool
), facets
);
314 QSet
<XsdFacet::Type
> facets
;
315 facets
<< XsdFacet::Length
316 << XsdFacet::MinimumLength
317 << XsdFacet::MaximumLength
319 << XsdFacet::Enumeration
320 << XsdFacet::WhiteSpace
321 << XsdFacet::Assertion
;
323 m_allowedAtomicFacets
.insert(BuiltinTypes::xsNOTATION
->name(m_namePool
), facets
);