Merge lp:~zorba-coders/zorba/bug1023362-xsiTypeIgnored into lp:zorba
- bug1023362-xsiTypeIgnored
- Merge into trunk
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 | ||||
Related bugs: |
|
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.
Zorba Build Bot (zorba-buildbot) wrote : | # |
Zorba Build Bot (zorba-buildbot) wrote : | # |
Validation queue job bug1023362-xsiTypeIgnored
All tests succeeded!
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.
Cezar Andrei (cezar-andrei) : | # |
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.
Markos Zaharioudakis (markos-za) : | # |
Cezar Andrei (cezar-andrei) wrote : | # |
Added entry in ChangeLog.
Zorba Build Bot (zorba-buildbot) wrote : | # |
Attempt to merge into lp:zorba failed due to conflicts:
text conflict in ChangeLog
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.
Zorba Build Bot (zorba-buildbot) wrote : | # |
Validation queue starting for merge proposal.
Log at: http://
Matthias Brantner (matthias-brantner) : | # |
Zorba Build Bot (zorba-buildbot) wrote : | # |
Validation queue job bug1023362-xsiTypeIgnored
All tests succeeded!
Preview Diff
1 | === modified file 'ChangeLog' | |||
2 | --- ChangeLog 2013-02-08 22:14:56 +0000 | |||
3 | +++ ChangeLog 2013-02-08 23:12:24 +0000 | |||
4 | @@ -24,6 +24,7 @@ | |||
5 | 24 | * Fixed bug #1099535 (xml:parse endless loop) | 24 | * Fixed bug #1099535 (xml:parse endless loop) |
6 | 25 | * Fixed bug #866958 (Parsing error not explicit enough) | 25 | * Fixed bug #866958 (Parsing error not explicit enough) |
7 | 26 | * Fixed bug #867068: (Incorrect usage of XQDY0027) | 26 | * Fixed bug #867068: (Incorrect usage of XQDY0027) |
8 | 27 | * Fixed bug #1023362 (xsi:type attribute ignored during validation) | ||
9 | 27 | 28 | ||
10 | 28 | 29 | ||
11 | 29 | version 2.8 | 30 | version 2.8 |
12 | 30 | 31 | ||
13 | === modified file 'src/types/schema/EventSchemaValidator.cpp' | |||
14 | --- src/types/schema/EventSchemaValidator.cpp 2012-09-19 21:16:15 +0000 | |||
15 | +++ src/types/schema/EventSchemaValidator.cpp 2013-02-08 23:12:24 +0000 | |||
16 | @@ -94,7 +94,7 @@ | |||
17 | 94 | 94 | ||
18 | 95 | void EventSchemaValidator::startElem(store::Item_t elemName) | 95 | void EventSchemaValidator::startElem(store::Item_t elemName) |
19 | 96 | { | 96 | { |
21 | 97 | //cout << " sv SElem: " << elemName->getLocalName() << "\n"; | 97 | //cout << "\n esv SElem: " << elemName->getLocalName() << "\n"; std::cout.flush(); |
22 | 98 | 98 | ||
23 | 99 | XMLChArray prefix(elemName->getPrefix()); | 99 | XMLChArray prefix(elemName->getPrefix()); |
24 | 100 | XMLChArray uri(elemName->getNamespace()); | 100 | XMLChArray uri(elemName->getNamespace()); |
25 | @@ -105,7 +105,7 @@ | |||
26 | 105 | 105 | ||
27 | 106 | void EventSchemaValidator::endElem(store::Item_t elemName) | 106 | void EventSchemaValidator::endElem(store::Item_t elemName) |
28 | 107 | { | 107 | { |
30 | 108 | //cout << " sv EElem: " << elemName->getLocalName() << "\n"; | 108 | //cout << " esv EElem: " << elemName->getLocalName() << "\n"; std::cout.flush(); |
31 | 109 | 109 | ||
32 | 110 | XMLChArray prefix(elemName->getPrefix()); | 110 | XMLChArray prefix(elemName->getPrefix()); |
33 | 111 | XMLChArray uri(elemName->getNamespace()); | 111 | XMLChArray uri(elemName->getNamespace()); |
34 | @@ -118,8 +118,8 @@ | |||
35 | 118 | 118 | ||
36 | 119 | void EventSchemaValidator::attr(store::Item_t attrName, const zstring& textValue) | 119 | void EventSchemaValidator::attr(store::Item_t attrName, const zstring& textValue) |
37 | 120 | { | 120 | { |
40 | 121 | //cout << " sv Attr: " << attrName->getPrefix() << ":" | 121 | //cout << " esv Attr: " << attrName->getPrefix() << ":" |
41 | 122 | // << attrName->getLocalName() << " = '" << textValue << "'\n"; | 122 | // << attrName->getLocalName() << " = '" << textValue << "'\n"; std::cout.flush(); |
42 | 123 | 123 | ||
43 | 124 | XMLChArray prefix(attrName->getPrefix()); | 124 | XMLChArray prefix(attrName->getPrefix()); |
44 | 125 | XMLChArray uri(attrName->getNamespace()); | 125 | XMLChArray uri(attrName->getNamespace()); |
45 | @@ -133,14 +133,14 @@ | |||
46 | 133 | 133 | ||
47 | 134 | void EventSchemaValidator::endAttrs() | 134 | void EventSchemaValidator::endAttrs() |
48 | 135 | { | 135 | { |
50 | 136 | //cout << " sv endAttrs \n"; | 136 | //cout << " esv endAttrs \n"; std::cout.flush(); |
51 | 137 | theSchemaValidatorFilter->endAttributesEvent(); | 137 | theSchemaValidatorFilter->endAttributesEvent(); |
52 | 138 | } | 138 | } |
53 | 139 | 139 | ||
54 | 140 | 140 | ||
55 | 141 | void EventSchemaValidator::text(const zstring& textValue) | 141 | void EventSchemaValidator::text(const zstring& textValue) |
56 | 142 | { | 142 | { |
58 | 143 | //cout << " sv Text: '" << textValue << "'\n"; | 143 | //cout << " esv Text: '" << textValue << "'\n"; std::cout.flush(); |
59 | 144 | 144 | ||
60 | 145 | XMLChArray value(textValue); | 145 | XMLChArray value(textValue); |
61 | 146 | theSchemaValidatorFilter->textEvent(value); | 146 | theSchemaValidatorFilter->textEvent(value); |
62 | @@ -163,7 +163,7 @@ | |||
63 | 163 | StrX typeName(theSchemaValidatorFilter->getTypeName()); | 163 | StrX typeName(theSchemaValidatorFilter->getTypeName()); |
64 | 164 | StrX typeUri(theSchemaValidatorFilter->getTypeUri()); | 164 | StrX typeUri(theSchemaValidatorFilter->getTypeUri()); |
65 | 165 | 165 | ||
67 | 166 | //cout << " - getTypeQName: " << typeName << " @ " << typeUri <<" "; | 166 | //cout << " esv - : getTypeQName: " << typeName << " @ " << typeUri <<"\n"; std::cout.flush(); |
68 | 167 | 167 | ||
69 | 168 | store::Item_t typeQName; | 168 | store::Item_t typeQName; |
70 | 169 | GENV_ITEMFACTORY->createQName(typeQName, | 169 | GENV_ITEMFACTORY->createQName(typeQName, |
71 | @@ -171,8 +171,8 @@ | |||
72 | 171 | "", | 171 | "", |
73 | 172 | typeName.localFormOrDefault ("untyped")); | 172 | typeName.localFormOrDefault ("untyped")); |
74 | 173 | 173 | ||
77 | 174 | //cout << " : " << typeQName->getLocalName() << " @ " | 174 | //cout << " " << typeQName->getLocalName() << " @ " |
78 | 175 | // << typeQName->getNamespace() <<"\n"; std::cout.flush(); | 175 | // << typeQName->getNamespace() <<"\n"; std::cout.flush(); std::cout.flush(); |
79 | 176 | 176 | ||
80 | 177 | return typeQName; | 177 | return typeQName; |
81 | 178 | } | 178 | } |
82 | @@ -183,7 +183,7 @@ | |||
83 | 183 | StrX typeName(theSchemaValidatorFilter->getTypeName()); | 183 | StrX typeName(theSchemaValidatorFilter->getTypeName()); |
84 | 184 | StrX typeUri(theSchemaValidatorFilter->getTypeUri()); | 184 | StrX typeUri(theSchemaValidatorFilter->getTypeUri()); |
85 | 185 | 185 | ||
87 | 186 | //cout << " - getType: " << typeName << "@" << typeUri <<"\n"; | 186 | //cout << " esv - : getType: " << typeName << "@" << typeUri <<"\n"; std::cout.flush(); |
88 | 187 | 187 | ||
89 | 188 | store::Item_t typeQName; | 188 | store::Item_t typeQName; |
90 | 189 | GENV_ITEMFACTORY->createQName(typeQName, | 189 | GENV_ITEMFACTORY->createQName(typeQName, |
91 | @@ -191,7 +191,7 @@ | |||
92 | 191 | "", | 191 | "", |
93 | 192 | typeName.localFormOrDefault ("untyped")); | 192 | typeName.localFormOrDefault ("untyped")); |
94 | 193 | 193 | ||
96 | 194 | xqtref_t type = theTypeManager->create_named_type(typeQName, | 194 | xqtref_t type = theTypeManager->create_named_type(typeQName, |
97 | 195 | TypeConstants::QUANT_ONE, | 195 | TypeConstants::QUANT_ONE, |
98 | 196 | QueryLoc::null); | 196 | QueryLoc::null); |
99 | 197 | return type; | 197 | return type; |
100 | @@ -229,7 +229,7 @@ | |||
101 | 229 | XMLChArray localname(typeQName->getLocalName()); | 229 | XMLChArray localname(typeQName->getLocalName()); |
102 | 230 | 230 | ||
103 | 231 | //cout << " SType: " << typeQName->getLocalName() << " @ " | 231 | //cout << " SType: " << typeQName->getLocalName() << " @ " |
105 | 232 | // << typeQName->getNamespace() << "\n"; | 232 | // << typeQName->getNamespace() << "\n"; std::cout.flush(); |
106 | 233 | 233 | ||
107 | 234 | theSchemaValidatorFilter->startTypeEvent(uri, localname); | 234 | theSchemaValidatorFilter->startTypeEvent(uri, localname); |
108 | 235 | } | 235 | } |
109 | @@ -237,7 +237,7 @@ | |||
110 | 237 | 237 | ||
111 | 238 | void EventSchemaValidator::endType() | 238 | void EventSchemaValidator::endType() |
112 | 239 | { | 239 | { |
114 | 240 | //cout << " EType \n"; | 240 | //cout << " EType \n"; std::cout.flush(); |
115 | 241 | 241 | ||
116 | 242 | theSchemaValidatorFilter->endTypeEvent(); | 242 | theSchemaValidatorFilter->endTypeEvent(); |
117 | 243 | } | 243 | } |
118 | 244 | 244 | ||
119 | === modified file 'src/types/schema/SchemaValidatorFilter.cpp' | |||
120 | --- src/types/schema/SchemaValidatorFilter.cpp 2013-01-25 22:32:28 +0000 | |||
121 | +++ src/types/schema/SchemaValidatorFilter.cpp 2013-02-08 23:12:24 +0000 | |||
122 | @@ -200,7 +200,7 @@ | |||
123 | 200 | const XMLCh *uri, | 200 | const XMLCh *uri, |
124 | 201 | const XMLCh *localname) | 201 | const XMLCh *localname) |
125 | 202 | { | 202 | { |
127 | 203 | //cout << " svf startElememntEvent: " << StrX(localname) << " @ " << StrX(uri) << "\n"; | 203 | //cout << " svf startElememntEvent: " << StrX(localname) << " @ " << StrX(uri) << "\n"; |
128 | 204 | if(theElementToProcess) | 204 | if(theElementToProcess) |
129 | 205 | processStartElement(); | 205 | processStartElement(); |
130 | 206 | 206 | ||
131 | @@ -229,12 +229,14 @@ | |||
132 | 229 | 229 | ||
133 | 230 | void SchemaValidatorFilter::processStartElement() | 230 | void SchemaValidatorFilter::processStartElement() |
134 | 231 | { | 231 | { |
135 | 232 | //std::cout << " svf - : processStartElement " << StrX(theLocalname.getRawBuffer()) << " v: " << fValidate << "\n"; std::cout.flush(); | ||
136 | 232 | bool isRoot = theParentStack == 0; | 233 | bool isRoot = theParentStack == 0; |
137 | 233 | unsigned int uriId = fURIStringPool->addOrFind(theUri.getRawBuffer()); | 234 | unsigned int uriId = fURIStringPool->addOrFind(theUri.getRawBuffer()); |
138 | 234 | 235 | ||
141 | 235 | // Handle xsi:type | 236 | if (theXsiType) |
140 | 236 | if( theXsiType ) | ||
142 | 237 | { | 237 | { |
143 | 238 | // Handle xsi:type | ||
144 | 239 | //std::cout << " svf - : procStartElemEvent2 xsi: " << StrX(theXsiType) << " v: " << fValidate << "\n"; std::cout.flush(); | ||
145 | 238 | int colonPos = -1; | 240 | int colonPos = -1; |
146 | 239 | unsigned int atUriId = resolveQName(theXsiType, | 241 | unsigned int atUriId = resolveQName(theXsiType, |
147 | 240 | fPrefixBuf, | 242 | fPrefixBuf, |
148 | @@ -247,7 +249,6 @@ | |||
149 | 247 | } | 249 | } |
150 | 248 | 250 | ||
151 | 249 | bool isProcessorStipulatedTypeName = false; | 251 | bool isProcessorStipulatedTypeName = false; |
152 | 250 | |||
153 | 251 | if( theProcessorStipulatedTypeName && isRoot ) | 252 | if( theProcessorStipulatedTypeName && isRoot ) |
154 | 252 | { | 253 | { |
155 | 253 | isProcessorStipulatedTypeName = true; | 254 | isProcessorStipulatedTypeName = true; |
156 | @@ -334,7 +335,7 @@ | |||
157 | 334 | getSubstitutionGroupElem(); | 335 | getSubstitutionGroupElem(); |
158 | 335 | if (substitutedElem) | 336 | if (substitutedElem) |
159 | 336 | { | 337 | { |
161 | 337 | //cout << " svf substitutedElem: " << | 338 | //cout << " svf substitutedElem: " << |
162 | 338 | // StrX(substitutedElem->getFullName()) << "\n"; | 339 | // StrX(substitutedElem->getFullName()) << "\n"; |
163 | 339 | theSubstitutedElemName = substitutedElem->getBaseName(); | 340 | theSubstitutedElemName = substitutedElem->getBaseName(); |
164 | 340 | theSubstitutedElemUri = (XMLCh*)fURIStringPool-> | 341 | theSubstitutedElemUri = (XMLCh*)fURIStringPool-> |
165 | @@ -342,7 +343,6 @@ | |||
166 | 342 | } | 343 | } |
167 | 343 | } | 344 | } |
168 | 344 | 345 | ||
169 | 345 | |||
170 | 346 | if(fValidate) | 346 | if(fValidate) |
171 | 347 | { | 347 | { |
172 | 348 | if (isProcessorStipulatedTypeName) | 348 | if (isProcessorStipulatedTypeName) |
173 | @@ -355,11 +355,17 @@ | |||
174 | 355 | fValidator->validateElement(elemDecl); | 355 | fValidator->validateElement(elemDecl); |
175 | 356 | } | 356 | } |
176 | 357 | } | 357 | } |
177 | 358 | else if (theXsiType) | ||
178 | 359 | { | ||
179 | 360 | //validate element even if lax but has xsi:type | ||
180 | 361 | fValidator->validateElement(elemDecl); | ||
181 | 362 | } | ||
182 | 363 | |||
183 | 358 | 364 | ||
184 | 359 | ComplexTypeInfo* typeinfo = | 365 | ComplexTypeInfo* typeinfo = |
185 | 360 | (fValidate ? | 366 | (fValidate ? |
188 | 361 | ((XercSchemaValidator*)fValidator)->getCurrentTypeInfo() : | 367 | ((XercSchemaValidator*)fValidator)->getCurrentTypeInfo() : |
189 | 362 | ((SchemaElementDecl*)elemDecl)->getComplexTypeInfo()); | 368 | ((SchemaElementDecl*)elemDecl)->getComplexTypeInfo()); |
190 | 363 | 369 | ||
191 | 364 | if(typeinfo) | 370 | if(typeinfo) |
192 | 365 | { | 371 | { |
193 | @@ -452,7 +458,7 @@ | |||
194 | 452 | unsigned int uriId = attr->getURIId(); | 458 | unsigned int uriId = attr->getURIId(); |
195 | 453 | const XMLCh *uri = getURIText(uriId); | 459 | const XMLCh *uri = getURIText(uriId); |
196 | 454 | 460 | ||
198 | 455 | //cout << " svf: processAttrs: " << StrX(localname) << "@" << StrX(uri) << | 461 | //cout << " svf: processAttrs: " << StrX(localname) << "@" << StrX(uri) << |
199 | 456 | // " ='" << StrX(value) << "'" << endl; | 462 | // " ='" << StrX(value) << "'" << endl; |
200 | 457 | 463 | ||
201 | 458 | bool attrValid = true; | 464 | bool attrValid = true; |
202 | @@ -714,8 +720,8 @@ | |||
203 | 714 | if(theElementToProcess) | 720 | if(theElementToProcess) |
204 | 715 | processStartElement(); | 721 | processStartElement(); |
205 | 716 | 722 | ||
208 | 717 | //cout << " svf: endElementEvent: " << StrX(localname) << "@" << StrX(uri) << | 723 | // std::cout << " svf: endElementEvent1: " << StrX(localname) << "@" << StrX(uri) << |
209 | 718 | // " type: " << StrX(typeName) << " @" << StrX(typeURI) << endl; | 724 | // " type: " << StrX(typeName) << " @" << StrX(typeURI) << " v: " << fValidate << std::endl; |
210 | 719 | 725 | ||
211 | 720 | typeURI = SchemaSymbols::fgURI_SCHEMAFORSCHEMA; | 726 | typeURI = SchemaSymbols::fgURI_SCHEMAFORSCHEMA; |
212 | 721 | typeName = SchemaSymbols::fgATTVAL_ANYTYPE; | 727 | typeName = SchemaSymbols::fgATTVAL_ANYTYPE; |
213 | @@ -726,7 +732,7 @@ | |||
214 | 726 | // We commandeer fCommentOrPISeen to keep _errorOccurred in | 732 | // We commandeer fCommentOrPISeen to keep _errorOccurred in |
215 | 727 | theErrorOccurred = topElem->fCommentOrPISeen; | 733 | theErrorOccurred = topElem->fCommentOrPISeen; |
216 | 728 | 734 | ||
218 | 729 | if(fValidate) | 735 | if(fValidate || theXsiType) |
219 | 730 | { | 736 | { |
220 | 731 | DatatypeValidator *currentDV = 0; | 737 | DatatypeValidator *currentDV = 0; |
221 | 732 | if(topElem->fThisElement->isDeclared()) | 738 | if(topElem->fThisElement->isDeclared()) |
222 | @@ -867,7 +873,7 @@ | |||
223 | 867 | } | 873 | } |
224 | 868 | --theAttrCount; // remove att from the list but still needs to be reported | 874 | --theAttrCount; // remove att from the list but still needs to be reported |
225 | 869 | 875 | ||
227 | 870 | //std::cout << " svf attrEvent: " << StrX(localname) << " T: " << | 876 | //std::cout << " svf attrEvent: " << StrX(localname) << " T: " << |
228 | 871 | // StrX(typeName) << "\n"; | 877 | // StrX(typeName) << "\n"; |
229 | 872 | theEventBuffer->attributeEvent(emptyToNull(prefix), emptyToNull(uri), | 878 | theEventBuffer->attributeEvent(emptyToNull(prefix), emptyToNull(uri), |
230 | 873 | localname, value, emptyToNull(typeURI), typeName); | 879 | localname, value, emptyToNull(typeURI), typeName); |
231 | @@ -898,7 +904,8 @@ | |||
232 | 898 | while(*end) ++end; | 904 | while(*end) ++end; |
233 | 899 | unsigned int len = (unsigned int)(end - chars); | 905 | unsigned int len = (unsigned int)(end - chars); |
234 | 900 | 906 | ||
236 | 901 | if(fValidate) | 907 | // Also handle xsi:type |
237 | 908 | if(fValidate || theXsiType) | ||
238 | 902 | { | 909 | { |
239 | 903 | // Get the character data opts for the current element | 910 | // Get the character data opts for the current element |
240 | 904 | XMLElementDecl::CharDataOpts charOpts = XMLElementDecl::AllCharData; | 911 | XMLElementDecl::CharDataOpts charOpts = XMLElementDecl::AllCharData; |
241 | @@ -1011,7 +1018,7 @@ | |||
242 | 1011 | 1018 | ||
243 | 1012 | const XMLCh *typeURI = NULL; | 1019 | const XMLCh *typeURI = NULL; |
244 | 1013 | 1020 | ||
246 | 1014 | if(fValidate) | 1021 | if(fValidate || theXsiType) |
247 | 1015 | { | 1022 | { |
248 | 1016 | if (theProcessorStipulatedTypeName && theParentStack == 0) | 1023 | if (theProcessorStipulatedTypeName && theParentStack == 0) |
249 | 1017 | { | 1024 | { |
250 | @@ -1051,7 +1058,7 @@ | |||
251 | 1051 | 1058 | ||
252 | 1052 | const XMLCh *typeName = NULL; | 1059 | const XMLCh *typeName = NULL; |
253 | 1053 | 1060 | ||
255 | 1054 | if(fValidate) | 1061 | if(fValidate || theXsiType) |
256 | 1055 | { | 1062 | { |
257 | 1056 | //cout << " - getTypeQName: theElemDepth:" << theElemDepth << "\n"; | 1063 | //cout << " - getTypeQName: theElemDepth:" << theElemDepth << "\n"; |
258 | 1057 | if (theProcessorStipulatedTypeName && theElemDepth == 0 ) | 1064 | if (theProcessorStipulatedTypeName && theElemDepth == 0 ) |
259 | @@ -1582,7 +1589,7 @@ | |||
260 | 1582 | } | 1589 | } |
261 | 1583 | } | 1590 | } |
262 | 1584 | 1591 | ||
264 | 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(); |
265 | 1586 | throw XQUERY_EXCEPTION( | 1593 | throw XQUERY_EXCEPTION( |
266 | 1587 | err::XQDY0027, | 1594 | err::XQDY0027, |
267 | 1588 | ERROR_PARAMS( StrX(exc_msg.getRawBuffer()).localForm() ), | 1595 | ERROR_PARAMS( StrX(exc_msg.getRawBuffer()).localForm() ), |
268 | 1589 | 1596 | ||
269 | === modified file 'src/types/schema/XercSchemaValidator.cpp' | |||
270 | --- src/types/schema/XercSchemaValidator.cpp 2012-11-26 23:23:13 +0000 | |||
271 | +++ src/types/schema/XercSchemaValidator.cpp 2013-02-08 23:12:24 +0000 | |||
272 | @@ -91,6 +91,7 @@ | |||
273 | 91 | { | 91 | { |
274 | 92 | fTrailingSeenNonWhiteSpace.flags = 0; | 92 | fTrailingSeenNonWhiteSpace.flags = 0; |
275 | 93 | fTypeStack = new (fMemoryManager) ValueStackOf<ComplexTypeInfo*>(8, fMemoryManager); | 93 | fTypeStack = new (fMemoryManager) ValueStackOf<ComplexTypeInfo*>(8, fMemoryManager); |
276 | 94 | //std::cout << " xsv - : constructor \n"; std::cout.flush(); | ||
277 | 94 | } | 95 | } |
278 | 95 | 96 | ||
279 | 96 | XercSchemaValidator::~XercSchemaValidator() | 97 | XercSchemaValidator::~XercSchemaValidator() |
280 | @@ -129,6 +130,7 @@ | |||
281 | 129 | } | 130 | } |
282 | 130 | 131 | ||
283 | 131 | ComplexTypeInfo* currType = fTypeStack->pop(); | 132 | ComplexTypeInfo* currType = fTypeStack->pop(); |
284 | 133 | //std::cout << " xsv - : checkcontent pop \n"; std::cout.flush(); | ||
285 | 132 | 134 | ||
286 | 133 | const SchemaElementDecl::ModelTypes modelType = (currType) | 135 | const SchemaElementDecl::ModelTypes modelType = (currType) |
287 | 134 | ? (SchemaElementDecl::ModelTypes)(currType->getContentType()) | 136 | ? (SchemaElementDecl::ModelTypes)(currType->getContentType()) |
288 | @@ -370,6 +372,8 @@ | |||
289 | 370 | fTrailingSeenNonWhiteSpace.flags = 0; | 372 | fTrailingSeenNonWhiteSpace.flags = 0; |
290 | 371 | fSeenId = false; | 373 | fSeenId = false; |
291 | 372 | fTypeStack->removeAllElements(); | 374 | fTypeStack->removeAllElements(); |
292 | 375 | //std::cout << " xsv - : reset \n"; std::cout.flush(); | ||
293 | 376 | |||
294 | 373 | delete fXsiType; | 377 | delete fXsiType; |
295 | 374 | fXsiType = 0; | 378 | fXsiType = 0; |
296 | 375 | fCurrentDatatypeValidator = 0; | 379 | fCurrentDatatypeValidator = 0; |
297 | @@ -560,6 +564,7 @@ | |||
298 | 560 | { | 564 | { |
299 | 561 | ComplexTypeInfo* elemTypeInfo = ((SchemaElementDecl*)elemDef)->getComplexTypeInfo(); | 565 | ComplexTypeInfo* elemTypeInfo = ((SchemaElementDecl*)elemDef)->getComplexTypeInfo(); |
300 | 562 | fTypeStack->push(elemTypeInfo); | 566 | fTypeStack->push(elemTypeInfo); |
301 | 567 | //std::cout << " xsv - : valElem1 push eti " << (elemTypeInfo ? StrX(elemTypeInfo->getTypeLocalName()).localForm() : "_") << "\n"; std::cout.flush(); | ||
302 | 563 | fCurrentDatatypeValidator = (elemTypeInfo) | 568 | fCurrentDatatypeValidator = (elemTypeInfo) |
303 | 564 | ? elemTypeInfo->getDatatypeValidator() | 569 | ? elemTypeInfo->getDatatypeValidator() |
304 | 565 | : ((SchemaElementDecl*)elemDef)->getDatatypeValidator(); | 570 | : ((SchemaElementDecl*)elemDef)->getDatatypeValidator(); |
305 | @@ -580,7 +585,7 @@ | |||
306 | 580 | 585 | ||
307 | 581 | // retrieve Grammar for the uri | 586 | // retrieve Grammar for the uri |
308 | 582 | const XMLCh* uriStr = getScanner()->getURIText(uri); | 587 | const XMLCh* uriStr = getScanner()->getURIText(uri); |
310 | 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(); |
311 | 584 | SchemaGrammar* sGrammar = (SchemaGrammar*) fGrammarResolver->getGrammar(uriStr); | 589 | SchemaGrammar* sGrammar = (SchemaGrammar*) fGrammarResolver->getGrammar(uriStr); |
312 | 585 | if (!sGrammar) { | 590 | if (!sGrammar) { |
313 | 586 | 591 | ||
314 | @@ -691,7 +696,9 @@ | |||
315 | 691 | if (!fErrorOccurred) | 696 | if (!fErrorOccurred) |
316 | 692 | { | 697 | { |
317 | 693 | fTypeStack->pop(); | 698 | fTypeStack->pop(); |
318 | 699 | //std::cout << " xsv - : valElem2 pop \n"; std::cout.flush(); | ||
319 | 694 | fTypeStack->push(typeInfo); | 700 | fTypeStack->push(typeInfo); |
320 | 701 | //std::cout << " xsv - : valElem3 push " << (typeInfo ? StrX(typeInfo->getTypeLocalName()).localForm() : "_") << "\n"; std::cout.flush(); | ||
321 | 695 | fCurrentDatatypeValidator = typeInfo->getDatatypeValidator(); | 702 | fCurrentDatatypeValidator = typeInfo->getDatatypeValidator(); |
322 | 696 | } | 703 | } |
323 | 697 | } | 704 | } |
324 | @@ -863,6 +870,7 @@ | |||
325 | 863 | { | 870 | { |
326 | 864 | fTypeStack->push(typeInfo); | 871 | fTypeStack->push(typeInfo); |
327 | 865 | fCurrentDatatypeValidator = typeInfo->getDatatypeValidator(); | 872 | fCurrentDatatypeValidator = typeInfo->getDatatypeValidator(); |
328 | 873 | //std::cout << " xsv - : valElem4 push " << (typeInfo ? StrX(typeInfo->getTypeLocalName()).localForm() : "_") << "\n"; std::cout.flush(); | ||
329 | 866 | } | 874 | } |
330 | 867 | } | 875 | } |
331 | 868 | } | 876 | } |
332 | 869 | 877 | ||
333 | === modified file 'src/types/schema/XercSchemaValidator.h' | |||
334 | --- src/types/schema/XercSchemaValidator.h 2012-09-19 21:16:15 +0000 | |||
335 | +++ src/types/schema/XercSchemaValidator.h 2013-02-08 23:12:24 +0000 | |||
336 | @@ -1,12 +1,12 @@ | |||
337 | 1 | /* | 1 | /* |
338 | 2 | * Copyright 2006-2008 The FLWOR Foundation. | 2 | * Copyright 2006-2008 The FLWOR Foundation. |
340 | 3 | * | 3 | * |
341 | 4 | * Licensed under the Apache License, Version 2.0 (the "License"); | 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
342 | 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. |
343 | 6 | * You may obtain a copy of the License at | 6 | * You may obtain a copy of the License at |
345 | 7 | * | 7 | * |
346 | 8 | * http://www.apache.org/licenses/LICENSE-2.0 | 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
348 | 9 | * | 9 | * |
349 | 10 | * Unless required by applicable law or agreed to in writing, software | 10 | * Unless required by applicable law or agreed to in writing, software |
350 | 11 | * distributed under the License is distributed on an "AS IS" BASIS, | 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
351 | 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
352 | @@ -114,7 +114,7 @@ | |||
353 | 114 | DatatypeValidator* fCurrentDatatypeValidator; | 114 | DatatypeValidator* fCurrentDatatypeValidator; |
354 | 115 | XMLBuffer* fNotationBuf; | 115 | XMLBuffer* fNotationBuf; |
355 | 116 | XMLBuffer fDatatypeBuffer; | 116 | XMLBuffer fDatatypeBuffer; |
357 | 117 | 117 | ||
358 | 118 | #if _XERCES_VERSION >= 30000 | 118 | #if _XERCES_VERSION >= 30000 |
359 | 119 | // Only for 3.0.1. | 119 | // Only for 3.0.1. |
360 | 120 | // | 120 | // |
361 | @@ -158,7 +158,7 @@ | |||
362 | 158 | XMLElementDecl* const elemDecl, | 158 | XMLElementDecl* const elemDecl, |
363 | 159 | XERCES_CPP_NAMESPACE::QName** const children, | 159 | XERCES_CPP_NAMESPACE::QName** const children, |
364 | 160 | const unsigned int childCount); | 160 | const unsigned int childCount); |
366 | 161 | #endif | 161 | #endif |
367 | 162 | 162 | ||
368 | 163 | virtual void faultInAttr( | 163 | virtual void faultInAttr( |
369 | 164 | XMLAttr& toFill, | 164 | XMLAttr& toFill, |
370 | @@ -194,7 +194,7 @@ | |||
371 | 194 | // Virtual DTD handler interface. | 194 | // Virtual DTD handler interface. |
372 | 195 | // ----------------------------------------------------------------------- | 195 | // ----------------------------------------------------------------------- |
373 | 196 | virtual bool handlesDTD() const; | 196 | virtual bool handlesDTD() const; |
375 | 197 | 197 | ||
376 | 198 | // ----------------------------------------------------------------------- | 198 | // ----------------------------------------------------------------------- |
377 | 199 | // Virtual Schema handler interface. handlesSchema() always return false. | 199 | // Virtual Schema handler interface. handlesSchema() always return false. |
378 | 200 | // ----------------------------------------------------------------------- | 200 | // ----------------------------------------------------------------------- |
379 | @@ -394,12 +394,12 @@ | |||
380 | 394 | 394 | ||
381 | 395 | ContentSpecNode* getNonUnaryGroup(ContentSpecNode* const pNode); | 395 | ContentSpecNode* getNonUnaryGroup(ContentSpecNode* const pNode); |
382 | 396 | }; | 396 | }; |
385 | 397 | 397 | ||
386 | 398 | 398 | ||
387 | 399 | // --------------------------------------------------------------------------- | 399 | // --------------------------------------------------------------------------- |
388 | 400 | // XercSchemaValidator: Setter methods | 400 | // XercSchemaValidator: Setter methods |
389 | 401 | // --------------------------------------------------------------------------- | 401 | // --------------------------------------------------------------------------- |
391 | 402 | inline void XercSchemaValidator::setGrammarResolver(GrammarResolver* grammarResolver) | 402 | inline void XercSchemaValidator::setGrammarResolver(GrammarResolver* grammarResolver) |
392 | 403 | { | 403 | { |
393 | 404 | fGrammarResolver = grammarResolver; | 404 | fGrammarResolver = grammarResolver; |
394 | 405 | } | 405 | } |
395 | @@ -413,16 +413,17 @@ | |||
396 | 413 | delete fXsiType; | 413 | delete fXsiType; |
397 | 414 | fXsiType = new (fMemoryManager) | 414 | fXsiType = new (fMemoryManager) |
398 | 415 | XERCES_CPP_NAMESPACE::QName(prefix, localPart, uriId, fMemoryManager); | 415 | XERCES_CPP_NAMESPACE::QName(prefix, localPart, uriId, fMemoryManager); |
399 | 416 | //std::cout << " xsv::setXsiType " << StrX(prefix) << ":" << StrX(localPart) << " " << uriId << "\n"; std::cout.flush(); | ||
400 | 416 | } | 417 | } |
401 | 417 | 418 | ||
402 | 418 | 419 | ||
404 | 419 | inline void XercSchemaValidator::setNillable(bool isNil) | 420 | inline void XercSchemaValidator::setNillable(bool isNil) |
405 | 420 | { | 421 | { |
406 | 421 | fNil = isNil; | 422 | fNil = isNil; |
407 | 422 | } | 423 | } |
408 | 423 | 424 | ||
409 | 424 | 425 | ||
411 | 425 | inline void XercSchemaValidator::setExitOnFirstFatal(const bool newValue) | 426 | inline void XercSchemaValidator::setExitOnFirstFatal(const bool newValue) |
412 | 426 | { | 427 | { |
413 | 427 | fSchemaErrorReporter.setExitOnFirstFatal(newValue); | 428 | fSchemaErrorReporter.setExitOnFirstFatal(newValue); |
414 | 428 | } | 429 | } |
415 | @@ -443,7 +444,7 @@ | |||
416 | 443 | // --------------------------------------------------------------------------- | 444 | // --------------------------------------------------------------------------- |
417 | 444 | // XercSchemaValidator: Getter methods | 445 | // XercSchemaValidator: Getter methods |
418 | 445 | // --------------------------------------------------------------------------- | 446 | // --------------------------------------------------------------------------- |
420 | 446 | inline ComplexTypeInfo* XercSchemaValidator::getCurrentTypeInfo() const | 447 | inline ComplexTypeInfo* XercSchemaValidator::getCurrentTypeInfo() const |
421 | 447 | { | 448 | { |
422 | 448 | if (fTypeStack->empty()) | 449 | if (fTypeStack->empty()) |
423 | 449 | return 0; | 450 | return 0; |
424 | @@ -467,19 +468,19 @@ | |||
425 | 467 | // --------------------------------------------------------------------------- | 468 | // --------------------------------------------------------------------------- |
426 | 468 | // Virtual interface | 469 | // Virtual interface |
427 | 469 | // --------------------------------------------------------------------------- | 470 | // --------------------------------------------------------------------------- |
429 | 470 | inline Grammar* XercSchemaValidator::getGrammar() const | 471 | inline Grammar* XercSchemaValidator::getGrammar() const |
430 | 471 | { | 472 | { |
431 | 472 | return fSchemaGrammar; | 473 | return fSchemaGrammar; |
432 | 473 | } | 474 | } |
433 | 474 | 475 | ||
434 | 475 | 476 | ||
436 | 476 | inline void XercSchemaValidator::setGrammar(Grammar* aGrammar) | 477 | inline void XercSchemaValidator::setGrammar(Grammar* aGrammar) |
437 | 477 | { | 478 | { |
438 | 478 | fSchemaGrammar = (SchemaGrammar*) aGrammar; | 479 | fSchemaGrammar = (SchemaGrammar*) aGrammar; |
439 | 479 | } | 480 | } |
440 | 480 | 481 | ||
441 | 481 | 482 | ||
443 | 482 | inline void XercSchemaValidator::setErrorReporter(XMLErrorReporter* const errorReporter) | 483 | inline void XercSchemaValidator::setErrorReporter(XMLErrorReporter* const errorReporter) |
444 | 483 | { | 484 | { |
445 | 484 | XMLValidator::setErrorReporter(errorReporter); | 485 | XMLValidator::setErrorReporter(errorReporter); |
446 | 485 | fSchemaErrorReporter.setErrorReporter(errorReporter); | 486 | fSchemaErrorReporter.setErrorReporter(errorReporter); |
447 | @@ -512,7 +513,7 @@ | |||
448 | 512 | const int min1, | 513 | const int min1, |
449 | 513 | const int max1, | 514 | const int max1, |
450 | 514 | const int min2, | 515 | const int min2, |
452 | 515 | const int max2) | 516 | const int max2) |
453 | 516 | { | 517 | { |
454 | 517 | if (min1 >= min2 && | 518 | if (min1 >= min2 && |
455 | 518 | (max2 == SchemaSymbols::XSD_UNBOUNDED || | 519 | (max2 == SchemaSymbols::XSD_UNBOUNDED || |
456 | 519 | 520 | ||
457 | === added file 'test/rbkt/ExpQueryResults/zorba/schemas/val-laxXsiType.xml.res' | |||
458 | --- test/rbkt/ExpQueryResults/zorba/schemas/val-laxXsiType.xml.res 1970-01-01 00:00:00 +0000 | |||
459 | +++ test/rbkt/ExpQueryResults/zorba/schemas/val-laxXsiType.xml.res 2013-02-08 23:12:24 +0000 | |||
460 | @@ -0,0 +1,2 @@ | |||
461 | 1 | <?xml version="1.0" encoding="UTF-8"?> | ||
462 | 2 | xs:long xs:integer xs:untypedAtomic | ||
463 | 0 | 3 | ||
464 | === added file 'test/rbkt/Queries/zorba/schemas/val-laxXsiType.xq' | |||
465 | --- test/rbkt/Queries/zorba/schemas/val-laxXsiType.xq 1970-01-01 00:00:00 +0000 | |||
466 | +++ test/rbkt/Queries/zorba/schemas/val-laxXsiType.xq 2013-02-08 23:12:24 +0000 | |||
467 | @@ -0,0 +1,18 @@ | |||
468 | 1 | import module namespace schema = "http://www.zorba-xquery.com/modules/schema"; | ||
469 | 2 | |||
470 | 3 | declare variable $doc := | ||
471 | 4 | <numbers xmlns:xs="http://www.w3.org/2001/XMLSchema" | ||
472 | 5 | xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> | ||
473 | 6 | <xs_long xsi:type="xs:long">1</xs_long> | ||
474 | 7 | <xs_long xsi:type="xs:integer">2</xs_long> | ||
475 | 8 | <xs_long>3</xs_long> | ||
476 | 9 | </numbers> | ||
477 | 10 | ; | ||
478 | 11 | |||
479 | 12 | declare variable $vdoc := validate lax { $doc }; | ||
480 | 13 | |||
481 | 14 | ( | ||
482 | 15 | schema:schema-type(fn:data(($vdoc//xs_long)[1])), | ||
483 | 16 | schema:schema-type(fn:data(($vdoc//xs_long)[2])), | ||
484 | 17 | schema:schema-type(fn:data(($vdoc//xs_long)[3])) | ||
485 | 18 | ) |
Validation queue starting for merge proposal. zorbatest. lambda. nu:8080/ remotequeue/ bug1023362- xsiTypeIgnored- 2013-02- 01T20-56- 35.809Z/ log.html
Log at: http://