Merge lp:~zorba-coders/zorba/bug1023362-xsiTypeIgnored into lp:zorba

Proposed by Cezar Andrei
Status: Merged
Approved by: Cezar Andrei
Approved revision: 11202
Merged at revision: 11228
Proposed branch: lp:~zorba-coders/zorba/bug1023362-xsiTypeIgnored
Merge into: lp:zorba
Diff against target: 485 lines (+84/-47)
7 files modified
ChangeLog (+1/-0)
src/types/schema/EventSchemaValidator.cpp (+13/-13)
src/types/schema/SchemaValidatorFilter.cpp (+24/-17)
src/types/schema/XercSchemaValidator.cpp (+9/-1)
src/types/schema/XercSchemaValidator.h (+17/-16)
test/rbkt/ExpQueryResults/zorba/schemas/val-laxXsiType.xml.res (+2/-0)
test/rbkt/Queries/zorba/schemas/val-laxXsiType.xq (+18/-0)
To merge this branch: bzr merge lp:~zorba-coders/zorba/bug1023362-xsiTypeIgnored
Reviewer Review Type Date Requested Status
Matthias Brantner Approve
Markos Zaharioudakis Approve
Cezar Andrei Approve
Review via email: mp+146224@code.launchpad.net

Commit message

Fix for bug1023362-xsi:Type Ignored during lax validation.

Description of the change

Fix for bug1023362-xsi:Type Ignored during lax validation.

To post a comment you must log in.
Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote :
Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote :

Validation queue job bug1023362-xsiTypeIgnored-2013-02-01T20-56-35.809Z is finished. The final status was:

All tests succeeded!

Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote :

Voting does not meet specified criteria. Required: Approve > 1, Disapprove < 1, Needs Fixing < 1, Pending < 1. Got: 1 Pending.

Revision history for this message
Cezar Andrei (cezar-andrei) :
review: Approve
Revision history for this message
Matthias Brantner (matthias-brantner) wrote :

Markos has opened a bug. Hence, I have added him as a reviewer.

At least, the ChangeLog should be updated.

review: Needs Fixing
Revision history for this message
Markos Zaharioudakis (markos-za) :
review: Approve
Revision history for this message
Cezar Andrei (cezar-andrei) wrote :

Added entry in ChangeLog.

Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote :

Attempt to merge into lp:zorba failed due to conflicts:

text conflict in ChangeLog

Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote :

There are additional revisions which have not been approved in review. Please seek review and approval of these new revisions.

11201. By Cezar Andrei <email address hidden>

Merge from trunk, fixed ChangeLog conflict.

11202. By Cezar Andrei <email address hidden>

Merge from trunk, fixed the conflict in ChangeLog once again.

Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote :
Revision history for this message
Matthias Brantner (matthias-brantner) :
review: Approve
Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote :

Validation queue job bug1023362-xsiTypeIgnored-2013-02-08T23-11-43.386Z is finished. The final status was:

All tests succeeded!

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'ChangeLog'
--- ChangeLog 2013-02-08 22:14:56 +0000
+++ ChangeLog 2013-02-08 23:12:24 +0000
@@ -24,6 +24,7 @@
24 * Fixed bug #1099535 (xml:parse endless loop)24 * Fixed bug #1099535 (xml:parse endless loop)
25 * Fixed bug #866958 (Parsing error not explicit enough)25 * Fixed bug #866958 (Parsing error not explicit enough)
26 * Fixed bug #867068: (Incorrect usage of XQDY0027)26 * Fixed bug #867068: (Incorrect usage of XQDY0027)
27 * Fixed bug #1023362 (xsi:type attribute ignored during validation)
2728
2829
29version 2.830version 2.8
3031
=== modified file 'src/types/schema/EventSchemaValidator.cpp'
--- src/types/schema/EventSchemaValidator.cpp 2012-09-19 21:16:15 +0000
+++ src/types/schema/EventSchemaValidator.cpp 2013-02-08 23:12:24 +0000
@@ -94,7 +94,7 @@
9494
95void EventSchemaValidator::startElem(store::Item_t elemName)95void EventSchemaValidator::startElem(store::Item_t elemName)
96{96{
97 //cout << " sv SElem: " << elemName->getLocalName() << "\n";97 //cout << "\n esv SElem: " << elemName->getLocalName() << "\n"; std::cout.flush();
9898
99 XMLChArray prefix(elemName->getPrefix());99 XMLChArray prefix(elemName->getPrefix());
100 XMLChArray uri(elemName->getNamespace());100 XMLChArray uri(elemName->getNamespace());
@@ -105,7 +105,7 @@
105105
106void EventSchemaValidator::endElem(store::Item_t elemName)106void EventSchemaValidator::endElem(store::Item_t elemName)
107{107{
108 //cout << " sv EElem: " << elemName->getLocalName() << "\n";108 //cout << " esv EElem: " << elemName->getLocalName() << "\n"; std::cout.flush();
109109
110 XMLChArray prefix(elemName->getPrefix());110 XMLChArray prefix(elemName->getPrefix());
111 XMLChArray uri(elemName->getNamespace());111 XMLChArray uri(elemName->getNamespace());
@@ -118,8 +118,8 @@
118118
119void EventSchemaValidator::attr(store::Item_t attrName, const zstring& textValue)119void EventSchemaValidator::attr(store::Item_t attrName, const zstring& textValue)
120{120{
121 //cout << " sv Attr: " << attrName->getPrefix() << ":"121 //cout << " esv Attr: " << attrName->getPrefix() << ":"
122 // << attrName->getLocalName() << " = '" << textValue << "'\n";122 // << attrName->getLocalName() << " = '" << textValue << "'\n"; std::cout.flush();
123123
124 XMLChArray prefix(attrName->getPrefix());124 XMLChArray prefix(attrName->getPrefix());
125 XMLChArray uri(attrName->getNamespace());125 XMLChArray uri(attrName->getNamespace());
@@ -133,14 +133,14 @@
133133
134void EventSchemaValidator::endAttrs()134void EventSchemaValidator::endAttrs()
135{135{
136 //cout << " sv endAttrs \n";136 //cout << " esv endAttrs \n"; std::cout.flush();
137 theSchemaValidatorFilter->endAttributesEvent();137 theSchemaValidatorFilter->endAttributesEvent();
138}138}
139139
140140
141void EventSchemaValidator::text(const zstring& textValue)141void EventSchemaValidator::text(const zstring& textValue)
142{142{
143 //cout << " sv Text: '" << textValue << "'\n";143 //cout << " esv Text: '" << textValue << "'\n"; std::cout.flush();
144144
145 XMLChArray value(textValue);145 XMLChArray value(textValue);
146 theSchemaValidatorFilter->textEvent(value);146 theSchemaValidatorFilter->textEvent(value);
@@ -163,7 +163,7 @@
163 StrX typeName(theSchemaValidatorFilter->getTypeName());163 StrX typeName(theSchemaValidatorFilter->getTypeName());
164 StrX typeUri(theSchemaValidatorFilter->getTypeUri());164 StrX typeUri(theSchemaValidatorFilter->getTypeUri());
165165
166 //cout << " - getTypeQName: " << typeName << " @ " << typeUri <<" ";166 //cout << " esv - : getTypeQName: " << typeName << " @ " << typeUri <<"\n"; std::cout.flush();
167167
168 store::Item_t typeQName;168 store::Item_t typeQName;
169 GENV_ITEMFACTORY->createQName(typeQName,169 GENV_ITEMFACTORY->createQName(typeQName,
@@ -171,8 +171,8 @@
171 "",171 "",
172 typeName.localFormOrDefault ("untyped"));172 typeName.localFormOrDefault ("untyped"));
173173
174 //cout << " : " << typeQName->getLocalName() << " @ "174 //cout << " " << typeQName->getLocalName() << " @ "
175 // << typeQName->getNamespace() <<"\n"; std::cout.flush();175 // << typeQName->getNamespace() <<"\n"; std::cout.flush(); std::cout.flush();
176176
177 return typeQName;177 return typeQName;
178}178}
@@ -183,7 +183,7 @@
183 StrX typeName(theSchemaValidatorFilter->getTypeName());183 StrX typeName(theSchemaValidatorFilter->getTypeName());
184 StrX typeUri(theSchemaValidatorFilter->getTypeUri());184 StrX typeUri(theSchemaValidatorFilter->getTypeUri());
185185
186 //cout << " - getType: " << typeName << "@" << typeUri <<"\n";186 //cout << " esv - : getType: " << typeName << "@" << typeUri <<"\n"; std::cout.flush();
187187
188 store::Item_t typeQName;188 store::Item_t typeQName;
189 GENV_ITEMFACTORY->createQName(typeQName,189 GENV_ITEMFACTORY->createQName(typeQName,
@@ -191,7 +191,7 @@
191 "",191 "",
192 typeName.localFormOrDefault ("untyped"));192 typeName.localFormOrDefault ("untyped"));
193193
194 xqtref_t type = theTypeManager->create_named_type(typeQName, 194 xqtref_t type = theTypeManager->create_named_type(typeQName,
195 TypeConstants::QUANT_ONE,195 TypeConstants::QUANT_ONE,
196 QueryLoc::null);196 QueryLoc::null);
197 return type;197 return type;
@@ -229,7 +229,7 @@
229 XMLChArray localname(typeQName->getLocalName());229 XMLChArray localname(typeQName->getLocalName());
230230
231 //cout << " SType: " << typeQName->getLocalName() << " @ "231 //cout << " SType: " << typeQName->getLocalName() << " @ "
232 // << typeQName->getNamespace() << "\n";232 // << typeQName->getNamespace() << "\n"; std::cout.flush();
233233
234 theSchemaValidatorFilter->startTypeEvent(uri, localname);234 theSchemaValidatorFilter->startTypeEvent(uri, localname);
235}235}
@@ -237,7 +237,7 @@
237237
238void EventSchemaValidator::endType()238void EventSchemaValidator::endType()
239{239{
240 //cout << " EType \n";240 //cout << " EType \n"; std::cout.flush();
241241
242 theSchemaValidatorFilter->endTypeEvent();242 theSchemaValidatorFilter->endTypeEvent();
243}243}
244244
=== modified file 'src/types/schema/SchemaValidatorFilter.cpp'
--- src/types/schema/SchemaValidatorFilter.cpp 2013-01-25 22:32:28 +0000
+++ src/types/schema/SchemaValidatorFilter.cpp 2013-02-08 23:12:24 +0000
@@ -200,7 +200,7 @@
200 const XMLCh *uri,200 const XMLCh *uri,
201 const XMLCh *localname)201 const XMLCh *localname)
202{202{
203 //cout << " svf startElememntEvent: " << StrX(localname) << " @ " << StrX(uri) << "\n";203 //cout << " svf startElememntEvent: " << StrX(localname) << " @ " << StrX(uri) << "\n";
204 if(theElementToProcess)204 if(theElementToProcess)
205 processStartElement();205 processStartElement();
206206
@@ -229,12 +229,14 @@
229229
230void SchemaValidatorFilter::processStartElement()230void SchemaValidatorFilter::processStartElement()
231{231{
232 //std::cout << " svf - : processStartElement " << StrX(theLocalname.getRawBuffer()) << " v: " << fValidate << "\n"; std::cout.flush();
232 bool isRoot = theParentStack == 0;233 bool isRoot = theParentStack == 0;
233 unsigned int uriId = fURIStringPool->addOrFind(theUri.getRawBuffer());234 unsigned int uriId = fURIStringPool->addOrFind(theUri.getRawBuffer());
234235
235 // Handle xsi:type236 if (theXsiType)
236 if( theXsiType )
237 {237 {
238 // Handle xsi:type
239 //std::cout << " svf - : procStartElemEvent2 xsi: " << StrX(theXsiType) << " v: " << fValidate << "\n"; std::cout.flush();
238 int colonPos = -1;240 int colonPos = -1;
239 unsigned int atUriId = resolveQName(theXsiType,241 unsigned int atUriId = resolveQName(theXsiType,
240 fPrefixBuf,242 fPrefixBuf,
@@ -247,7 +249,6 @@
247 }249 }
248250
249 bool isProcessorStipulatedTypeName = false;251 bool isProcessorStipulatedTypeName = false;
250
251 if( theProcessorStipulatedTypeName && isRoot )252 if( theProcessorStipulatedTypeName && isRoot )
252 {253 {
253 isProcessorStipulatedTypeName = true;254 isProcessorStipulatedTypeName = true;
@@ -334,7 +335,7 @@
334 getSubstitutionGroupElem();335 getSubstitutionGroupElem();
335 if (substitutedElem)336 if (substitutedElem)
336 {337 {
337 //cout << " svf substitutedElem: " <<338 //cout << " svf substitutedElem: " <<
338 // StrX(substitutedElem->getFullName()) << "\n";339 // StrX(substitutedElem->getFullName()) << "\n";
339 theSubstitutedElemName = substitutedElem->getBaseName();340 theSubstitutedElemName = substitutedElem->getBaseName();
340 theSubstitutedElemUri = (XMLCh*)fURIStringPool->341 theSubstitutedElemUri = (XMLCh*)fURIStringPool->
@@ -342,7 +343,6 @@
342 }343 }
343 }344 }
344345
345
346 if(fValidate)346 if(fValidate)
347 {347 {
348 if (isProcessorStipulatedTypeName)348 if (isProcessorStipulatedTypeName)
@@ -355,11 +355,17 @@
355 fValidator->validateElement(elemDecl);355 fValidator->validateElement(elemDecl);
356 }356 }
357 }357 }
358 else if (theXsiType)
359 {
360 //validate element even if lax but has xsi:type
361 fValidator->validateElement(elemDecl);
362 }
363
358364
359 ComplexTypeInfo* typeinfo =365 ComplexTypeInfo* typeinfo =
360 (fValidate ?366 (fValidate ?
361 ((XercSchemaValidator*)fValidator)->getCurrentTypeInfo() :367 ((XercSchemaValidator*)fValidator)->getCurrentTypeInfo() :
362 ((SchemaElementDecl*)elemDecl)->getComplexTypeInfo());368 ((SchemaElementDecl*)elemDecl)->getComplexTypeInfo());
363369
364 if(typeinfo)370 if(typeinfo)
365 {371 {
@@ -452,7 +458,7 @@
452 unsigned int uriId = attr->getURIId();458 unsigned int uriId = attr->getURIId();
453 const XMLCh *uri = getURIText(uriId);459 const XMLCh *uri = getURIText(uriId);
454460
455 //cout << " svf: processAttrs: " << StrX(localname) << "@" << StrX(uri) <<461 //cout << " svf: processAttrs: " << StrX(localname) << "@" << StrX(uri) <<
456 // " ='" << StrX(value) << "'" << endl;462 // " ='" << StrX(value) << "'" << endl;
457463
458 bool attrValid = true;464 bool attrValid = true;
@@ -714,8 +720,8 @@
714 if(theElementToProcess)720 if(theElementToProcess)
715 processStartElement();721 processStartElement();
716722
717 //cout << " svf: endElementEvent: " << StrX(localname) << "@" << StrX(uri) <<723// std::cout << " svf: endElementEvent1: " << StrX(localname) << "@" << StrX(uri) <<
718 // " type: " << StrX(typeName) << " @" << StrX(typeURI) << endl;724// " type: " << StrX(typeName) << " @" << StrX(typeURI) << " v: " << fValidate << std::endl;
719725
720 typeURI = SchemaSymbols::fgURI_SCHEMAFORSCHEMA;726 typeURI = SchemaSymbols::fgURI_SCHEMAFORSCHEMA;
721 typeName = SchemaSymbols::fgATTVAL_ANYTYPE;727 typeName = SchemaSymbols::fgATTVAL_ANYTYPE;
@@ -726,7 +732,7 @@
726 // We commandeer fCommentOrPISeen to keep _errorOccurred in732 // We commandeer fCommentOrPISeen to keep _errorOccurred in
727 theErrorOccurred = topElem->fCommentOrPISeen;733 theErrorOccurred = topElem->fCommentOrPISeen;
728734
729 if(fValidate)735 if(fValidate || theXsiType)
730 {736 {
731 DatatypeValidator *currentDV = 0;737 DatatypeValidator *currentDV = 0;
732 if(topElem->fThisElement->isDeclared())738 if(topElem->fThisElement->isDeclared())
@@ -867,7 +873,7 @@
867 }873 }
868 --theAttrCount; // remove att from the list but still needs to be reported874 --theAttrCount; // remove att from the list but still needs to be reported
869875
870 //std::cout << " svf attrEvent: " << StrX(localname) << " T: " <<876 //std::cout << " svf attrEvent: " << StrX(localname) << " T: " <<
871 // StrX(typeName) << "\n";877 // StrX(typeName) << "\n";
872 theEventBuffer->attributeEvent(emptyToNull(prefix), emptyToNull(uri),878 theEventBuffer->attributeEvent(emptyToNull(prefix), emptyToNull(uri),
873 localname, value, emptyToNull(typeURI), typeName);879 localname, value, emptyToNull(typeURI), typeName);
@@ -898,7 +904,8 @@
898 while(*end) ++end;904 while(*end) ++end;
899 unsigned int len = (unsigned int)(end - chars);905 unsigned int len = (unsigned int)(end - chars);
900906
901 if(fValidate)907 // Also handle xsi:type
908 if(fValidate || theXsiType)
902 {909 {
903 // Get the character data opts for the current element910 // Get the character data opts for the current element
904 XMLElementDecl::CharDataOpts charOpts = XMLElementDecl::AllCharData;911 XMLElementDecl::CharDataOpts charOpts = XMLElementDecl::AllCharData;
@@ -1011,7 +1018,7 @@
10111018
1012 const XMLCh *typeURI = NULL;1019 const XMLCh *typeURI = NULL;
10131020
1014 if(fValidate)1021 if(fValidate || theXsiType)
1015 {1022 {
1016 if (theProcessorStipulatedTypeName && theParentStack == 0)1023 if (theProcessorStipulatedTypeName && theParentStack == 0)
1017 {1024 {
@@ -1051,7 +1058,7 @@
10511058
1052 const XMLCh *typeName = NULL;1059 const XMLCh *typeName = NULL;
10531060
1054 if(fValidate)1061 if(fValidate || theXsiType)
1055 {1062 {
1056 //cout << " - getTypeQName: theElemDepth:" << theElemDepth << "\n";1063 //cout << " - getTypeQName: theElemDepth:" << theElemDepth << "\n";
1057 if (theProcessorStipulatedTypeName && theElemDepth == 0 )1064 if (theProcessorStipulatedTypeName && theElemDepth == 0 )
@@ -1582,7 +1589,7 @@
1582 }1589 }
1583 }1590 }
15841591
1585 //std::cout << "SchemaValidatorFilter::error " << XMLString::transcode(exc_msg.getRawBuffer()) << std::endl;1592 //std::cout << "SchemaValidatorFilter::error " << XMLString::transcode(exc_msg.getRawBuffer()) << std::endl; std::cout.flush();
1586 throw XQUERY_EXCEPTION(1593 throw XQUERY_EXCEPTION(
1587 err::XQDY0027,1594 err::XQDY0027,
1588 ERROR_PARAMS( StrX(exc_msg.getRawBuffer()).localForm() ),1595 ERROR_PARAMS( StrX(exc_msg.getRawBuffer()).localForm() ),
15891596
=== modified file 'src/types/schema/XercSchemaValidator.cpp'
--- src/types/schema/XercSchemaValidator.cpp 2012-11-26 23:23:13 +0000
+++ src/types/schema/XercSchemaValidator.cpp 2013-02-08 23:12:24 +0000
@@ -91,6 +91,7 @@
91{91{
92 fTrailingSeenNonWhiteSpace.flags = 0;92 fTrailingSeenNonWhiteSpace.flags = 0;
93 fTypeStack = new (fMemoryManager) ValueStackOf<ComplexTypeInfo*>(8, fMemoryManager);93 fTypeStack = new (fMemoryManager) ValueStackOf<ComplexTypeInfo*>(8, fMemoryManager);
94 //std::cout << " xsv - : constructor \n"; std::cout.flush();
94}95}
9596
96XercSchemaValidator::~XercSchemaValidator()97XercSchemaValidator::~XercSchemaValidator()
@@ -129,6 +130,7 @@
129 }130 }
130131
131 ComplexTypeInfo* currType = fTypeStack->pop();132 ComplexTypeInfo* currType = fTypeStack->pop();
133 //std::cout << " xsv - : checkcontent pop \n"; std::cout.flush();
132134
133 const SchemaElementDecl::ModelTypes modelType = (currType)135 const SchemaElementDecl::ModelTypes modelType = (currType)
134 ? (SchemaElementDecl::ModelTypes)(currType->getContentType())136 ? (SchemaElementDecl::ModelTypes)(currType->getContentType())
@@ -370,6 +372,8 @@
370 fTrailingSeenNonWhiteSpace.flags = 0;372 fTrailingSeenNonWhiteSpace.flags = 0;
371 fSeenId = false;373 fSeenId = false;
372 fTypeStack->removeAllElements();374 fTypeStack->removeAllElements();
375 //std::cout << " xsv - : reset \n"; std::cout.flush();
376
373 delete fXsiType;377 delete fXsiType;
374 fXsiType = 0;378 fXsiType = 0;
375 fCurrentDatatypeValidator = 0;379 fCurrentDatatypeValidator = 0;
@@ -560,6 +564,7 @@
560{564{
561 ComplexTypeInfo* elemTypeInfo = ((SchemaElementDecl*)elemDef)->getComplexTypeInfo();565 ComplexTypeInfo* elemTypeInfo = ((SchemaElementDecl*)elemDef)->getComplexTypeInfo();
562 fTypeStack->push(elemTypeInfo);566 fTypeStack->push(elemTypeInfo);
567 //std::cout << " xsv - : valElem1 push eti " << (elemTypeInfo ? StrX(elemTypeInfo->getTypeLocalName()).localForm() : "_") << "\n"; std::cout.flush();
563 fCurrentDatatypeValidator = (elemTypeInfo)568 fCurrentDatatypeValidator = (elemTypeInfo)
564 ? elemTypeInfo->getDatatypeValidator()569 ? elemTypeInfo->getDatatypeValidator()
565 : ((SchemaElementDecl*)elemDef)->getDatatypeValidator();570 : ((SchemaElementDecl*)elemDef)->getDatatypeValidator();
@@ -580,7 +585,7 @@
580585
581 // retrieve Grammar for the uri586 // retrieve Grammar for the uri
582 const XMLCh* uriStr = getScanner()->getURIText(uri);587 const XMLCh* uriStr = getScanner()->getURIText(uri);
583 //std::cout << " xsv: fXsiType: " << zorba::StrX(localPart) << " @ " << zorba::StrX(uriStr) << "\n"; std::cout.flush();588 //std::cout << " xsv - : valElem2 fXsiType: " << zorba::StrX(localPart) << " @ " << zorba::StrX(uriStr) << "\n"; std::cout.flush();
584 SchemaGrammar* sGrammar = (SchemaGrammar*) fGrammarResolver->getGrammar(uriStr);589 SchemaGrammar* sGrammar = (SchemaGrammar*) fGrammarResolver->getGrammar(uriStr);
585 if (!sGrammar) {590 if (!sGrammar) {
586591
@@ -691,7 +696,9 @@
691 if (!fErrorOccurred)696 if (!fErrorOccurred)
692 {697 {
693 fTypeStack->pop();698 fTypeStack->pop();
699 //std::cout << " xsv - : valElem2 pop \n"; std::cout.flush();
694 fTypeStack->push(typeInfo);700 fTypeStack->push(typeInfo);
701 //std::cout << " xsv - : valElem3 push " << (typeInfo ? StrX(typeInfo->getTypeLocalName()).localForm() : "_") << "\n"; std::cout.flush();
695 fCurrentDatatypeValidator = typeInfo->getDatatypeValidator();702 fCurrentDatatypeValidator = typeInfo->getDatatypeValidator();
696 }703 }
697 }704 }
@@ -863,6 +870,7 @@
863 {870 {
864 fTypeStack->push(typeInfo);871 fTypeStack->push(typeInfo);
865 fCurrentDatatypeValidator = typeInfo->getDatatypeValidator();872 fCurrentDatatypeValidator = typeInfo->getDatatypeValidator();
873 //std::cout << " xsv - : valElem4 push " << (typeInfo ? StrX(typeInfo->getTypeLocalName()).localForm() : "_") << "\n"; std::cout.flush();
866 }874 }
867 }875 }
868 }876 }
869877
=== modified file 'src/types/schema/XercSchemaValidator.h'
--- src/types/schema/XercSchemaValidator.h 2012-09-19 21:16:15 +0000
+++ src/types/schema/XercSchemaValidator.h 2013-02-08 23:12:24 +0000
@@ -1,12 +1,12 @@
1/*1/*
2 * Copyright 2006-2008 The FLWOR Foundation.2 * Copyright 2006-2008 The FLWOR Foundation.
3 * 3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at6 * You may obtain a copy of the License at
7 * 7 *
8 * http://www.apache.org/licenses/LICENSE-2.08 * http://www.apache.org/licenses/LICENSE-2.0
9 * 9 *
10 * Unless required by applicable law or agreed to in writing, software10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -114,7 +114,7 @@
114 DatatypeValidator* fCurrentDatatypeValidator;114 DatatypeValidator* fCurrentDatatypeValidator;
115 XMLBuffer* fNotationBuf;115 XMLBuffer* fNotationBuf;
116 XMLBuffer fDatatypeBuffer;116 XMLBuffer fDatatypeBuffer;
117 117
118#if _XERCES_VERSION >= 30000118#if _XERCES_VERSION >= 30000
119 // Only for 3.0.1.119 // Only for 3.0.1.
120 //120 //
@@ -158,7 +158,7 @@
158 XMLElementDecl* const elemDecl,158 XMLElementDecl* const elemDecl,
159 XERCES_CPP_NAMESPACE::QName** const children,159 XERCES_CPP_NAMESPACE::QName** const children,
160 const unsigned int childCount);160 const unsigned int childCount);
161#endif 161#endif
162162
163 virtual void faultInAttr(163 virtual void faultInAttr(
164 XMLAttr& toFill,164 XMLAttr& toFill,
@@ -194,7 +194,7 @@
194 // Virtual DTD handler interface.194 // Virtual DTD handler interface.
195 // -----------------------------------------------------------------------195 // -----------------------------------------------------------------------
196 virtual bool handlesDTD() const;196 virtual bool handlesDTD() const;
197 197
198 // -----------------------------------------------------------------------198 // -----------------------------------------------------------------------
199 // Virtual Schema handler interface. handlesSchema() always return false.199 // Virtual Schema handler interface. handlesSchema() always return false.
200 // -----------------------------------------------------------------------200 // -----------------------------------------------------------------------
@@ -394,12 +394,12 @@
394394
395 ContentSpecNode* getNonUnaryGroup(ContentSpecNode* const pNode);395 ContentSpecNode* getNonUnaryGroup(ContentSpecNode* const pNode);
396};396};
397 397
398 398
399// ---------------------------------------------------------------------------399// ---------------------------------------------------------------------------
400// XercSchemaValidator: Setter methods400// XercSchemaValidator: Setter methods
401// ---------------------------------------------------------------------------401// ---------------------------------------------------------------------------
402inline void XercSchemaValidator::setGrammarResolver(GrammarResolver* grammarResolver) 402inline void XercSchemaValidator::setGrammarResolver(GrammarResolver* grammarResolver)
403{403{
404 fGrammarResolver = grammarResolver;404 fGrammarResolver = grammarResolver;
405}405}
@@ -413,16 +413,17 @@
413 delete fXsiType;413 delete fXsiType;
414 fXsiType = new (fMemoryManager)414 fXsiType = new (fMemoryManager)
415 XERCES_CPP_NAMESPACE::QName(prefix, localPart, uriId, fMemoryManager);415 XERCES_CPP_NAMESPACE::QName(prefix, localPart, uriId, fMemoryManager);
416 //std::cout << " xsv::setXsiType " << StrX(prefix) << ":" << StrX(localPart) << " " << uriId << "\n"; std::cout.flush();
416}417}
417418
418419
419inline void XercSchemaValidator::setNillable(bool isNil) 420inline void XercSchemaValidator::setNillable(bool isNil)
420{421{
421 fNil = isNil;422 fNil = isNil;
422}423}
423424
424425
425inline void XercSchemaValidator::setExitOnFirstFatal(const bool newValue) 426inline void XercSchemaValidator::setExitOnFirstFatal(const bool newValue)
426{427{
427 fSchemaErrorReporter.setExitOnFirstFatal(newValue);428 fSchemaErrorReporter.setExitOnFirstFatal(newValue);
428}429}
@@ -443,7 +444,7 @@
443// ---------------------------------------------------------------------------444// ---------------------------------------------------------------------------
444// XercSchemaValidator: Getter methods445// XercSchemaValidator: Getter methods
445// ---------------------------------------------------------------------------446// ---------------------------------------------------------------------------
446inline ComplexTypeInfo* XercSchemaValidator::getCurrentTypeInfo() const 447inline ComplexTypeInfo* XercSchemaValidator::getCurrentTypeInfo() const
447{448{
448 if (fTypeStack->empty())449 if (fTypeStack->empty())
449 return 0;450 return 0;
@@ -467,19 +468,19 @@
467// ---------------------------------------------------------------------------468// ---------------------------------------------------------------------------
468// Virtual interface469// Virtual interface
469// ---------------------------------------------------------------------------470// ---------------------------------------------------------------------------
470inline Grammar* XercSchemaValidator::getGrammar() const 471inline Grammar* XercSchemaValidator::getGrammar() const
471{472{
472 return fSchemaGrammar;473 return fSchemaGrammar;
473}474}
474475
475476
476inline void XercSchemaValidator::setGrammar(Grammar* aGrammar) 477inline void XercSchemaValidator::setGrammar(Grammar* aGrammar)
477{478{
478 fSchemaGrammar = (SchemaGrammar*) aGrammar;479 fSchemaGrammar = (SchemaGrammar*) aGrammar;
479}480}
480481
481482
482inline void XercSchemaValidator::setErrorReporter(XMLErrorReporter* const errorReporter) 483inline void XercSchemaValidator::setErrorReporter(XMLErrorReporter* const errorReporter)
483{484{
484 XMLValidator::setErrorReporter(errorReporter);485 XMLValidator::setErrorReporter(errorReporter);
485 fSchemaErrorReporter.setErrorReporter(errorReporter);486 fSchemaErrorReporter.setErrorReporter(errorReporter);
@@ -512,7 +513,7 @@
512 const int min1,513 const int min1,
513 const int max1,514 const int max1,
514 const int min2,515 const int min2,
515 const int max2) 516 const int max2)
516{517{
517 if (min1 >= min2 &&518 if (min1 >= min2 &&
518 (max2 == SchemaSymbols::XSD_UNBOUNDED ||519 (max2 == SchemaSymbols::XSD_UNBOUNDED ||
519520
=== added file 'test/rbkt/ExpQueryResults/zorba/schemas/val-laxXsiType.xml.res'
--- test/rbkt/ExpQueryResults/zorba/schemas/val-laxXsiType.xml.res 1970-01-01 00:00:00 +0000
+++ test/rbkt/ExpQueryResults/zorba/schemas/val-laxXsiType.xml.res 2013-02-08 23:12:24 +0000
@@ -0,0 +1,2 @@
1<?xml version="1.0" encoding="UTF-8"?>
2xs:long xs:integer xs:untypedAtomic
03
=== added file 'test/rbkt/Queries/zorba/schemas/val-laxXsiType.xq'
--- test/rbkt/Queries/zorba/schemas/val-laxXsiType.xq 1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/schemas/val-laxXsiType.xq 2013-02-08 23:12:24 +0000
@@ -0,0 +1,18 @@
1import module namespace schema = "http://www.zorba-xquery.com/modules/schema";
2
3declare variable $doc :=
4<numbers xmlns:xs="http://www.w3.org/2001/XMLSchema"
5 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
6<xs_long xsi:type="xs:long">1</xs_long>
7<xs_long xsi:type="xs:integer">2</xs_long>
8<xs_long>3</xs_long>
9</numbers>
10;
11
12declare variable $vdoc := validate lax { $doc };
13
14(
15schema:schema-type(fn:data(($vdoc//xs_long)[1])),
16schema:schema-type(fn:data(($vdoc//xs_long)[2])),
17schema:schema-type(fn:data(($vdoc//xs_long)[3]))
18)

Subscribers

People subscribed via source and target branches