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

Proposed by Cezar Andrei
Status: Superseded
Proposed branch: lp:~zorba-coders/zorba/bug891209-xsiType
Merge into: lp:zorba
Diff against target: 305 lines (+72/-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 (+3/-1)
To merge this branch: bzr merge lp:~zorba-coders/zorba/bug891209-xsiType
Reviewer Review Type Date Requested Status
Matthias Brantner Pending
Markos Zaharioudakis Pending
Review via email: mp+96001@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 : Posted in a previous version of this proposal
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 : Posted in a previous version of this proposal
Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote : Posted in a previous version of this proposal

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

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
=== modified file 'ChangeLog'
--- ChangeLog 2012-03-01 21:22:16 +0000
+++ ChangeLog 2012-03-05 21:09:22 +0000
@@ -58,6 +58,7 @@
58 * Fixed bug with unversioned modules with C++ external functions58 * Fixed bug with unversioned modules with C++ external functions
59 * Fixed bug #878508 (JSON Module not escaping escape characters)59 * Fixed bug #878508 (JSON Module not escaping escape characters)
60 * Fixed bug #912579 (validate-in-place on non-root elements)60 * Fixed bug #912579 (validate-in-place on non-root elements)
61 * Fixed bug #891209 (validation with xsi:type returns untyped)
6162
62version 2.163version 2.1
6364
6465
=== modified file 'include/zorba/static_context_consts.h'
--- include/zorba/static_context_consts.h 2011-10-07 21:22:20 +0000
+++ include/zorba/static_context_consts.h 2012-03-05 21:09:22 +0000
@@ -58,7 +58,7 @@
58/** \brief Revalidation mode as defined in58/** \brief Revalidation mode as defined in
59 * http://www.w3.org/TR/xquery-update-10/#id-revalidation-declaration59 * http://www.w3.org/TR/xquery-update-10/#id-revalidation-declaration
60 */60 */
61typedef enum { validate_skip, validate_lax, validate_strict } validation_mode_t;61typedef enum { validate_skip, validate_lax, validate_lax_dtd, validate_strict } validation_mode_t;
6262
63/** \brief Maintenance mode of an index as defined63/** \brief Maintenance mode of an index as defined
64 * in the XQuery Data Definition Facility64 * in the XQuery Data Definition Facility
6565
=== modified file 'src/api/staticcontextimpl.cpp'
--- src/api/staticcontextimpl.cpp 2012-02-28 20:45:43 +0000
+++ src/api/staticcontextimpl.cpp 2012-03-05 21:09:22 +0000
@@ -1247,6 +1247,9 @@
1247 case validate_lax:1247 case validate_lax:
1248 valMode = StaticContextConsts::lax_validation;1248 valMode = StaticContextConsts::lax_validation;
1249 break;1249 break;
1250 case validate_lax_dtd:
1251 valMode = StaticContextConsts::lax_dtd_validation;
1252 break;
1250 case validate_skip:1253 case validate_skip:
1251 valMode = StaticContextConsts::skip_validation;1254 valMode = StaticContextConsts::skip_validation;
1252 break;1255 break;
12531256
=== modified file 'src/compiler/parser/parse_constants.h'
--- src/compiler/parser/parse_constants.h 2011-06-14 17:26:33 +0000
+++ src/compiler/parser/parse_constants.h 2012-03-05 21:09:22 +0000
@@ -103,6 +103,7 @@
103 {103 {
104 val_strict,104 val_strict,
105 val_lax,105 val_lax,
106 val_dtd_lax,
106 val_typename107 val_typename
107 };108 };
108109
109110
=== modified file 'src/context/static_context.cpp'
--- src/context/static_context.cpp 2012-02-16 14:11:02 +0000
+++ src/context/static_context.cpp 2012-03-05 21:09:22 +0000
@@ -1735,10 +1735,19 @@
1735 store::Item_t typeName;1735 store::Item_t typeName;
1736 QueryLoc loc;1736 QueryLoc loc;
17371737
1738 ParseConstants::validation_mode_t mode =1738 ParseConstants::validation_mode_t mode;
1739 (validationMode == StaticContextConsts::strict_validation ?1739 switch( validationMode )
1740 ParseConstants::val_strict :1740 {
1741 ParseConstants::val_lax );1741 case StaticContextConsts::strict_validation:
1742 mode = ParseConstants::val_strict;
1743 break;
1744 case StaticContextConsts::lax_dtd_validation:
1745 mode = ParseConstants::val_dtd_lax;
1746 break;
1747 case StaticContextConsts::lax_validation:
1748 default:
1749 mode = ParseConstants::val_lax;
1750 }
17421751
1743 return Validator::effectiveValidationValue(validatedResult,1752 return Validator::effectiveValidationValue(validatedResult,
1744 rootElement,1753 rootElement,
17451754
=== modified file 'src/context/static_context_consts.h'
--- src/context/static_context_consts.h 2012-01-11 17:30:25 +0000
+++ src/context/static_context_consts.h 2012-03-05 21:09:22 +0000
@@ -90,6 +90,7 @@
90 validation_unknown,90 validation_unknown,
91 strict_validation,91 strict_validation,
92 lax_validation,92 lax_validation,
93 lax_dtd_validation,
93 skip_validation94 skip_validation
94 };95 };
9596
9697
=== modified file 'src/types/schema/EventSchemaValidator.cpp'
--- src/types/schema/EventSchemaValidator.cpp 2011-08-19 03:26:59 +0000
+++ src/types/schema/EventSchemaValidator.cpp 2012-03-05 21:09:22 +0000
@@ -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 << " - getTypeQName: " << typeName << " @ " << typeUri <<" ";
167167
168 store::Item_t typeQName;168 store::Item_t typeQName;
169 GENV_ITEMFACTORY->createQName(typeQName,169 GENV_ITEMFACTORY->createQName(typeQName,
@@ -172,7 +172,7 @@
172 typeName.localFormOrDefault ("untyped"));172 typeName.localFormOrDefault ("untyped"));
173173
174 //cout << " : " << typeQName->getLocalName() << " @ "174 //cout << " : " << typeQName->getLocalName() << " @ "
175 // << typeQName->getNamespace() <<"\n";175 // << typeQName->getNamespace() <<"\n"; std::cout.flush();
176176
177 return typeQName;177 return typeQName;
178}178}
179179
=== modified file 'src/types/schema/SchemaValidatorFilter.cpp'
--- src/types/schema/SchemaValidatorFilter.cpp 2011-06-14 17:26:33 +0000
+++ src/types/schema/SchemaValidatorFilter.cpp 2012-03-05 21:09:22 +0000
@@ -867,7 +867,7 @@
867 }867 }
868 --theAttrCount; // remove att from the list but still needs to be reported868 --theAttrCount; // remove att from the list but still needs to be reported
869869
870 //cout << " svf attrEvent: " << StrX(localname) << " T: " <<870 //std::cout << " svf attrEvent: " << StrX(localname) << " T: " <<
871 // StrX(typeName) << "\n";871 // StrX(typeName) << "\n";
872 theEventBuffer->attributeEvent(emptyToNull(prefix), emptyToNull(uri),872 theEventBuffer->attributeEvent(emptyToNull(prefix), emptyToNull(uri),
873 localname, value, emptyToNull(typeURI), typeName);873 localname, value, emptyToNull(typeURI), typeName);
@@ -1062,7 +1062,9 @@
1062 {1062 {
1063 const ElemStack::StackElem* topElem = fElemStack.topElement();1063 const ElemStack::StackElem* topElem = fElemStack.topElement();
1064 DatatypeValidator *currentDV = 0;1064 DatatypeValidator *currentDV = 0;
1065 if(topElem->fThisElement->isDeclared())1065 if(topElem->fThisElement->isDeclared() ||
1066 theXsiType // this is when there is no schema import but xsiType is used
1067 )
1066 {1068 {
1067 ComplexTypeInfo *currentTypeInfo = ((XercSchemaValidator*)fValidator)->1069 ComplexTypeInfo *currentTypeInfo = ((XercSchemaValidator*)fValidator)->
1068 getCurrentTypeInfo();1070 getCurrentTypeInfo();
10691071
=== modified file 'src/types/schema/XercSchemaValidator.cpp'
--- src/types/schema/XercSchemaValidator.cpp 2011-06-14 17:26:33 +0000
+++ src/types/schema/XercSchemaValidator.cpp 2012-03-05 21:09:22 +0000
@@ -23,7 +23,6 @@
23// Includes23// Includes
24// ---------------------------------------------------------------------------24// ---------------------------------------------------------------------------
25#include "stdafx.h"25#include "stdafx.h"
26#include "XercSchemaValidator.h"
2726
28#include <xercesc/util/Janitor.hpp>27#include <xercesc/util/Janitor.hpp>
29#include <xercesc/framework/XMLDocumentHandler.hpp>28#include <xercesc/framework/XMLDocumentHandler.hpp>
@@ -54,7 +53,8 @@
5453
5554
56#include "diagnostics/assert.h"55#include "diagnostics/assert.h"
57//#include "StrX.h"56#include "StrX.h"
57#include "XercSchemaValidator.h"
5858
59using namespace XERCES_CPP_NAMESPACE;59using namespace XERCES_CPP_NAMESPACE;
6060
6161
=== modified file 'src/types/schema/validate.cpp'
--- src/types/schema/validate.cpp 2011-09-22 21:50:20 +0000
+++ src/types/schema/validate.cpp 2012-03-05 21:09:22 +0000
@@ -54,7 +54,7 @@
54#include "diagnostics/assert.h"54#include "diagnostics/assert.h"
55#include "zorba/store_consts.h"55#include "zorba/store_consts.h"
5656
57using namespace std;57//using namespace std;
5858
59namespace zorba59namespace zorba
60{60{
@@ -145,15 +145,21 @@
145 //cout << "No schema: isNode() " << sourceNode->isNode() << " nodeKind: "<<145 //cout << "No schema: isNode() " << sourceNode->isNode() << " nodeKind: "<<
146 // sourceNode->getNodeKind() << endl;146 // sourceNode->getNodeKind() << endl;
147147
148 if ( validationMode == ParseConstants::val_strict )148 if ( validationMode == ParseConstants::val_dtd_lax)
149 {149 {
150 throw XQUERY_EXCEPTION( err::XQDY0084, ERROR_LOC( loc ) );150 // when dtd validation enabled avoid using schema object
151 }
152 else
153 {
154 // no schema available - items remain the same
155 result = sourceNode;151 result = sourceNode;
156 return true; 152 return true;
153 }
154 else
155 {
156 // if we got here it basicaly means that there was no import but
157 // validation is used so we need to set up schema in the typeManager anyway
158 // validation has to work for xsiType and built-in types
159
160 TypeManagerImpl *typeManagerImpl = static_cast<TypeManagerImpl*>(typeManager);
161 typeManagerImpl->initializeSchema();
162 schema = typeManager->getSchema();
157 }163 }
158 }164 }
159165
@@ -382,8 +388,8 @@
382 ZORBA_ASSERT(attribute->isNode());388 ZORBA_ASSERT(attribute->isNode());
383 ZORBA_ASSERT(attribute->getNodeKind() == store::StoreConsts::attributeNode);389 ZORBA_ASSERT(attribute->getNodeKind() == store::StoreConsts::attributeNode);
384390
385 //cout << " v - attr: " << attribute->getNodeName()->getLocalName()->391 //cout << " v - attr: " << attribute->getNodeName()->getLocalName() << ":" <<
386 // c_str() << "\n"; cout.flush();392 // attribute->getStringValue() << "\n"; cout.flush();
387393
388 store::Item_t attName = attribute->getNodeName();394 store::Item_t attName = attribute->getNodeName();
389 schemaValidator.attr(attName, attribute->getStringValue());395 schemaValidator.attr(attName, attribute->getStringValue());
@@ -472,9 +478,9 @@
472 {478 {
473 if ( child->isNode() )479 if ( child->isNode() )
474 {480 {
475 //cout << " > child: " << child->getNodeKind() << " " <<481 //cout << " > child: " << (long)child->getNodeKind() << " " <<
476 // (child->getType() != NULL ? child->getType()->getLocalName()482 // //(child->getType() != NULL ? child->getType()->getLocalName() : "type_NULL" ) <<
477 // : "type_NULL" ) << "\n"; cout.flush();483 // "\n"; cout.flush();
478484
479 switch ( child->getNodeKind() )485 switch ( child->getNodeKind() )
480 {486 {
@@ -515,7 +521,7 @@
515 cout << " - text: '" << childStringValue << "' T: " <<521 cout << " - text: '" << childStringValue << "' T: " <<
516 typeQName->getLocalName() << "\n"; cout.flush();522 typeQName->getLocalName() << "\n"; cout.flush();
517 cout << " xqT: " << xqType->toString() << " content_kind: " <<523 cout << " xqT: " << xqType->toString() << " content_kind: " <<
518 xqType->content_kind() << " tKind:" << xqType->type_kind() << " \n";524 (long)xqType->content_kind() << " tKind:" << (long)xqType->type_kind() << " \n";
519 cout.flush();525 cout.flush();
520 }526 }
521 else527 else
@@ -649,9 +655,9 @@
649 xqtref_t type = typeManager->create_named_type(typeQName.getp(),655 xqtref_t type = typeManager->create_named_type(typeQName.getp(),
650 TypeConstants::QUANT_ONE);656 TypeConstants::QUANT_ONE);
651657
652 //cout << " - processTextValue: " << typeQName->getPrefix()->str()658 //cout << " - processTextValue: " << typeQName->getPrefix()
653 // << ":" << typeQName->getLocalName()->str() << "@"659 // << ":" << typeQName->getLocalName() << "@"
654 // << typeQName->getNamespace()->str() ; cout.flush();660 // << typeQName->getNamespace() ; cout.flush();
655 //cout << " type: " << (type==NULL ? "NULL" : type->toString()) << "\n"; cout.flush();661 //cout << " type: " << (type==NULL ? "NULL" : type->toString()) << "\n"; cout.flush();
656662
657 // TODO: we probably need the ns bindings from the static context663 // TODO: we probably need the ns bindings from the static context
658664
=== modified file 'src/types/typemanagerimpl.cpp'
--- src/types/typemanagerimpl.cpp 2012-01-26 19:56:14 +0000
+++ src/types/typemanagerimpl.cpp 2012-03-05 21:09:22 +0000
@@ -336,11 +336,11 @@
336 {336 {
337 if (error != zerr::ZXQP0000_NO_ERROR)337 if (error != zerr::ZXQP0000_NO_ERROR)
338 {338 {
339 throw XQUERY_EXCEPTION_VAR(339 throw XQUERY_EXCEPTION_VAR(
340 error,340 error,
341 ERROR_PARAMS(qname->getStringValue(), ZED(NotAmongInScopeSchemaTypes)),341 ERROR_PARAMS(qname->getStringValue(), ZED(NotAmongInScopeSchemaTypes)),
342 ERROR_LOC( loc )342 ERROR_LOC( loc )
343 );343 );
344 }344 }
345 else345 else
346 {346 {
347347
=== added file 'test/rbkt/ExpQueryResults/zorba/schemas/val-xsiType-noSchemaImport.xml.res'
--- test/rbkt/ExpQueryResults/zorba/schemas/val-xsiType-noSchemaImport.xml.res 1970-01-01 00:00:00 +0000
+++ test/rbkt/ExpQueryResults/zorba/schemas/val-xsiType-noSchemaImport.xml.res 2012-03-05 21:09:22 +0000
@@ -0,0 +1,1 @@
1xs:integer
02
=== added file 'test/rbkt/Queries/zorba/schemas/val-xsiType-noSchemaImport.xq'
--- test/rbkt/Queries/zorba/schemas/val-xsiType-noSchemaImport.xq 1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/schemas/val-xsiType-noSchemaImport.xq 2012-03-05 21:09:22 +0000
@@ -0,0 +1,11 @@
1import module namespace schema = "http://www.zorba-xquery.com/modules/schema";
2
3schema:schema-type(
4 data(
5 validate lax {
6 <a
7 xmlns:xs="http://www.w3.org/2001/XMLSchema"
8 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
9 xsi:type="xs:integer">2</a> }
10 )
11)
012
=== modified file 'test/rbkt/testdriver_common.cpp'
--- test/rbkt/testdriver_common.cpp 2012-01-11 17:30:25 +0000
+++ test/rbkt/testdriver_common.cpp 2012-03-05 21:09:22 +0000
@@ -439,7 +439,9 @@
439439
440 assert (lDoc.getNodeKind() == zorba::store::StoreConsts::documentNode);440 assert (lDoc.getNodeKind() == zorba::store::StoreConsts::documentNode);
441 zorba::Item lValidatedDoc;441 zorba::Item lValidatedDoc;
442 sctx->validate(lDoc, lValidatedDoc, zorba::validate_lax);442 zorba::validation_mode_t validationMode = enableDtd ? zorba::validate_lax_dtd :
443 zorba::validate_lax;
444 sctx->validate(lDoc, lValidatedDoc, validationMode);
443445
444 lDocMgr->put(val, lValidatedDoc);446 lDocMgr->put(val, lValidatedDoc);
445 lDoc = lDocMgr->document(val);447 lDoc = lDocMgr->document(val);

Subscribers

People subscribed via source and target branches