Merge lp:~zorba-coders/zorba/bug1073964-valInternalError into lp:zorba
- bug1073964-valInternalError
- Merge into trunk
Status: | Merged |
---|---|
Approved by: | Sorin Marian Nasoi |
Approved revision: | 11134 |
Merged at revision: | 11136 |
Proposed branch: | lp:~zorba-coders/zorba/bug1073964-valInternalError |
Merge into: | lp:zorba |
Diff against target: |
1231 lines (+185/-175) 1 file modified
src/types/schema/XercSchemaValidator.cpp (+185/-175) |
To merge this branch: | bzr merge lp:~zorba-coders/zorba/bug1073964-valInternalError |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Sorin Marian Nasoi | Approve | ||
Cezar Andrei | Approve | ||
Review via email: mp+136295@code.launchpad.net |
Commit message
Fix internal error.
Description of the change
Fix internal error.
Cezar Andrei (cezar-andrei) : | # |
Sorin Marian Nasoi (sorin.marian.nasoi) : | # |
Zorba Build Bot (zorba-buildbot) wrote : | # |
Zorba Build Bot (zorba-buildbot) wrote : | # |
The attempt to merge lp:~zorba-coders/zorba/bug1073964-valInternalError into lp:zorba failed. Below is the output from the failed tests.
CMake Error at /home/ceej/
Validation queue job bug1073964-valInternalErr
is finished. The final status was:
2 tests did not succeed - changes not commited.
Error in read script: /home/ceej/
Zorba Build Bot (zorba-buildbot) wrote : | # |
Validation queue starting for merge proposal.
Log at: http://
Zorba Build Bot (zorba-buildbot) wrote : | # |
Validation queue job bug1073964-valInternalErr
All tests succeeded!
Preview Diff
1 | === modified file 'src/types/schema/XercSchemaValidator.cpp' |
2 | --- src/types/schema/XercSchemaValidator.cpp 2012-09-19 21:16:15 +0000 |
3 | +++ src/types/schema/XercSchemaValidator.cpp 2012-11-28 07:22:12 +0000 |
4 | @@ -123,6 +123,11 @@ |
5 | // to do to validate it. |
6 | // |
7 | // the top of the type stack always knows best... |
8 | + if ( fTypeStack->empty() ) |
9 | + { |
10 | + emitError(XMLValid::DatatypeValidationFailure, elemDecl->getFullName()); |
11 | + } |
12 | + |
13 | ComplexTypeInfo* currType = fTypeStack->pop(); |
14 | |
15 | const SchemaElementDecl::ModelTypes modelType = (currType) |
16 | @@ -171,7 +176,7 @@ |
17 | , fGrammarResolver |
18 | , fGrammarResolver->getStringPool() |
19 | , indexFailingChild |
20 | - , getScanner()->getMemoryManager()); |
21 | + , getScanner()->getMemoryManager()); |
22 | } |
23 | |
24 | if(!result) { |
25 | @@ -194,7 +199,7 @@ |
26 | XMLCh* value = fDatatypeBuffer.getRawBuffer(); |
27 | XMLCh* elemDefaultValue = ((SchemaElementDecl*) elemDecl)->getDefaultValue(); |
28 | |
29 | - if (fCurrentDatatypeValidator) |
30 | + if (fCurrentDatatypeValidator) |
31 | { |
32 | if (fNil) |
33 | { |
34 | @@ -364,7 +369,7 @@ |
35 | { |
36 | fTrailingSeenNonWhiteSpace.flags = 0; |
37 | fSeenId = false; |
38 | - fTypeStack->removeAllElements(); |
39 | + fTypeStack->removeAllElements(); |
40 | delete fXsiType; |
41 | fXsiType = 0; |
42 | fCurrentDatatypeValidator = 0; |
43 | @@ -561,7 +566,7 @@ |
44 | |
45 | fErrorOccurred = false; |
46 | |
47 | - if (fXsiType) |
48 | + if (fXsiType) |
49 | { |
50 | // handle "xsi:type" right here |
51 | DatatypeValidator *xsiTypeDV = 0; |
52 | @@ -1085,7 +1090,7 @@ |
53 | } |
54 | catch (const XMLException& excep) { |
55 | fSchemaErrorReporter.emitError(excep, curGroup.getLocator()); |
56 | - } |
57 | + } |
58 | } |
59 | |
60 | if (curGroup.getCheckElementConsistency()) |
61 | @@ -1686,7 +1691,7 @@ |
62 | int baseFlags = baseElemDecl->getMiscFlags(); |
63 | |
64 | if (((baseFlags & SchemaSymbols::XSD_NILLABLE) == 0) && |
65 | - ((derivedFlags & SchemaSymbols::XSD_NILLABLE) != 0)) { |
66 | + ((derivedFlags & SchemaSymbols::XSD_NILLABLE) != 0)) { |
67 | ThrowXMLwithMemMgr1(RuntimeException, XMLExcepts::PD_NameTypeOK2, derivedName, fMemoryManager); |
68 | } |
69 | |
70 | @@ -1809,7 +1814,7 @@ |
71 | DatatypeValidator* bDV = baseElemDecl->getDatatypeValidator(); |
72 | |
73 | if (bInfo || bDV == 0 || |
74 | - !bDV->isSubstitutableBy(derivedElemDecl->getDatatypeValidator())) { |
75 | + !bDV->isSubstitutableBy(derivedElemDecl->getDatatypeValidator())) { |
76 | ThrowXMLwithMemMgr1(RuntimeException, XMLExcepts::PD_NameTypeOK5, derivedElemName, fMemoryManager); |
77 | } |
78 | |
79 | @@ -2163,7 +2168,7 @@ |
80 | // didn't find a match. |
81 | if (!matched) { |
82 | |
83 | - codeToThrow = XMLExcepts::PD_RecurseUnordered; |
84 | + codeToThrow = XMLExcepts::PD_RecurseUnordered; |
85 | break; |
86 | } |
87 | } |
88 | @@ -2173,7 +2178,7 @@ |
89 | for (XMLSize_t j=0; j < baseCount; j++) { |
90 | if (!foundIt[j] && baseNodes->elementAt(j)->getMinTotalRange()) { |
91 | |
92 | - codeToThrow = XMLExcepts::PD_RecurseUnordered; |
93 | + codeToThrow = XMLExcepts::PD_RecurseUnordered; |
94 | break; |
95 | } |
96 | } |
97 | @@ -2229,7 +2234,7 @@ |
98 | |
99 | // didn't find a match. |
100 | if (!matched) { |
101 | - ThrowXMLwithMemMgr(RuntimeException, XMLExcepts::PD_MapAndSum, fMemoryManager); |
102 | + ThrowXMLwithMemMgr(RuntimeException, XMLExcepts::PD_MapAndSum, fMemoryManager); |
103 | } |
104 | } |
105 | |
106 | @@ -2309,6 +2314,11 @@ |
107 | // to do to validate it. |
108 | // |
109 | // the top of the type stack always knows best... |
110 | + if ( fTypeStack->empty() ) |
111 | + { |
112 | + emitError(XMLValid::DatatypeValidationFailure, elemDecl->getFullName()); |
113 | + } |
114 | + |
115 | ComplexTypeInfo* currType = fTypeStack->pop(); |
116 | |
117 | const SchemaElementDecl::ModelTypes modelType = (currType) |
118 | @@ -2383,7 +2393,7 @@ |
119 | XMLCh* value = fDatatypeBuffer.getRawBuffer(); |
120 | XMLCh* elemDefaultValue = ((SchemaElementDecl*) elemDecl)->getDefaultValue(); |
121 | |
122 | - if (fCurrentDatatypeValidator) |
123 | + if (fCurrentDatatypeValidator) |
124 | { |
125 | if (fNil) |
126 | { |
127 | @@ -2549,7 +2559,7 @@ |
128 | { |
129 | fTrailing = false; |
130 | fSeenId = false; |
131 | - fTypeStack->removeAllElements(); |
132 | + fTypeStack->removeAllElements(); |
133 | delete fXsiType; |
134 | fXsiType = 0; |
135 | fCurrentDatatypeValidator = 0; |
136 | @@ -2742,7 +2752,7 @@ |
137 | |
138 | fErrorOccurred = false; |
139 | |
140 | - if (fXsiType) |
141 | + if (fXsiType) |
142 | { |
143 | // handle "xsi:type" right here |
144 | DatatypeValidator *xsiTypeDV = 0; |
145 | @@ -2752,43 +2762,43 @@ |
146 | if (uri != XMLElementDecl::fgInvalidElemId && |
147 | uri != XMLElementDecl::fgPCDataElemId && |
148 | uri != XMLContentModel::gEpsilonFakeId && |
149 | - uri != XMLContentModel::gEOCFakeId) |
150 | + uri != XMLContentModel::gEOCFakeId) |
151 | { |
152 | // retrieve Grammar for the uri |
153 | const XMLCh* uriStr = getScanner()->getURIText(uri); |
154 | //std::cout << " xsv: fXsiType: " << zorba::StrX(localPart) << " @ " << zorba::StrX(uriStr) << "\n"; std::cout.flush(); |
155 | SchemaGrammar* sGrammar = (SchemaGrammar*) fGrammarResolver->getGrammar(uriStr); |
156 | - if (!sGrammar) |
157 | + if (!sGrammar) |
158 | { |
159 | |
160 | // Check built-in simple types |
161 | - if (XMLString::equals(uriStr, SchemaSymbols::fgURI_SCHEMAFORSCHEMA)) |
162 | + if (XMLString::equals(uriStr, SchemaSymbols::fgURI_SCHEMAFORSCHEMA)) |
163 | { |
164 | xsiTypeDV = fGrammarResolver->getDatatypeValidator(uriStr, localPart); |
165 | |
166 | - if (!xsiTypeDV) |
167 | + if (!xsiTypeDV) |
168 | { |
169 | emitError(XMLValid::BadXsiType, fXsiType->getRawName()); |
170 | fErrorOccurred = true; |
171 | } |
172 | - else |
173 | + else |
174 | { |
175 | if (elemTypeInfo || (fCurrentDatatypeValidator |
176 | - && !fCurrentDatatypeValidator->isSubstitutableBy(xsiTypeDV))) |
177 | + && !fCurrentDatatypeValidator->isSubstitutableBy(xsiTypeDV))) |
178 | { |
179 | // the type is not derived from ancestor |
180 | emitError(XMLValid::NonDerivedXsiType, fXsiType->getRawName(), elemDef->getFullName()); |
181 | fErrorOccurred = true; |
182 | } |
183 | - else |
184 | + else |
185 | { |
186 | // the type is derived from ancestor |
187 | - if (((SchemaElementDecl*)elemDef)->getBlockSet() == SchemaSymbols::XSD_RESTRICTION) |
188 | + if (((SchemaElementDecl*)elemDef)->getBlockSet() == SchemaSymbols::XSD_RESTRICTION) |
189 | { |
190 | emitError(XMLValid::NoSubforBlock, fXsiType->getRawName(), elemDef->getFullName()); |
191 | fErrorOccurred = true; |
192 | } |
193 | - if (elemDef->hasAttDefs()) |
194 | + if (elemDef->hasAttDefs()) |
195 | { |
196 | // if we have an attribute but xsi:type's type is simple, we have a problem... |
197 | emitError(XMLValid::NonDerivedXsiType, fXsiType->getRawName(), elemDef->getFullName()); |
198 | @@ -2798,28 +2808,28 @@ |
199 | fCurrentDatatypeValidator = xsiTypeDV; |
200 | } |
201 | } |
202 | - else |
203 | + else |
204 | { |
205 | // Grammar not found |
206 | emitError(XMLValid::GrammarNotFound, uriStr); |
207 | fErrorOccurred = true; |
208 | } |
209 | } |
210 | - else if (sGrammar->getGrammarType() != Grammar::SchemaGrammarType) |
211 | + else if (sGrammar->getGrammarType() != Grammar::SchemaGrammarType) |
212 | { |
213 | emitError(XMLValid::GrammarNotFound, uriStr); |
214 | fErrorOccurred = true; |
215 | } |
216 | - else |
217 | + else |
218 | { |
219 | // retrieve complexType registry and DatatypeValidator registry |
220 | RefHashTableOf<ComplexTypeInfo>* complexTypeRegistry = sGrammar->getComplexTypeRegistry(); |
221 | - if (!complexTypeRegistry) |
222 | + if (!complexTypeRegistry) |
223 | { |
224 | emitError(XMLValid::BadXsiType, fXsiType->getRawName()); |
225 | fErrorOccurred = true; |
226 | } |
227 | - else |
228 | + else |
229 | { |
230 | // retrieve the typeInfo specified in xsi:type |
231 | XMLBuffer aBuffer(1023, fMemoryManager); |
232 | @@ -2828,10 +2838,10 @@ |
233 | aBuffer.append(localPart); |
234 | ComplexTypeInfo* typeInfo = complexTypeRegistry->get(aBuffer.getRawBuffer()); |
235 | |
236 | - if (typeInfo) |
237 | + if (typeInfo) |
238 | { |
239 | // typeInfo is found |
240 | - if (typeInfo->getAbstract()) |
241 | + if (typeInfo->getAbstract()) |
242 | { |
243 | emitError(XMLValid::NoAbstractInXsiType, aBuffer.getRawBuffer()); |
244 | fErrorOccurred = true; |
245 | @@ -2841,22 +2851,22 @@ |
246 | if (elemTypeInfo) |
247 | { |
248 | ComplexTypeInfo* tempType = typeInfo; |
249 | - while (tempType) |
250 | + while (tempType) |
251 | { |
252 | if (tempType == elemTypeInfo) |
253 | break; |
254 | tempType = tempType->getBaseComplexTypeInfo(); |
255 | } |
256 | |
257 | - if (!tempType) |
258 | + if (!tempType) |
259 | { |
260 | emitError(XMLValid::NonDerivedXsiType, fXsiType->getRawName(), elemDef->getFullName()); |
261 | fErrorOccurred = true; |
262 | } |
263 | - else |
264 | + else |
265 | { |
266 | int derivationMethod = typeInfo->getDerivedBy(); |
267 | - if ((((SchemaElementDecl*)elemDef)->getBlockSet() & derivationMethod) != 0) |
268 | + if ((((SchemaElementDecl*)elemDef)->getBlockSet() & derivationMethod) != 0) |
269 | { |
270 | emitError(XMLValid::NoSubforBlock, fXsiType->getRawName(), elemDef->getFullName()); |
271 | fErrorOccurred = true; |
272 | @@ -2866,7 +2876,7 @@ |
273 | else |
274 | { |
275 | // if the original type is a simple type, check derivation ok. |
276 | - if (fCurrentDatatypeValidator && !fCurrentDatatypeValidator->isSubstitutableBy(typeInfo->getDatatypeValidator())) |
277 | + if (fCurrentDatatypeValidator && !fCurrentDatatypeValidator->isSubstitutableBy(typeInfo->getDatatypeValidator())) |
278 | { |
279 | // the type is not derived from ancestor |
280 | emitError(XMLValid::NonDerivedXsiType, fXsiType->getRawName(), elemDef->getFullName()); |
281 | @@ -2887,29 +2897,29 @@ |
282 | // typeInfo not found |
283 | xsiTypeDV = fGrammarResolver->getDatatypeValidator(uriStr, localPart); |
284 | |
285 | - if (!xsiTypeDV) |
286 | + if (!xsiTypeDV) |
287 | { |
288 | emitError(XMLValid::BadXsiType, fXsiType->getRawName()); |
289 | fErrorOccurred = true; |
290 | } |
291 | - else |
292 | + else |
293 | { |
294 | - if (fCurrentDatatypeValidator && !fCurrentDatatypeValidator->isSubstitutableBy(xsiTypeDV)) |
295 | + if (fCurrentDatatypeValidator && !fCurrentDatatypeValidator->isSubstitutableBy(xsiTypeDV)) |
296 | { |
297 | // the type is not derived from ancestor |
298 | emitError(XMLValid::NonDerivedXsiType, fXsiType->getRawName(), elemDef->getFullName()); |
299 | fErrorOccurred = true; |
300 | } |
301 | - else |
302 | + else |
303 | { |
304 | // the type is derived from ancestor |
305 | - if (((SchemaElementDecl*)elemDef)->getBlockSet() == SchemaSymbols::XSD_RESTRICTION) |
306 | + if (((SchemaElementDecl*)elemDef)->getBlockSet() == SchemaSymbols::XSD_RESTRICTION) |
307 | { |
308 | emitError(XMLValid::NoSubforBlock, fXsiType->getRawName(), elemDef->getFullName()); |
309 | fErrorOccurred = true; |
310 | } |
311 | - |
312 | - if (elemDef->hasAttDefs()) |
313 | + |
314 | + if (elemDef->hasAttDefs()) |
315 | { |
316 | // if we have an attribute but xsi:type's type is simple, we have a problem... |
317 | emitError(XMLValid::NonDerivedXsiType, fXsiType->getRawName(), elemDef->getFullName()); |
318 | @@ -2927,13 +2937,13 @@ |
319 | delete fXsiType; |
320 | fXsiType = 0; |
321 | } |
322 | - else |
323 | + else |
324 | { |
325 | // |
326 | // xsi:type was not specified... |
327 | // If the corresponding type is abstract, detect an error |
328 | // |
329 | - if (elemTypeInfo && elemTypeInfo->getAbstract()) |
330 | + if (elemTypeInfo && elemTypeInfo->getAbstract()) |
331 | { |
332 | emitError(XMLValid::NoUseAbstractType, elemDef->getFullName()); |
333 | fErrorOccurred = true; |
334 | @@ -2944,7 +2954,7 @@ |
335 | // Check whether this element is abstract. If so, an error |
336 | // |
337 | int miscFlags = ((SchemaElementDecl*)elemDef)->getMiscFlags(); |
338 | - if ((miscFlags & SchemaSymbols::XSD_ABSTRACT) != 0) |
339 | + if ((miscFlags & SchemaSymbols::XSD_ABSTRACT) != 0) |
340 | { |
341 | emitError(XMLValid::NoDirectUseAbstractElement, elemDef->getFullName()); |
342 | fErrorOccurred = true; |
343 | @@ -2953,7 +2963,7 @@ |
344 | // |
345 | // Check whether this element allows Nillable |
346 | // |
347 | - if (fNil && (miscFlags & SchemaSymbols::XSD_NILLABLE) == 0 ) |
348 | + if (fNil && (miscFlags & SchemaSymbols::XSD_NILLABLE) == 0 ) |
349 | { |
350 | fNil = false; |
351 | emitError(XMLValid::NillNotAllowed, elemDef->getFullName()); |
352 | @@ -2980,7 +2990,7 @@ |
353 | if (uri != XMLElementDecl::fgInvalidElemId && |
354 | uri != XMLElementDecl::fgPCDataElemId && |
355 | uri != XMLContentModel::gEpsilonFakeId && |
356 | - uri != XMLContentModel::gEOCFakeId) |
357 | + uri != XMLContentModel::gEOCFakeId) |
358 | { |
359 | // retrieve Grammar for the uri |
360 | const XMLCh* uriStr = getScanner()->getURIText(uri); |
361 | @@ -3035,10 +3045,10 @@ |
362 | aBuffer.append(localPart); |
363 | ComplexTypeInfo* typeInfo = complexTypeRegistry->get(aBuffer.getRawBuffer()); |
364 | |
365 | - if (typeInfo) |
366 | + if (typeInfo) |
367 | { |
368 | // typeInfo is found |
369 | - if (typeInfo->getAbstract()) |
370 | + if (typeInfo->getAbstract()) |
371 | { |
372 | emitError(XMLValid::NoAbstractInXsiType, aBuffer.getRawBuffer()); |
373 | fErrorOccurred = true; |
374 | @@ -3047,7 +3057,7 @@ |
375 | { |
376 | { |
377 | // if the original type is a simple type, check derivation ok. |
378 | - if (fCurrentDatatypeValidator && !fCurrentDatatypeValidator->isSubstitutableBy(typeInfo->getDatatypeValidator())) |
379 | + if (fCurrentDatatypeValidator && !fCurrentDatatypeValidator->isSubstitutableBy(typeInfo->getDatatypeValidator())) |
380 | { |
381 | // the type is not derived from ancestor |
382 | emitError(XMLValid::NonDerivedXsiType, fXsiType->getRawName(), elemDef->getFullName()); |
383 | @@ -3171,7 +3181,7 @@ |
384 | // 3) That for any notation types, that their lists |
385 | // of possible values refer to declared notations. |
386 | // |
387 | - if (curElem.hasAttDefs()) |
388 | + if (curElem.hasAttDefs()) |
389 | { |
390 | XMLAttDefList& attDefList = curElem.getAttDefList(); |
391 | bool seenId = false; |
392 | @@ -3260,7 +3270,7 @@ |
393 | } |
394 | |
395 | // For each complex type info, check the Unique Particle Attribution |
396 | - if (getScanner()->getValidationSchemaFullChecking()) |
397 | + if (getScanner()->getValidationSchemaFullChecking()) |
398 | { |
399 | RefHashTableOf<ComplexTypeInfo>* complexTypeRegistry = sGrammar.getComplexTypeRegistry(); |
400 | |
401 | @@ -3276,20 +3286,20 @@ |
402 | RefHashTableOf<XercesGroupInfo>* groupInfoRegistry = sGrammar.getGroupInfoRegistry(); |
403 | RefHashTableOfEnumerator<XercesGroupInfo> groupEnum(groupInfoRegistry, false, fMemoryManager); |
404 | |
405 | - while (groupEnum.hasMoreElements()) |
406 | + while (groupEnum.hasMoreElements()) |
407 | { |
408 | |
409 | XercesGroupInfo& curGroup = groupEnum.nextElement(); |
410 | XercesGroupInfo* baseGroup = curGroup.getBaseGroup(); |
411 | |
412 | - if (baseGroup) |
413 | + if (baseGroup) |
414 | { |
415 | - try |
416 | + try |
417 | { |
418 | checkParticleDerivationOk(&sGrammar, curGroup.getContentSpec(), curGroup.getScope(), |
419 | baseGroup->getContentSpec(), baseGroup->getScope()); |
420 | } |
421 | - catch (const XMLException& excep) |
422 | + catch (const XMLException& excep) |
423 | { |
424 | fSchemaErrorReporter.emitError(excep, curGroup.getLocator()); |
425 | } |
426 | @@ -3347,7 +3357,7 @@ |
427 | const XMLCh* srcPtr = value; |
428 | XMLReader* fCurReader = getReaderMgr()->getCurrentReader(); |
429 | |
430 | - if ((wsFacet==DatatypeValidator::COLLAPSE) && fTrailing) |
431 | + if ((wsFacet==DatatypeValidator::COLLAPSE) && fTrailing) |
432 | { |
433 | nextCh = *srcPtr; |
434 | if (!fCurReader->isWhitespace(nextCh)) |
435 | @@ -3408,19 +3418,19 @@ |
436 | // --------------------------------------------------------------------------- |
437 | void XercSchemaValidator::checkRefElementConsistency(SchemaGrammar* const currentGrammar, |
438 | const ComplexTypeInfo* const curTypeInfo, |
439 | - const XercesGroupInfo* const curGroup) |
440 | + const XercesGroupInfo* const curGroup) |
441 | { |
442 | |
443 | unsigned int elemCount = (curTypeInfo) ? curTypeInfo->elementCount() : curGroup->elementCount(); |
444 | int elemScope = (curTypeInfo) ? curTypeInfo->getScopeDefined() : curGroup->getScope(); |
445 | XSDLocator* typeInfoLocator = (curTypeInfo) ? curTypeInfo->getLocator() : curGroup->getLocator(); |
446 | |
447 | - for (unsigned int i=0; i < elemCount; i++) |
448 | + for (unsigned int i=0; i < elemCount; i++) |
449 | { |
450 | |
451 | const SchemaElementDecl* elemDecl = (curTypeInfo) ? curTypeInfo->elementAt(i) : curGroup->elementAt(i); |
452 | |
453 | - if (elemDecl->isGlobalDecl()) |
454 | + if (elemDecl->isGlobalDecl()) |
455 | { |
456 | |
457 | unsigned int elemURI = elemDecl->getURI(); |
458 | @@ -3430,23 +3440,23 @@ |
459 | |
460 | if (other |
461 | && (elemDecl->getComplexTypeInfo() != other->getComplexTypeInfo() || |
462 | - elemDecl->getDatatypeValidator() != other->getDatatypeValidator())) |
463 | + elemDecl->getDatatypeValidator() != other->getDatatypeValidator())) |
464 | { |
465 | fSchemaErrorReporter.emitError(XMLErrs::DuplicateElementDeclaration, |
466 | XMLUni::fgXMLErrDomain, typeInfoLocator, elemName, 0, 0, 0, fMemoryManager); |
467 | continue; |
468 | } |
469 | |
470 | - RefHash2KeysTableOf<ElemVector>* validSubsGroups = |
471 | + RefHash2KeysTableOf<ElemVector>* validSubsGroups = |
472 | currentGrammar->getValidSubstitutionGroups(); |
473 | - ValueVectorOf<SchemaElementDecl*>* subsElements = |
474 | + ValueVectorOf<SchemaElementDecl*>* subsElements = |
475 | validSubsGroups->get(elemName, elemURI); |
476 | |
477 | - if (subsElements) |
478 | + if (subsElements) |
479 | { |
480 | unsigned subsElemSize = subsElements->size(); |
481 | |
482 | - for (unsigned int j=0; j < subsElemSize; j++) |
483 | + for (unsigned int j=0; j < subsElemSize; j++) |
484 | { |
485 | SchemaElementDecl* subsElem = subsElements->elementAt(j); |
486 | const XMLCh* subsElemName = subsElem->getBaseName(); |
487 | @@ -3455,11 +3465,11 @@ |
488 | |
489 | if (other |
490 | && (subsElem->getComplexTypeInfo() != other->getComplexTypeInfo() |
491 | - || subsElem->getDatatypeValidator() != other->getDatatypeValidator())) |
492 | + || subsElem->getDatatypeValidator() != other->getDatatypeValidator())) |
493 | { |
494 | fSchemaErrorReporter.emitError(XMLErrs::DuplicateElementDeclaration, |
495 | - XMLUni::fgXMLErrDomain, |
496 | - typeInfoLocator, elemName, |
497 | + XMLUni::fgXMLErrDomain, |
498 | + typeInfoLocator, elemName, |
499 | 0, 0, 0, fMemoryManager); |
500 | } |
501 | } |
502 | @@ -3472,7 +3482,7 @@ |
503 | // XercSchemaValidator: Particle Derivation Checking |
504 | // --------------------------------------------------------------------------- |
505 | void XercSchemaValidator::checkParticleDerivation(SchemaGrammar* const currentGrammar, |
506 | - const ComplexTypeInfo* const curTypeInfo) |
507 | + const ComplexTypeInfo* const curTypeInfo) |
508 | { |
509 | ComplexTypeInfo* baseTypeInfo = 0; |
510 | ContentSpecNode* curSpecNode = 0; |
511 | @@ -3481,21 +3491,21 @@ |
512 | && ((baseTypeInfo = curTypeInfo->getBaseComplexTypeInfo()) != 0) |
513 | && ((curSpecNode = curTypeInfo->getContentSpec()) != 0)) { |
514 | |
515 | - try |
516 | + try |
517 | { |
518 | checkParticleDerivationOk(currentGrammar, curSpecNode, |
519 | curTypeInfo->getScopeDefined(), |
520 | baseTypeInfo->getContentSpec(), |
521 | baseTypeInfo->getScopeDefined(), baseTypeInfo); |
522 | } |
523 | - catch (const XMLException& excep) |
524 | + catch (const XMLException& excep) |
525 | { |
526 | fSchemaErrorReporter.emitError(excep, curTypeInfo->getLocator()); |
527 | } |
528 | } |
529 | } |
530 | |
531 | -ContentSpecNode* XercSchemaValidator::getNonUnaryGroup(ContentSpecNode* const pNode) |
532 | +ContentSpecNode* XercSchemaValidator::getNonUnaryGroup(ContentSpecNode* const pNode) |
533 | { |
534 | int pNodeType = (pNode->getType() & 0x0f); |
535 | if (pNodeType == ContentSpecNode::Leaf |
536 | @@ -3517,7 +3527,7 @@ |
537 | ContentSpecNode* const baseNode, |
538 | const int baseScope, |
539 | const ComplexTypeInfo* const baseInfo, |
540 | - const bool toCheckOccurence) |
541 | + const bool toCheckOccurence) |
542 | { |
543 | // Check for pointless occurrences of all, choice, sequence. The result is |
544 | // the contentspec which is not pointless. If the result is a non-pointless |
545 | @@ -3537,14 +3547,14 @@ |
546 | |
547 | if ((curNodeType & 0x0f) == ContentSpecNode::Sequence || |
548 | (curNodeType & 0x0f) == ContentSpecNode::Choice || |
549 | - curNodeType == ContentSpecNode::All) |
550 | + curNodeType == ContentSpecNode::All) |
551 | { |
552 | curSpecNode = checkForPointlessOccurrences(curSpecNode, curNodeType, &curVector); |
553 | } |
554 | |
555 | if ((baseNodeType & 0x0f) == ContentSpecNode::Sequence || |
556 | (baseNodeType & 0x0f) == ContentSpecNode::Choice || |
557 | - baseNodeType == ContentSpecNode::All) |
558 | + baseNodeType == ContentSpecNode::All) |
559 | { |
560 | baseSpecNode = checkForPointlessOccurrences(baseSpecNode, baseNodeType, &baseVector); |
561 | } |
562 | @@ -3552,15 +3562,15 @@ |
563 | curNodeType = curSpecNode->getType(); |
564 | baseNodeType = baseSpecNode->getType(); |
565 | |
566 | - switch (curNodeType & 0x0f) |
567 | + switch (curNodeType & 0x0f) |
568 | { |
569 | case ContentSpecNode::Leaf: |
570 | { |
571 | - switch (baseNodeType & 0x0f) |
572 | + switch (baseNodeType & 0x0f) |
573 | { |
574 | case ContentSpecNode::Leaf: |
575 | { |
576 | - checkNameAndTypeOK(aGrammar, curSpecNode, derivedScope, baseSpecNode, |
577 | + checkNameAndTypeOK(aGrammar, curSpecNode, derivedScope, baseSpecNode, |
578 | baseScope, baseInfo); |
579 | return; |
580 | } |
581 | @@ -3590,7 +3600,7 @@ |
582 | case ContentSpecNode::Any_Other: |
583 | case ContentSpecNode::Any_NS: |
584 | { |
585 | - switch (baseNodeType & 0x0f) |
586 | + switch (baseNodeType & 0x0f) |
587 | { |
588 | case ContentSpecNode::Any: |
589 | case ContentSpecNode::Any_Other: |
590 | @@ -3604,25 +3614,25 @@ |
591 | case ContentSpecNode::All: |
592 | case ContentSpecNode::Leaf: |
593 | { |
594 | - ThrowXMLwithMemMgr(RuntimeException, XMLExcepts::PD_ForbiddenRes1, |
595 | + ThrowXMLwithMemMgr(RuntimeException, XMLExcepts::PD_ForbiddenRes1, |
596 | fMemoryManager); |
597 | } |
598 | default: |
599 | { |
600 | - ThrowXMLwithMemMgr(RuntimeException, XMLExcepts::PD_InvalidContentType, |
601 | + ThrowXMLwithMemMgr(RuntimeException, XMLExcepts::PD_InvalidContentType, |
602 | fMemoryManager); |
603 | } |
604 | } |
605 | } |
606 | case ContentSpecNode::All: |
607 | { |
608 | - switch (baseNodeType & 0x0f) |
609 | + switch (baseNodeType & 0x0f) |
610 | { |
611 | case ContentSpecNode::Any: |
612 | case ContentSpecNode::Any_Other: |
613 | case ContentSpecNode::Any_NS: |
614 | { |
615 | - checkNSRecurseCheckCardinality(aGrammar, curSpecNode, &curVector, |
616 | + checkNSRecurseCheckCardinality(aGrammar, curSpecNode, &curVector, |
617 | derivedScope, baseSpecNode, toCheckOccurence); |
618 | return; |
619 | } |
620 | @@ -3636,19 +3646,19 @@ |
621 | case ContentSpecNode::Sequence: |
622 | case ContentSpecNode::Leaf: |
623 | { |
624 | - ThrowXMLwithMemMgr(RuntimeException, XMLExcepts::PD_ForbiddenRes2, |
625 | + ThrowXMLwithMemMgr(RuntimeException, XMLExcepts::PD_ForbiddenRes2, |
626 | fMemoryManager); |
627 | } |
628 | default: |
629 | { |
630 | - ThrowXMLwithMemMgr(RuntimeException, XMLExcepts::PD_InvalidContentType, |
631 | + ThrowXMLwithMemMgr(RuntimeException, XMLExcepts::PD_InvalidContentType, |
632 | fMemoryManager); |
633 | } |
634 | } |
635 | } |
636 | case ContentSpecNode::Choice: |
637 | { |
638 | - switch (baseNodeType & 0x0f) |
639 | + switch (baseNodeType & 0x0f) |
640 | { |
641 | case ContentSpecNode::Any: |
642 | case ContentSpecNode::Any_Other: |
643 | @@ -3677,7 +3687,7 @@ |
644 | } |
645 | case ContentSpecNode::Sequence: |
646 | { |
647 | - switch (baseNodeType & 0x0f) |
648 | + switch (baseNodeType & 0x0f) |
649 | { |
650 | case ContentSpecNode::Any: |
651 | case ContentSpecNode::Any_Other: |
652 | @@ -3720,17 +3730,17 @@ |
653 | ContentSpecNode* |
654 | XercSchemaValidator::checkForPointlessOccurrences(ContentSpecNode* const specNode, |
655 | const ContentSpecNode::NodeTypes nodeType, |
656 | - ValueVectorOf<ContentSpecNode*>* const nodes) |
657 | + ValueVectorOf<ContentSpecNode*>* const nodes) |
658 | { |
659 | ContentSpecNode* rightNode = specNode->getSecond(); |
660 | int min = specNode->getMinOccurs(); |
661 | int max = specNode->getMaxOccurs(); |
662 | |
663 | - if (!rightNode) |
664 | + if (!rightNode) |
665 | { |
666 | gatherChildren(nodeType, specNode->getFirst(), nodes); |
667 | |
668 | - if (nodes->size() == 1 && min == 1 && max == 1) |
669 | + if (nodes->size() == 1 && min == 1 && max == 1) |
670 | { |
671 | return nodes->elementAt(0); |
672 | } |
673 | @@ -3746,9 +3756,9 @@ |
674 | |
675 | void XercSchemaValidator::gatherChildren(const ContentSpecNode::NodeTypes parentNodeType, |
676 | ContentSpecNode* const specNode, |
677 | - ValueVectorOf<ContentSpecNode*>* const nodes) |
678 | + ValueVectorOf<ContentSpecNode*>* const nodes) |
679 | { |
680 | - if (!specNode) |
681 | + if (!specNode) |
682 | { |
683 | return; |
684 | } |
685 | @@ -3761,25 +3771,25 @@ |
686 | if (nodeType == ContentSpecNode::Leaf || |
687 | (nodeType & 0x0f) == ContentSpecNode::Any || |
688 | (nodeType & 0x0f) == ContentSpecNode::Any_NS || |
689 | - (nodeType & 0x0f) == ContentSpecNode::Any_Other) |
690 | - { |
691 | - nodes->addElement(specNode); |
692 | - } |
693 | - else if (min !=1 || max != 1) |
694 | - { |
695 | - nodes->addElement(specNode); |
696 | - } |
697 | - else if (!rightNode) |
698 | + (nodeType & 0x0f) == ContentSpecNode::Any_Other) |
699 | + { |
700 | + nodes->addElement(specNode); |
701 | + } |
702 | + else if (min !=1 || max != 1) |
703 | + { |
704 | + nodes->addElement(specNode); |
705 | + } |
706 | + else if (!rightNode) |
707 | { |
708 | gatherChildren(nodeType, specNode->getFirst(), nodes); |
709 | } |
710 | - else if ((parentNodeType & 0x0f) == (nodeType & 0x0f)) |
711 | + else if ((parentNodeType & 0x0f) == (nodeType & 0x0f)) |
712 | { |
713 | |
714 | gatherChildren(nodeType, specNode->getFirst(), nodes); |
715 | gatherChildren(nodeType, rightNode, nodes); |
716 | } |
717 | - else |
718 | + else |
719 | { |
720 | nodes->addElement(specNode); |
721 | } |
722 | @@ -3788,19 +3798,19 @@ |
723 | void |
724 | XercSchemaValidator::checkNSCompat(const ContentSpecNode* const derivedSpecNode, |
725 | const ContentSpecNode* const baseSpecNode, |
726 | - const bool toCheckOccurence) |
727 | + const bool toCheckOccurence) |
728 | { |
729 | // check Occurrence ranges |
730 | if (toCheckOccurence && |
731 | !isOccurrenceRangeOK(derivedSpecNode->getMinOccurs(), derivedSpecNode->getMaxOccurs(), |
732 | - baseSpecNode->getMinOccurs(), baseSpecNode->getMaxOccurs())) |
733 | + baseSpecNode->getMinOccurs(), baseSpecNode->getMaxOccurs())) |
734 | { |
735 | ThrowXMLwithMemMgr1(RuntimeException, XMLExcepts::PD_OccurRangeE, |
736 | derivedSpecNode->getElement()->getLocalPart(), fMemoryManager); |
737 | } |
738 | |
739 | // check wildcard subset |
740 | - if (!wildcardEltAllowsNamespace(baseSpecNode, derivedSpecNode->getElement()->getURI())) |
741 | + if (!wildcardEltAllowsNamespace(baseSpecNode, derivedSpecNode->getElement()->getURI())) |
742 | { |
743 | ThrowXMLwithMemMgr1(RuntimeException, XMLExcepts::PD_NSCompat1, |
744 | derivedSpecNode->getElement()->getLocalPart(), fMemoryManager); |
745 | @@ -3809,27 +3819,27 @@ |
746 | |
747 | bool |
748 | XercSchemaValidator::wildcardEltAllowsNamespace(const ContentSpecNode* const baseSpecNode, |
749 | - const unsigned int derivedURI) |
750 | + const unsigned int derivedURI) |
751 | { |
752 | ContentSpecNode::NodeTypes nodeType = baseSpecNode->getType(); |
753 | |
754 | - if ((nodeType & 0x0f) == ContentSpecNode::Any) |
755 | + if ((nodeType & 0x0f) == ContentSpecNode::Any) |
756 | { |
757 | return true; |
758 | } |
759 | |
760 | unsigned int baseURI = baseSpecNode->getElement()->getURI(); |
761 | |
762 | - if ((nodeType & 0x0f) == ContentSpecNode::Any_NS) |
763 | + if ((nodeType & 0x0f) == ContentSpecNode::Any_NS) |
764 | { |
765 | - if (derivedURI == baseURI) |
766 | + if (derivedURI == baseURI) |
767 | { |
768 | return true; |
769 | } |
770 | } |
771 | - else |
772 | + else |
773 | { // must be ANY_OTHER |
774 | - if (derivedURI != baseURI && derivedURI != getScanner()->getEmptyNamespaceId()) |
775 | + if (derivedURI != baseURI && derivedURI != getScanner()->getEmptyNamespaceId()) |
776 | { |
777 | return true; |
778 | } |
779 | @@ -3844,7 +3854,7 @@ |
780 | const int derivedScope, |
781 | const ContentSpecNode* const baseSpecNode, |
782 | const int baseScope, |
783 | - const ComplexTypeInfo* const baseInfo) |
784 | + const ComplexTypeInfo* const baseInfo) |
785 | { |
786 | |
787 | if (derivedSpecNode->getMaxOccurs() == 0) |
788 | @@ -3853,7 +3863,7 @@ |
789 | unsigned int derivedURI = derivedSpecNode->getElement()->getURI(); |
790 | |
791 | // case of mixed complex types with attributes only |
792 | - if (derivedURI == XMLElementDecl::fgPCDataElemId) |
793 | + if (derivedURI == XMLElementDecl::fgPCDataElemId) |
794 | { |
795 | return; |
796 | } |
797 | @@ -3861,12 +3871,12 @@ |
798 | SchemaGrammar* aGrammar = currentGrammar; |
799 | const XMLCh* schemaURI = fGrammarResolver->getStringPool()->getValueForId(derivedURI); |
800 | |
801 | - if (derivedURI != getScanner()->getEmptyNamespaceId()) |
802 | + if (derivedURI != getScanner()->getEmptyNamespaceId()) |
803 | { |
804 | aGrammar= (SchemaGrammar*) fGrammarResolver->getGrammar(schemaURI); |
805 | } |
806 | |
807 | - if (!aGrammar) |
808 | + if (!aGrammar) |
809 | { //something is wrong |
810 | return; |
811 | } |
812 | @@ -3875,29 +3885,29 @@ |
813 | |
814 | SchemaElementDecl* derivedElemDecl = findElement(derivedScope, derivedURI, derivedName, aGrammar); |
815 | |
816 | - if (!derivedElemDecl) |
817 | + if (!derivedElemDecl) |
818 | { |
819 | return; |
820 | } |
821 | |
822 | - const XMLCh* baseName = baseSpecNode->getElement()->getLocalPart(); |
823 | - unsigned int baseURI = baseSpecNode->getElement()->getURI(); |
824 | + const XMLCh* baseName = baseSpecNode->getElement()->getLocalPart(); |
825 | + unsigned int baseURI = baseSpecNode->getElement()->getURI(); |
826 | bool subsGroup = false; |
827 | |
828 | - if (!XMLString::equals(derivedName, baseName) || derivedURI != baseURI) |
829 | + if (!XMLString::equals(derivedName, baseName) || derivedURI != baseURI) |
830 | { |
831 | // Check if derived is substitutable for base. |
832 | // |
833 | SchemaElementDecl* e = derivedElemDecl->getSubstitutionGroupElem (); |
834 | |
835 | for (; e != 0; e = e->getSubstitutionGroupElem ()) { |
836 | - if (XMLString::equals(e->getBaseName (), baseName) && e->getURI () == baseURI) |
837 | + if (XMLString::equals(e->getBaseName (), baseName) && e->getURI () == baseURI) |
838 | { |
839 | break; |
840 | } |
841 | } |
842 | |
843 | - if (e == 0) |
844 | + if (e == 0) |
845 | { |
846 | ThrowXMLwithMemMgr(RuntimeException, XMLExcepts::PD_NameTypeOK1, fMemoryManager); |
847 | } |
848 | @@ -3906,7 +3916,7 @@ |
849 | } |
850 | |
851 | if (!isOccurrenceRangeOK(derivedSpecNode->getMinOccurs(), derivedSpecNode->getMaxOccurs(), |
852 | - baseSpecNode->getMinOccurs(), baseSpecNode->getMaxOccurs())) |
853 | + baseSpecNode->getMinOccurs(), baseSpecNode->getMaxOccurs())) |
854 | { |
855 | ThrowXMLwithMemMgr1(RuntimeException, XMLExcepts::PD_OccurRangeE, derivedName, fMemoryManager); |
856 | } |
857 | @@ -3914,7 +3924,7 @@ |
858 | SchemaElementDecl* baseElemDecl = |
859 | findElement(baseScope, baseURI, baseName, aGrammar, baseInfo); |
860 | |
861 | - if (!baseElemDecl) |
862 | + if (!baseElemDecl) |
863 | { |
864 | return; |
865 | } |
866 | @@ -3923,7 +3933,7 @@ |
867 | int baseFlags = baseElemDecl->getMiscFlags(); |
868 | |
869 | if (((baseFlags & SchemaSymbols::XSD_NILLABLE) == 0) && |
870 | - ((derivedFlags & SchemaSymbols::XSD_NILLABLE) != 0)) |
871 | + ((derivedFlags & SchemaSymbols::XSD_NILLABLE) != 0)) |
872 | { |
873 | ThrowXMLwithMemMgr1(RuntimeException, XMLExcepts::PD_NameTypeOK2, derivedName, fMemoryManager); |
874 | } |
875 | @@ -3933,7 +3943,7 @@ |
876 | |
877 | if (baseDefVal && (baseFlags & SchemaSymbols::XSD_FIXED) != 0 && |
878 | ((derivedFlags & SchemaSymbols::XSD_FIXED) == 0 || |
879 | - !XMLString::equals(derivedDefVal, baseDefVal))) |
880 | + !XMLString::equals(derivedDefVal, baseDefVal))) |
881 | { |
882 | ThrowXMLwithMemMgr1(RuntimeException, XMLExcepts::PD_NameTypeOK3, derivedName, fMemoryManager); |
883 | } |
884 | @@ -3941,7 +3951,7 @@ |
885 | int derivedBlockSet = derivedElemDecl->getBlockSet(); |
886 | int baseBlockSet = baseElemDecl->getBlockSet(); |
887 | |
888 | - if ((derivedBlockSet & baseBlockSet) != baseBlockSet) |
889 | + if ((derivedBlockSet & baseBlockSet) != baseBlockSet) |
890 | { |
891 | ThrowXMLwithMemMgr1(RuntimeException, XMLExcepts::PD_NameTypeOK4, derivedName, fMemoryManager); |
892 | } |
893 | @@ -3958,13 +3968,13 @@ |
894 | XercSchemaValidator::findElement(const int scope, const unsigned int uriIndex, |
895 | const XMLCh* const name, |
896 | SchemaGrammar* const grammar, |
897 | - const ComplexTypeInfo* const typeInfo) |
898 | + const ComplexTypeInfo* const typeInfo) |
899 | { |
900 | // check for element at given scope first |
901 | SchemaElementDecl* elemDecl = (SchemaElementDecl*) grammar->getElemDecl(uriIndex, name, 0, scope); |
902 | |
903 | // if not found, check at global scope |
904 | - if (!elemDecl) |
905 | + if (!elemDecl) |
906 | { |
907 | elemDecl = (SchemaElementDecl*) |
908 | grammar->getElemDecl(uriIndex, name, 0, Grammar::TOP_LEVEL_SCOPE); |
909 | @@ -3974,12 +3984,12 @@ |
910 | |
911 | const ComplexTypeInfo* baseInfo = typeInfo; |
912 | |
913 | - while (baseInfo) |
914 | + while (baseInfo) |
915 | { |
916 | elemDecl = (SchemaElementDecl*) |
917 | grammar->getElemDecl(uriIndex, name, 0, baseInfo->getScopeDefined()); |
918 | |
919 | - if (elemDecl) |
920 | + if (elemDecl) |
921 | { |
922 | break; |
923 | } |
924 | @@ -3996,32 +4006,32 @@ |
925 | XercSchemaValidator::checkICRestriction(const SchemaElementDecl* const derivedElemDecl, |
926 | const SchemaElementDecl* const baseElemDecl, |
927 | const XMLCh* const derivedElemName, |
928 | - const XMLCh* const baseElemName) |
929 | + const XMLCh* const baseElemName) |
930 | { |
931 | // REVIST - need to get more clarification |
932 | unsigned int derivedICCount = derivedElemDecl->getIdentityConstraintCount(); |
933 | unsigned int baseICCount = baseElemDecl->getIdentityConstraintCount(); |
934 | |
935 | - if (derivedICCount > baseICCount) |
936 | + if (derivedICCount > baseICCount) |
937 | { |
938 | ThrowXMLwithMemMgr2(RuntimeException, XMLExcepts::PD_NameTypeOK6, derivedElemName, baseElemName, fMemoryManager); |
939 | } |
940 | |
941 | - for (unsigned int i=0; i < derivedICCount; i++) |
942 | + for (unsigned int i=0; i < derivedICCount; i++) |
943 | { |
944 | bool found = false; |
945 | IdentityConstraint* ic= derivedElemDecl->getIdentityConstraintAt(i); |
946 | |
947 | - for (unsigned int j=0; j < baseICCount; j++) |
948 | + for (unsigned int j=0; j < baseICCount; j++) |
949 | { |
950 | - if (*ic == *(baseElemDecl->getIdentityConstraintAt(j))) |
951 | + if (*ic == *(baseElemDecl->getIdentityConstraintAt(j))) |
952 | { |
953 | found = true; |
954 | break; |
955 | } |
956 | } |
957 | |
958 | - if (!found) |
959 | + if (!found) |
960 | { |
961 | ThrowXMLwithMemMgr2(RuntimeException, XMLExcepts::PD_NameTypeOK7, derivedElemName, baseElemName, fMemoryManager); |
962 | } |
963 | @@ -4031,11 +4041,11 @@ |
964 | void |
965 | XercSchemaValidator::checkTypesOK(const SchemaElementDecl* const derivedElemDecl, |
966 | const SchemaElementDecl* const baseElemDecl, |
967 | - const XMLCh* const derivedElemName) |
968 | + const XMLCh* const derivedElemName) |
969 | { |
970 | SchemaElementDecl::ModelTypes baseType = baseElemDecl->getModelType(); |
971 | |
972 | - if (baseType == SchemaElementDecl::Any) |
973 | + if (baseType == SchemaElementDecl::Any) |
974 | { |
975 | return; |
976 | } |
977 | @@ -4043,19 +4053,19 @@ |
978 | ComplexTypeInfo* rInfo = derivedElemDecl->getComplexTypeInfo(); |
979 | ComplexTypeInfo* bInfo = baseElemDecl->getComplexTypeInfo(); |
980 | |
981 | - if (derivedElemDecl->getModelType() == SchemaElementDecl::Simple) |
982 | + if (derivedElemDecl->getModelType() == SchemaElementDecl::Simple) |
983 | { |
984 | - if (baseType != SchemaElementDecl::Simple) |
985 | + if (baseType != SchemaElementDecl::Simple) |
986 | { |
987 | ThrowXMLwithMemMgr1(RuntimeException, XMLExcepts::PD_NameTypeOK5, derivedElemName, fMemoryManager); |
988 | } |
989 | |
990 | - if (!rInfo) |
991 | + if (!rInfo) |
992 | { |
993 | DatatypeValidator* bDV = baseElemDecl->getDatatypeValidator(); |
994 | |
995 | if (bInfo || bDV == 0 || |
996 | - !bDV->isSubstitutableBy(derivedElemDecl->getDatatypeValidator())) |
997 | + !bDV->isSubstitutableBy(derivedElemDecl->getDatatypeValidator())) |
998 | { |
999 | ThrowXMLwithMemMgr1(RuntimeException, XMLExcepts::PD_NameTypeOK5, derivedElemName, fMemoryManager); |
1000 | } |
1001 | @@ -4067,16 +4077,16 @@ |
1002 | if (rInfo == bInfo) |
1003 | return; |
1004 | |
1005 | - for (; rInfo && rInfo != bInfo; rInfo = rInfo->getBaseComplexTypeInfo()) |
1006 | + for (; rInfo && rInfo != bInfo; rInfo = rInfo->getBaseComplexTypeInfo()) |
1007 | { |
1008 | - if (rInfo->getDerivedBy() != SchemaSymbols::XSD_RESTRICTION) |
1009 | + if (rInfo->getDerivedBy() != SchemaSymbols::XSD_RESTRICTION) |
1010 | { |
1011 | rInfo = 0; |
1012 | break; |
1013 | } |
1014 | } |
1015 | |
1016 | - if (!rInfo) |
1017 | + if (!rInfo) |
1018 | { |
1019 | ThrowXMLwithMemMgr1(RuntimeException, XMLExcepts::PD_NameTypeOK5, derivedElemName, fMemoryManager); |
1020 | } |
1021 | @@ -4089,7 +4099,7 @@ |
1022 | const ContentSpecNode* const baseSpecNode, |
1023 | const int baseScope, |
1024 | ValueVectorOf<ContentSpecNode*>* const baseNodes, |
1025 | - const ComplexTypeInfo* const baseInfo) |
1026 | + const ComplexTypeInfo* const baseInfo) |
1027 | { |
1028 | ContentSpecNode::NodeTypes baseType = baseSpecNode->getType(); |
1029 | bool toLax = false; |
1030 | @@ -4098,7 +4108,7 @@ |
1031 | ContentSpecNode derivedGroupNode(baseType, derivedSpecNodeIn, 0, false, true, fMemoryManager); |
1032 | const ContentSpecNode* const derivedSpecNode = &derivedGroupNode; |
1033 | |
1034 | - if ((baseSpecNode->getType() & 0x0f) == ContentSpecNode::Choice) |
1035 | + if ((baseSpecNode->getType() & 0x0f) == ContentSpecNode::Choice) |
1036 | { |
1037 | toLax = true; |
1038 | } |
1039 | @@ -4108,7 +4118,7 @@ |
1040 | // baseSpecNode, baseScope, baseNodes, baseInfo, toLax); |
1041 | |
1042 | if (!isOccurrenceRangeOK(derivedSpecNode->getMinOccurs(), derivedSpecNode->getMaxOccurs(), |
1043 | - baseSpecNode->getMinOccurs(), baseSpecNode->getMaxOccurs())) |
1044 | + baseSpecNode->getMinOccurs(), baseSpecNode->getMaxOccurs())) |
1045 | { |
1046 | ThrowXMLwithMemMgr(RuntimeException, XMLExcepts::PD_Recurse1, fMemoryManager); |
1047 | } |
1048 | @@ -4121,22 +4131,22 @@ |
1049 | { |
1050 | bool matched = false; |
1051 | |
1052 | - for (unsigned int j = current; j < count2; j++) |
1053 | + for (unsigned int j = current; j < count2; j++) |
1054 | { |
1055 | ContentSpecNode* baseNode = baseNodes->elementAt(j); |
1056 | current++; |
1057 | |
1058 | bool bDoBreak=false; // workaround for Borland bug with 'break' in 'catch' |
1059 | - try |
1060 | + try |
1061 | { |
1062 | checkParticleDerivationOk(currentGrammar, derivedSpecNodeIn, |
1063 | derivedScope, baseNode, baseScope, baseInfo); |
1064 | matched = true; |
1065 | break; |
1066 | } |
1067 | - catch(const XMLException&) |
1068 | + catch(const XMLException&) |
1069 | { |
1070 | - if (!toLax && baseNode->getMinTotalRange()) |
1071 | + if (!toLax && baseNode->getMinTotalRange()) |
1072 | { |
1073 | bDoBreak=true; |
1074 | } |
1075 | @@ -4147,7 +4157,7 @@ |
1076 | } |
1077 | |
1078 | // did not find a match |
1079 | - if (!matched) |
1080 | + if (!matched) |
1081 | { |
1082 | codeToThrow = XMLExcepts::PD_Recurse2; |
1083 | } |
1084 | @@ -4157,11 +4167,11 @@ |
1085 | // in case of Sequence or All |
1086 | if (!toLax && codeToThrow == XMLExcepts::NoError && |
1087 | (true || (baseType & 0x0f) == ContentSpecNode::All || |
1088 | - derivedSpecNodeIn->getElement()->getURI() != XMLElementDecl::fgPCDataElemId)) |
1089 | + derivedSpecNodeIn->getElement()->getURI() != XMLElementDecl::fgPCDataElemId)) |
1090 | { |
1091 | - for (unsigned int j = current; j < count2; j++) |
1092 | + for (unsigned int j = current; j < count2; j++) |
1093 | { |
1094 | - if (baseNodes->elementAt(j)->getMinTotalRange() * baseSpecNode->getMinOccurs()) |
1095 | + if (baseNodes->elementAt(j)->getMinTotalRange() * baseSpecNode->getMinOccurs()) |
1096 | { //!emptiable |
1097 | codeToThrow = XMLExcepts::PD_Recurse2; |
1098 | break; |
1099 | @@ -4169,7 +4179,7 @@ |
1100 | } |
1101 | } |
1102 | |
1103 | - if (codeToThrow != XMLExcepts::NoError) |
1104 | + if (codeToThrow != XMLExcepts::NoError) |
1105 | { |
1106 | ThrowXMLwithMemMgr(RuntimeException, codeToThrow, fMemoryManager); |
1107 | } |
1108 | @@ -4184,10 +4194,10 @@ |
1109 | const int baseScope, |
1110 | ValueVectorOf<ContentSpecNode*>* const baseNodes, |
1111 | const ComplexTypeInfo* const baseInfo, |
1112 | - const bool toLax) |
1113 | + const bool toLax) |
1114 | { |
1115 | if (!isOccurrenceRangeOK(derivedSpecNode->getMinOccurs(), derivedSpecNode->getMaxOccurs(), |
1116 | - baseSpecNode->getMinOccurs(), baseSpecNode->getMaxOccurs())) |
1117 | + baseSpecNode->getMinOccurs(), baseSpecNode->getMaxOccurs())) |
1118 | { |
1119 | ThrowXMLwithMemMgr(RuntimeException, XMLExcepts::PD_Recurse1, fMemoryManager); |
1120 | } |
1121 | @@ -4198,17 +4208,17 @@ |
1122 | unsigned int count2= baseNodes->size(); |
1123 | unsigned int current = 0; |
1124 | |
1125 | - for (unsigned int i=0; i<count1; i++) |
1126 | + for (unsigned int i=0; i<count1; i++) |
1127 | { |
1128 | bool matched = false; |
1129 | |
1130 | - for (unsigned int j = current; j < count2; j++) |
1131 | + for (unsigned int j = current; j < count2; j++) |
1132 | { |
1133 | ContentSpecNode* baseNode = baseNodes->elementAt(j); |
1134 | current++; |
1135 | |
1136 | bool bDoBreak=false; // workaround for Borland bug with 'break' in 'catch' |
1137 | - try |
1138 | + try |
1139 | { |
1140 | |
1141 | checkParticleDerivationOk(currentGrammar, derivedNodes->elementAt(i), |
1142 | @@ -4216,9 +4226,9 @@ |
1143 | matched = true; |
1144 | break; |
1145 | } |
1146 | - catch(const XMLException&) |
1147 | + catch(const XMLException&) |
1148 | { |
1149 | - if (!toLax && baseNode->getMinTotalRange()) |
1150 | + if (!toLax && baseNode->getMinTotalRange()) |
1151 | { |
1152 | bDoBreak=true; |
1153 | } |
1154 | @@ -4229,7 +4239,7 @@ |
1155 | } |
1156 | |
1157 | // did not find a match |
1158 | - if (!matched) |
1159 | + if (!matched) |
1160 | { |
1161 | codeToThrow = XMLExcepts::PD_Recurse2; |
1162 | break; |
1163 | @@ -4238,11 +4248,11 @@ |
1164 | |
1165 | // Now, see if there are some elements in the base we didn't match up |
1166 | // in case of Sequence or All |
1167 | - if (!toLax && codeToThrow == XMLExcepts::NoError) |
1168 | + if (!toLax && codeToThrow == XMLExcepts::NoError) |
1169 | { |
1170 | - for (unsigned int j = current; j < count2; j++) |
1171 | + for (unsigned int j = current; j < count2; j++) |
1172 | { |
1173 | - if (baseNodes->elementAt(j)->getMinTotalRange()) |
1174 | + if (baseNodes->elementAt(j)->getMinTotalRange()) |
1175 | { //!emptiable |
1176 | codeToThrow = XMLExcepts::PD_Recurse2; |
1177 | break; |
1178 | @@ -4250,23 +4260,23 @@ |
1179 | } |
1180 | } |
1181 | |
1182 | - if (codeToThrow != XMLExcepts::NoError) |
1183 | + if (codeToThrow != XMLExcepts::NoError) |
1184 | { |
1185 | ThrowXMLwithMemMgr(RuntimeException, codeToThrow, fMemoryManager); |
1186 | } |
1187 | } |
1188 | |
1189 | void XercSchemaValidator::checkNSSubset(const ContentSpecNode* const derivedSpecNode, |
1190 | - const ContentSpecNode* const baseSpecNode) |
1191 | + const ContentSpecNode* const baseSpecNode) |
1192 | { |
1193 | // check Occurrence ranges |
1194 | if (!isOccurrenceRangeOK(derivedSpecNode->getMinOccurs(), derivedSpecNode->getMaxOccurs(), |
1195 | - baseSpecNode->getMinOccurs(), baseSpecNode->getMaxOccurs())) |
1196 | + baseSpecNode->getMinOccurs(), baseSpecNode->getMaxOccurs())) |
1197 | { |
1198 | ThrowXMLwithMemMgr(RuntimeException, XMLExcepts::PD_NSSubset1, fMemoryManager); |
1199 | } |
1200 | |
1201 | - if (!isWildCardEltSubset(derivedSpecNode, baseSpecNode)) |
1202 | + if (!isWildCardEltSubset(derivedSpecNode, baseSpecNode)) |
1203 | { |
1204 | ThrowXMLwithMemMgr(RuntimeException, XMLExcepts::PD_NSSubset2, fMemoryManager); |
1205 | } |
1206 | @@ -4392,7 +4402,7 @@ |
1207 | // didn't find a match. |
1208 | if (!matched) { |
1209 | |
1210 | - codeToThrow = XMLExcepts::PD_RecurseUnordered; |
1211 | + codeToThrow = XMLExcepts::PD_RecurseUnordered; |
1212 | break; |
1213 | } |
1214 | } |
1215 | @@ -4402,7 +4412,7 @@ |
1216 | for (unsigned int j=0; j < baseCount; j++) { |
1217 | if (!foundIt[j] && baseNodes->elementAt(j)->getMinTotalRange()) { |
1218 | |
1219 | - codeToThrow = XMLExcepts::PD_RecurseUnordered; |
1220 | + codeToThrow = XMLExcepts::PD_RecurseUnordered; |
1221 | break; |
1222 | } |
1223 | } |
1224 | @@ -4458,7 +4468,7 @@ |
1225 | |
1226 | // didn't find a match. |
1227 | if (!matched) { |
1228 | - ThrowXMLwithMemMgr(RuntimeException, XMLExcepts::PD_MapAndSum, fMemoryManager); |
1229 | + ThrowXMLwithMemMgr(RuntimeException, XMLExcepts::PD_MapAndSum, fMemoryManager); |
1230 | } |
1231 | } |
1232 |
Validation queue starting for merge proposal. zorbatest. lambda. nu:8080/ remotequeue/ bug1073964- valInternalErro r-2012- 11-28T07- 20-44.355Z/ log.html
Log at: http://