Merge lp:~zorba-coders/zorba/bug891209-xsiType into lp:zorba

Proposed by Matthias Brantner
Status: Superseded
Proposed branch: lp:~zorba-coders/zorba/bug891209-xsiType
Merge into: lp:zorba
Diff against target: 303 lines (+70/-35)
14 files modified
ChangeLog (+1/-0)
include/zorba/static_context_consts.h (+1/-1)
src/api/staticcontextimpl.cpp (+3/-0)
src/compiler/parser/parse_constants.h (+1/-0)
src/context/static_context.cpp (+13/-4)
src/context/static_context_consts.h (+1/-0)
src/types/schema/EventSchemaValidator.cpp (+2/-2)
src/types/schema/SchemaValidatorFilter.cpp (+4/-2)
src/types/schema/XercSchemaValidator.cpp (+2/-2)
src/types/schema/validate.cpp (+24/-18)
src/types/typemanagerimpl.cpp (+5/-5)
test/rbkt/ExpQueryResults/zorba/schemas/val-xsiType-noSchemaImport.xml.res (+1/-0)
test/rbkt/Queries/zorba/schemas/val-xsiType-noSchemaImport.xq (+11/-0)
test/rbkt/testdriver_common.cpp (+1/-1)
To merge this branch: bzr merge lp:~zorba-coders/zorba/bug891209-xsiType
Reviewer Review Type Date Requested Status
Markos Zaharioudakis Pending
Matthias Brantner Pending
Review via email: mp+95487@code.launchpad.net

This proposal supersedes a proposal from 2012-03-01.

This proposal has been superseded by a proposal from 2012-03-05.

Commit message

Fix for bug 891209 : validation with xsi:type returns untyped.

Description of the change

Fix for bug 891209 : validation with xsi:type returns untyped.

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

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

Revision history for this message
Matthias Brantner (matthias-brantner) wrote : Posted in a previous version of this proposal

Looks good to me but I would feel more comfortable if Markos already took a look at it.

Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote :
Download full text (3.4 KiB)

The attempt to merge lp:~zorba-coders/zorba/bug891209-xsiType into lp:zorba failed. Below is the output from the failed tests.

Traceback (most recent call last):
  File "/home/ceej/zo/testing/zorbatest/tester/proposal_comment.py", line 36, in <module>
    sys.exit(main(sys.argv))
  File "/home/ceej/zo/testing/zorbatest/tester/proposal_comment.py", line 20, in main
    credentials_file=CRED_FILE)
  File "/home/ceej/python/lib/python2.7/site-packages/launchpadlib/launchpad.py", line 539, in login_with
    credential_save_failed, version)
  File "/home/ceej/python/lib/python2.7/site-packages/launchpadlib/launchpad.py", line 359, in _authorize_token_and_login
    service_root, cache, timeout, proxy_info, version)
  File "/home/ceej/python/lib/python2.7/site-packages/launchpadlib/launchpad.py", line 198, in __init__
    credentials, service_root, cache, timeout, proxy_info, version)
  File "/home/ceej/python/lib/python2.7/site-packages/lazr/restfulclient/resource.py", line 460, in __init__
    self._wadl = self._browser.get_wadl_application(self._root_uri)
  File "/home/ceej/python/lib/python2.7/site-packages/lazr/restfulclient/_browser.py", line 299, in get_wadl_application
    response, content = self._request(url, media_type=wadl_type)
  File "/home/ceej/python/lib/python2.7/site-packages/lazr/restfulclient/_browser.py", line 242, in _request
    str(url), method=method, body=data, headers=headers)
  File "/home/ceej/python/lib/python2.7/site-packages/lazr/restfulclient/_browser.py", line 211, in _request_and_retry
    url, method=method, body=body, headers=headers)
  File "/home/ceej/python/lib/python2.7/site-packages/httplib2/__init__.py", line 1406, in request
    (response, new_content) = self._request(conn, authority, uri, request_uri, method, body, headers, redirections, cachekey)
  File "/home/ceej/python/lib/python2.7/site-packages/launchpadlib/launchpad.py", line 126, in _request
    LaunchpadOAuthAwareHttp, self)._request(*args)
  File "/home/ceej/python/lib/python2.7/site-packages/lazr/restfulclient/_browser.py", line 130, in _request
    redirections, cachekey)
  File "/home/ceej/python/lib/python2.7/site-packages/httplib2/__init__.py", line 1188, in _request
    (response, content) = self._conn_request(conn, request_uri, method, body, headers)
  File "/home/ceej/python/lib/python2.7/site-packages/httplib2/__init__.py", line 1123, in _conn_request
    conn.connect()
  File "/home/ceej/python/lib/python2.7/site-packages/httplib2/__init__.py", line 890, in connect
    self.disable_ssl_certificate_validation, self.ca_certs)
  File "/home/ceej/python/lib/python2.7/site-packages/httplib2/__init__.py", line 76, in _ssl_wrap_socket
    cert_reqs=cert_reqs, ca_certs=ca_certs)
  File "/home/ceej/python/lib/python2.7/ssl.py", line 372, in wrap_socket
    ciphers=ciphers)
  File "/home/ceej/python/lib/python2.7/ssl.py", line 134, in __init__
    self.do_handshake()
  File "/home/ceej/python/lib/python2.7/ssl.py", line 296, in do_handshake
    self._sslobj.do_handshake()
ssl.SSLError: [Errno 8] _ssl.c:503: EOF occurred in violation of protocol
CMake Error at /home/ceej/zo/testing/zorbatest/tester/TarmacLander.cmake:274 (message):
  Validation...

Read more...

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

The attempt to merge lp:~zorba-coders/zorba/bug891209-xsiType into lp:zorba failed. Below is the output from the failed tests.

CMake Error at /home/ceej/zo/testing/zorbatest/tester/TarmacLander.cmake:274 (message):
  Validation queue job bug891209-xsiType-2012-03-02T15-27-00.149Z is
  finished. The final status was:

  2 tests did not succeed - changes not commited.

Error in read script: /home/ceej/zo/testing/zorbatest/tester/TarmacLander.cmake

10687. By Cezar Andrei <email address hidden>

Dtd validation based on no schema imports, now has it's own option.

10688. By Cezar Andrei <email address hidden>

Merge from trunk.

10689. By Cezar Andrei <email address hidden>

Make sure only when dtds are involved dtd_lax val mode is used.

10690. By Cezar Andrei <email address hidden>

Adding documentation for the new added validation mode.

Unmerged revisions

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'ChangeLog'
2--- ChangeLog 2012-03-01 21:22:16 +0000
3+++ ChangeLog 2012-03-05 20:55:27 +0000
4@@ -58,6 +58,7 @@
5 * Fixed bug with unversioned modules with C++ external functions
6 * Fixed bug #878508 (JSON Module not escaping escape characters)
7 * Fixed bug #912579 (validate-in-place on non-root elements)
8+ * Fixed bug #891209 (validation with xsi:type returns untyped)
9
10 version 2.1
11
12
13=== modified file 'include/zorba/static_context_consts.h'
14--- include/zorba/static_context_consts.h 2011-10-07 21:22:20 +0000
15+++ include/zorba/static_context_consts.h 2012-03-05 20:55:27 +0000
16@@ -58,7 +58,7 @@
17 /** \brief Revalidation mode as defined in
18 * http://www.w3.org/TR/xquery-update-10/#id-revalidation-declaration
19 */
20-typedef enum { validate_skip, validate_lax, validate_strict } validation_mode_t;
21+typedef enum { validate_skip, validate_lax, validate_lax_dtd, validate_strict } validation_mode_t;
22
23 /** \brief Maintenance mode of an index as defined
24 * in the XQuery Data Definition Facility
25
26=== modified file 'src/api/staticcontextimpl.cpp'
27--- src/api/staticcontextimpl.cpp 2012-02-28 20:45:43 +0000
28+++ src/api/staticcontextimpl.cpp 2012-03-05 20:55:27 +0000
29@@ -1247,6 +1247,9 @@
30 case validate_lax:
31 valMode = StaticContextConsts::lax_validation;
32 break;
33+ case validate_lax_dtd:
34+ valMode = StaticContextConsts::lax_dtd_validation;
35+ break;
36 case validate_skip:
37 valMode = StaticContextConsts::skip_validation;
38 break;
39
40=== modified file 'src/compiler/parser/parse_constants.h'
41--- src/compiler/parser/parse_constants.h 2011-06-14 17:26:33 +0000
42+++ src/compiler/parser/parse_constants.h 2012-03-05 20:55:27 +0000
43@@ -103,6 +103,7 @@
44 {
45 val_strict,
46 val_lax,
47+ val_dtd_lax,
48 val_typename
49 };
50
51
52=== modified file 'src/context/static_context.cpp'
53--- src/context/static_context.cpp 2012-02-16 14:11:02 +0000
54+++ src/context/static_context.cpp 2012-03-05 20:55:27 +0000
55@@ -1735,10 +1735,19 @@
56 store::Item_t typeName;
57 QueryLoc loc;
58
59- ParseConstants::validation_mode_t mode =
60- (validationMode == StaticContextConsts::strict_validation ?
61- ParseConstants::val_strict :
62- ParseConstants::val_lax );
63+ ParseConstants::validation_mode_t mode;
64+ switch( validationMode )
65+ {
66+ case StaticContextConsts::strict_validation:
67+ mode = ParseConstants::val_strict;
68+ break;
69+ case StaticContextConsts::lax_dtd_validation:
70+ mode = ParseConstants::val_dtd_lax;
71+ break;
72+ case StaticContextConsts::lax_validation:
73+ default:
74+ mode = ParseConstants::val_lax;
75+ }
76
77 return Validator::effectiveValidationValue(validatedResult,
78 rootElement,
79
80=== modified file 'src/context/static_context_consts.h'
81--- src/context/static_context_consts.h 2012-01-11 17:30:25 +0000
82+++ src/context/static_context_consts.h 2012-03-05 20:55:27 +0000
83@@ -90,6 +90,7 @@
84 validation_unknown,
85 strict_validation,
86 lax_validation,
87+ lax_dtd_validation,
88 skip_validation
89 };
90
91
92=== modified file 'src/types/schema/EventSchemaValidator.cpp'
93--- src/types/schema/EventSchemaValidator.cpp 2011-08-19 03:26:59 +0000
94+++ src/types/schema/EventSchemaValidator.cpp 2012-03-05 20:55:27 +0000
95@@ -163,7 +163,7 @@
96 StrX typeName(theSchemaValidatorFilter->getTypeName());
97 StrX typeUri(theSchemaValidatorFilter->getTypeUri());
98
99- //cout << " - getTypeQName: " << typeName << "@" << typeUri <<" ";
100+ //cout << " - getTypeQName: " << typeName << " @ " << typeUri <<" ";
101
102 store::Item_t typeQName;
103 GENV_ITEMFACTORY->createQName(typeQName,
104@@ -172,7 +172,7 @@
105 typeName.localFormOrDefault ("untyped"));
106
107 //cout << " : " << typeQName->getLocalName() << " @ "
108- // << typeQName->getNamespace() <<"\n";
109+ // << typeQName->getNamespace() <<"\n"; std::cout.flush();
110
111 return typeQName;
112 }
113
114=== modified file 'src/types/schema/SchemaValidatorFilter.cpp'
115--- src/types/schema/SchemaValidatorFilter.cpp 2011-06-14 17:26:33 +0000
116+++ src/types/schema/SchemaValidatorFilter.cpp 2012-03-05 20:55:27 +0000
117@@ -867,7 +867,7 @@
118 }
119 --theAttrCount; // remove att from the list but still needs to be reported
120
121- //cout << " svf attrEvent: " << StrX(localname) << " T: " <<
122+ //std::cout << " svf attrEvent: " << StrX(localname) << " T: " <<
123 // StrX(typeName) << "\n";
124 theEventBuffer->attributeEvent(emptyToNull(prefix), emptyToNull(uri),
125 localname, value, emptyToNull(typeURI), typeName);
126@@ -1062,7 +1062,9 @@
127 {
128 const ElemStack::StackElem* topElem = fElemStack.topElement();
129 DatatypeValidator *currentDV = 0;
130- if(topElem->fThisElement->isDeclared())
131+ if(topElem->fThisElement->isDeclared() ||
132+ theXsiType // this is when there is no schema import but xsiType is used
133+ )
134 {
135 ComplexTypeInfo *currentTypeInfo = ((XercSchemaValidator*)fValidator)->
136 getCurrentTypeInfo();
137
138=== modified file 'src/types/schema/XercSchemaValidator.cpp'
139--- src/types/schema/XercSchemaValidator.cpp 2011-06-14 17:26:33 +0000
140+++ src/types/schema/XercSchemaValidator.cpp 2012-03-05 20:55:27 +0000
141@@ -23,7 +23,6 @@
142 // Includes
143 // ---------------------------------------------------------------------------
144 #include "stdafx.h"
145-#include "XercSchemaValidator.h"
146
147 #include <xercesc/util/Janitor.hpp>
148 #include <xercesc/framework/XMLDocumentHandler.hpp>
149@@ -54,7 +53,8 @@
150
151
152 #include "diagnostics/assert.h"
153-//#include "StrX.h"
154+#include "StrX.h"
155+#include "XercSchemaValidator.h"
156
157 using namespace XERCES_CPP_NAMESPACE;
158
159
160=== modified file 'src/types/schema/validate.cpp'
161--- src/types/schema/validate.cpp 2011-09-22 21:50:20 +0000
162+++ src/types/schema/validate.cpp 2012-03-05 20:55:27 +0000
163@@ -54,7 +54,7 @@
164 #include "diagnostics/assert.h"
165 #include "zorba/store_consts.h"
166
167-using namespace std;
168+//using namespace std;
169
170 namespace zorba
171 {
172@@ -145,15 +145,21 @@
173 //cout << "No schema: isNode() " << sourceNode->isNode() << " nodeKind: "<<
174 // sourceNode->getNodeKind() << endl;
175
176- if ( validationMode == ParseConstants::val_strict )
177- {
178- throw XQUERY_EXCEPTION( err::XQDY0084, ERROR_LOC( loc ) );
179- }
180- else
181- {
182- // no schema available - items remain the same
183+ if ( validationMode == ParseConstants::val_dtd_lax)
184+ {
185+ // when dtd validation enabled avoid using schema object
186 result = sourceNode;
187- return true;
188+ return true;
189+ }
190+ else
191+ {
192+ // if we got here it basicaly means that there was no import but
193+ // validation is used so we need to set up schema in the typeManager anyway
194+ // validation has to work for xsiType and built-in types
195+
196+ TypeManagerImpl *typeManagerImpl = static_cast<TypeManagerImpl*>(typeManager);
197+ typeManagerImpl->initializeSchema();
198+ schema = typeManager->getSchema();
199 }
200 }
201
202@@ -382,8 +388,8 @@
203 ZORBA_ASSERT(attribute->isNode());
204 ZORBA_ASSERT(attribute->getNodeKind() == store::StoreConsts::attributeNode);
205
206- //cout << " v - attr: " << attribute->getNodeName()->getLocalName()->
207- // c_str() << "\n"; cout.flush();
208+ //cout << " v - attr: " << attribute->getNodeName()->getLocalName() << ":" <<
209+ // attribute->getStringValue() << "\n"; cout.flush();
210
211 store::Item_t attName = attribute->getNodeName();
212 schemaValidator.attr(attName, attribute->getStringValue());
213@@ -472,9 +478,9 @@
214 {
215 if ( child->isNode() )
216 {
217- //cout << " > child: " << child->getNodeKind() << " " <<
218- // (child->getType() != NULL ? child->getType()->getLocalName()
219- // : "type_NULL" ) << "\n"; cout.flush();
220+ //cout << " > child: " << (long)child->getNodeKind() << " " <<
221+ // //(child->getType() != NULL ? child->getType()->getLocalName() : "type_NULL" ) <<
222+ // "\n"; cout.flush();
223
224 switch ( child->getNodeKind() )
225 {
226@@ -515,7 +521,7 @@
227 cout << " - text: '" << childStringValue << "' T: " <<
228 typeQName->getLocalName() << "\n"; cout.flush();
229 cout << " xqT: " << xqType->toString() << " content_kind: " <<
230- xqType->content_kind() << " tKind:" << xqType->type_kind() << " \n";
231+ (long)xqType->content_kind() << " tKind:" << (long)xqType->type_kind() << " \n";
232 cout.flush();
233 }
234 else
235@@ -649,9 +655,9 @@
236 xqtref_t type = typeManager->create_named_type(typeQName.getp(),
237 TypeConstants::QUANT_ONE);
238
239- //cout << " - processTextValue: " << typeQName->getPrefix()->str()
240- // << ":" << typeQName->getLocalName()->str() << "@"
241- // << typeQName->getNamespace()->str() ; cout.flush();
242+ //cout << " - processTextValue: " << typeQName->getPrefix()
243+ // << ":" << typeQName->getLocalName() << "@"
244+ // << typeQName->getNamespace() ; cout.flush();
245 //cout << " type: " << (type==NULL ? "NULL" : type->toString()) << "\n"; cout.flush();
246
247 // TODO: we probably need the ns bindings from the static context
248
249=== modified file 'src/types/typemanagerimpl.cpp'
250--- src/types/typemanagerimpl.cpp 2012-01-26 19:56:14 +0000
251+++ src/types/typemanagerimpl.cpp 2012-03-05 20:55:27 +0000
252@@ -336,11 +336,11 @@
253 {
254 if (error != zerr::ZXQP0000_NO_ERROR)
255 {
256- throw XQUERY_EXCEPTION_VAR(
257- error,
258- ERROR_PARAMS(qname->getStringValue(), ZED(NotAmongInScopeSchemaTypes)),
259- ERROR_LOC( loc )
260- );
261+ throw XQUERY_EXCEPTION_VAR(
262+ error,
263+ ERROR_PARAMS(qname->getStringValue(), ZED(NotAmongInScopeSchemaTypes)),
264+ ERROR_LOC( loc )
265+ );
266 }
267 else
268 {
269
270=== added file 'test/rbkt/ExpQueryResults/zorba/schemas/val-xsiType-noSchemaImport.xml.res'
271--- test/rbkt/ExpQueryResults/zorba/schemas/val-xsiType-noSchemaImport.xml.res 1970-01-01 00:00:00 +0000
272+++ test/rbkt/ExpQueryResults/zorba/schemas/val-xsiType-noSchemaImport.xml.res 2012-03-05 20:55:27 +0000
273@@ -0,0 +1,1 @@
274+xs:integer
275
276=== added file 'test/rbkt/Queries/zorba/schemas/val-xsiType-noSchemaImport.xq'
277--- test/rbkt/Queries/zorba/schemas/val-xsiType-noSchemaImport.xq 1970-01-01 00:00:00 +0000
278+++ test/rbkt/Queries/zorba/schemas/val-xsiType-noSchemaImport.xq 2012-03-05 20:55:27 +0000
279@@ -0,0 +1,11 @@
280+import module namespace schema = "http://www.zorba-xquery.com/modules/schema";
281+
282+schema:schema-type(
283+ data(
284+ validate lax {
285+ <a
286+ xmlns:xs="http://www.w3.org/2001/XMLSchema"
287+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
288+ xsi:type="xs:integer">2</a> }
289+ )
290+)
291
292=== modified file 'test/rbkt/testdriver_common.cpp'
293--- test/rbkt/testdriver_common.cpp 2012-01-11 17:30:25 +0000
294+++ test/rbkt/testdriver_common.cpp 2012-03-05 20:55:27 +0000
295@@ -439,7 +439,7 @@
296
297 assert (lDoc.getNodeKind() == zorba::store::StoreConsts::documentNode);
298 zorba::Item lValidatedDoc;
299- sctx->validate(lDoc, lValidatedDoc, zorba::validate_lax);
300+ sctx->validate(lDoc, lValidatedDoc, zorba::validate_lax_dtd);
301
302 lDocMgr->put(val, lValidatedDoc);
303 lDoc = lDocMgr->document(val);

Subscribers

People subscribed via source and target branches