Cezar Andrei has proposed merging lp:~zorba-coders/zorba/bug1167400-valType 
into lp:zorba.

Commit message:
Fixes for bug1167400 validate type failures (at least 9)

Requested reviews:
  Zorba Coders (zorba-coders)
Related bugs:
  Bug #1167400 in Zorba: "validate type failures (at least 9)"
  https://bugs.launchpad.net/zorba/+bug/1167400

For more details, see:
https://code.launchpad.net/~zorba-coders/zorba/bug1167400-valType/+merge/160990

Fixes for Fixes for bug1167400 validate type failures (at least 9)
-- 
https://code.launchpad.net/~zorba-coders/zorba/bug1167400-valType/+merge/160990
Your team Zorba Coders is requested to review the proposed merge of 
lp:~zorba-coders/zorba/bug1167400-valType into lp:zorba.
=== modified file 'src/diagnostics/diagnostic_en.xml'
--- src/diagnostics/diagnostic_en.xml	2013-04-23 13:12:58 +0000
+++ src/diagnostics/diagnostic_en.xml	2013-04-25 19:25:31 +0000
@@ -938,6 +938,15 @@
       <entry key="SerializationElementNs_2">
         <value>"$2": invalid namespace for the "serialization-parameters" element; must be "http://www.w3.org/2010/xslt-xquery-serialization";</value>
       </entry>
+
+      <entry key="InvalidValue">
+        <value>"$2": invalid value for type${: 3}${: 4}</value>
+      </entry>
+
+      <entry key="PrefixNotBound">
+        <value>"$2": prefix not bound</value>
+      </entry>
+
     </diagnostic>
 
     <diagnostic code="XQDY0041">

=== modified file 'src/diagnostics/pregenerated/dict_en.cpp'
--- src/diagnostics/pregenerated/dict_en.cpp	2013-04-23 13:12:58 +0000
+++ src/diagnostics/pregenerated/dict_en.cpp	2013-04-25 19:25:31 +0000
@@ -968,6 +968,8 @@
   { "~XPTY0004_NoTypePromote_23", "$2 can not be promoted to type $3" },
   { "~XPTY0117_NodeCast", "Cannot cast node to xs:QName" },
   { "~XPTY0117_NotationParam_23", "$2 can not be promoted to parameter type xs:NOTATION of function $3()" },
+  { "~XQDY0027_InvalidValue", "\"$2\": invalid value for type${: 3}${: 4}" },
+  { "~XQDY0027_PrefixNotBound", "\"$2\": prefix not bound" },
   { "~XQDY0027_SerializationElementName_2", "\"$2\": invalid serialization parameters; element name must be \"serialization-parameters\"" },
   { "~XQDY0027_SerializationElementNs_2", "\"$2\": invalid namespace for the \"serialization-parameters\" element; must be \"http://www.w3.org/2010/xslt-xquery-serialization\""; },
   { "~XQDY0074_NameSapceConstructor", "$2: cannot cast prefix to xs:NCName" },

=== modified file 'src/diagnostics/pregenerated/dict_zed_keys.h'
--- src/diagnostics/pregenerated/dict_zed_keys.h	2013-04-10 02:24:08 +0000
+++ src/diagnostics/pregenerated/dict_zed_keys.h	2013-04-25 19:25:31 +0000
@@ -61,6 +61,8 @@
 #define ZED_XPDY0002_ContextUndeclared_2 "~XPDY0002_ContextUndeclared_2"
 #define ZED_XQDY0027_SerializationElementName_2 "~XQDY0027_SerializationElementName_2"
 #define ZED_XQDY0027_SerializationElementNs_2 "~XQDY0027_SerializationElementNs_2"
+#define ZED_XQDY0027_InvalidValue "~XQDY0027_InvalidValue"
+#define ZED_XQDY0027_PrefixNotBound "~XQDY0027_PrefixNotBound"
 #define ZED_XQDY0074_NotCastToQName "~XQDY0074_NotCastToQName"
 #define ZED_XQDY0074_NoEmptyLocalname "~XQDY0074_NoEmptyLocalname"
 #define ZED_XQDY0074_NameSapceConstructor "~XQDY0074_NameSapceConstructor"

=== modified file 'src/types/schema/EventSchemaValidator.cpp'
--- src/types/schema/EventSchemaValidator.cpp	2013-02-26 04:12:43 +0000
+++ src/types/schema/EventSchemaValidator.cpp	2013-04-25 19:25:31 +0000
@@ -150,7 +150,7 @@
 
 void EventSchemaValidator::ns(const zstring& prefix, const zstring& uri)
 {
-  //cout << "     Ns  : " << prefix << " = '" << uri << "'\n";
+  //cout << "     Ns  : '" << prefix << "'' = '" << uri << "'\n";
 
   XMLChArray prefixVal(prefix.c_str());
   XMLChArray uriVal(uri.c_str());

=== modified file 'src/types/schema/SchemaValidatorFilter.cpp'
--- src/types/schema/SchemaValidatorFilter.cpp	2013-04-04 21:40:06 +0000
+++ src/types/schema/SchemaValidatorFilter.cpp	2013-04-25 19:25:31 +0000
@@ -758,19 +758,26 @@
       }
     }
 
+    int res;
+    if ( theProcessorStipulatedTypeName )
+    {
+      res = -1;
+    }
+    else
+    {
 #if _XERCES_VERSION >= 30000
-    XMLSize_t failingChildNo;
-    bool boolRes = fValidator->checkContent(topElem->fThisElement,
-                                       topElem->fChildren,
-                                       topElem->fChildCount,
-                                       &failingChildNo);
-    int res = boolRes ? -1 /* means success */ : 0 /* means failure */;
-
+      XMLSize_t failingChildNo;
+      bool boolRes = fValidator->checkContent(topElem->fThisElement,
+                                              topElem->fChildren,
+                                              topElem->fChildCount,
+                                              &failingChildNo);
+      res = boolRes ? -1 /* means success */ : 0 /* means failure */;
 #else
-    int res = fValidator->checkContent(topElem->fThisElement,
-                                       topElem->fChildren,
-                                       topElem->fChildCount);
+      res = fValidator->checkContent(topElem->fThisElement,
+                                         topElem->fChildren,
+                                         topElem->fChildCount);
 #endif // _XERCES_VERSION >= 30000
+    }
 
     if(res >= 0)
     {

=== modified file 'src/types/schema/XercSchemaValidator.cpp'
--- src/types/schema/XercSchemaValidator.cpp	2013-02-26 04:12:43 +0000
+++ src/types/schema/XercSchemaValidator.cpp	2013-04-25 19:25:31 +0000
@@ -56,7 +56,7 @@
 #include "StrX.h"
 #include "XercSchemaValidator.h"
 
-using namespace XERCES_CPP_NAMESPACE;
+//using namespace XERCES_CPP_NAMESPACE;
 
 //XERCES_CPP_NAMESPACE_BEGIN
 //XERCES_CPP_NAMESPACE_END

=== modified file 'src/types/schema/schema.cpp'
--- src/types/schema/schema.cpp	2013-04-16 21:12:12 +0000
+++ src/types/schema/schema.cpp	2013-04-25 19:25:31 +0000
@@ -594,8 +594,8 @@
   }
 
   xqtref_t res = createXQTypeFromTypeDefinition(typeManager, typeDef);
-  TRACE("res:" << res->get_qname()->getLocalName() << " @ " <<
-        res->get_qname()->getNamespace());
+  TRACE("res:" << res->getQName()->getLocalName() << " @ " <<
+        res->getQName()->getNamespace());
 
   return res;
 }
@@ -1747,19 +1747,20 @@
       {
         // textValue must be in the form of URI:LOCAL
         size_t colonIndex = textValue.find_first_of(":");
-        zstring prefix = textValue.substr(0, colonIndex).str();
+        zstring prefix = (colonIndex == (size_t)-1 ? zstring("") : textValue.substr(0, colonIndex).str());
         zstring local = textValue.substr(colonIndex+1, textValue.size()).str();
         zstring uri;
 
         if (nsCtx != NULL && nsCtx->findBinding(prefix, uri))
         {
-          XMLChArray xchTextValue(uri.append(":").append(local).str());         
+          //std::cout << "parseUAT: uri:'" << uri << "'  local:'" << local << "'\n"; std::cout.flush();
+          XMLChArray xchTextValue(uri.append(":").append(local).str());
           xsiTypeDV->validate(xchTextValue.get());
         }
         else
         {
-          RAISE_ERROR(err::FORG0001, loc,
-          ERROR_PARAMS(ZED(FORG0001_PrefixNotBound_2), prefix));
+          RAISE_ERROR(err::XQDY0027, loc,
+          ERROR_PARAMS(ZED(XQDY0027_PrefixNotBound), prefix));
         }
       }
       else
@@ -1779,8 +1780,8 @@
     zstring msg;
     transcode(idve.getMessage(), msg);
 
-    RAISE_ERROR(err::FORG0001, loc,
-    ERROR_PARAMS(ZED(FORG0001_NoCastTo_234o),
+    RAISE_ERROR(err::XQDY0027, loc,
+    ERROR_PARAMS(ZED(XQDY0027_InvalidValue),
                  textValue,
                  targetType->toSchemaString(),
                  msg));
@@ -1814,8 +1815,8 @@
   {
     store::Item_t tTypeQName = udXQType->getQName();
 
-    //TRACE("factory '" << baseItem->getStringValue() << "' type "
-    //      << tTypeQName->getStringValue() << "  base:" << baseType->toString());
+    TRACE("factory '" << baseItem->getStringValue() << "' type "
+          << tTypeQName->getStringValue() << "  base:" << baseType->toString());
 
     return GENV_ITEMFACTORY->
            createUserTypedAtomicItem(result, baseItem, tTypeQName);

=== modified file 'test/fots/CMakeLists.txt'
--- test/fots/CMakeLists.txt	2013-04-25 01:27:33 +0000
+++ test/fots/CMakeLists.txt	2013-04-25 19:25:31 +0000
@@ -404,8 +404,8 @@
 EXPECTED_FOTS_FAILURE (prod-SchemaImport cbcl-validated-schema-element-3 0)
 EXPECTED_FOTS_FAILURE (prod-SchemaImport cbcl-validated-schema-element-4 0)
 EXPECTED_FOTS_FAILURE (prod-TypeswitchExpr typeswitch-113 0)
-EXPECTED_FOTS_FAILURE (prod-ValidateExpr validateexpr-38 0)
-EXPECTED_FOTS_FAILURE (prod-ValidateExpr validateexpr-41 0)
+#EXPECTED_FOTS_FAILURE (prod-ValidateExpr validateexpr-38 0)
+#EXPECTED_FOTS_FAILURE (prod-ValidateExpr validateexpr-41 0)
 EXPECTED_FOTS_FAILURE (prod-ValidateExpr validate-as-101 0)
 EXPECTED_FOTS_FAILURE (prod-ValidateExpr validate-as-102 0)
 EXPECTED_FOTS_FAILURE (prod-ValidateExpr validate-as-104 0)

-- 
Mailing list: https://launchpad.net/~zorba-coders
Post to     : zorba-coders@lists.launchpad.net
Unsubscribe : https://launchpad.net/~zorba-coders
More help   : https://help.launchpad.net/ListHelp

Reply via email to