← Back to team overview

zorba-coders team mailing list archive

[Merge] lp:~zorba-coders/zorba/bug867068-fixErrorXQDY0027 into lp:zorba

 

Cezar Andrei has proposed merging lp:~zorba-coders/zorba/bug867068-fixErrorXQDY0027 into lp:zorba.

Commit message:
Fixes how error XQDY0027 is constructed.

Requested reviews:
  Matthias Brantner (matthias-brantner)
Related bugs:
  Bug #867068 in Zorba: "Incorrect usage of XQDY0027"
  https://bugs.launchpad.net/zorba/+bug/867068

For more details, see:
https://code.launchpad.net/~zorba-coders/zorba/bug867068-fixErrorXQDY0027/+merge/145036

Fixes how error XQDY0027 is constructed.
-- 
https://code.launchpad.net/~zorba-coders/zorba/bug867068-fixErrorXQDY0027/+merge/145036
Your team Zorba Coders is subscribed to branch lp:zorba.
=== modified file 'src/diagnostics/diagnostic_en.xml'
--- src/diagnostics/diagnostic_en.xml	2013-01-19 20:47:55 +0000
+++ src/diagnostics/diagnostic_en.xml	2013-01-25 22:22:25 +0000
@@ -808,6 +808,14 @@
        either \c valid or \c notKnown if validation mode is \c lax.
       </comment>
       <value>"$1": unexpected validity property${: 2}</value>
+
+      <entry key="SerializationElementName_2">
+        <value>"$2": invalid serialization parameters element name must be "serialization parameters"</value>
+      </entry>
+
+      <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>
     </diagnostic>
 
     <diagnostic code="XQDY0041">
@@ -2401,19 +2409,19 @@
     <diagnostic code="ZDDY0037" name="COLLECTION_APPEND_BAD_EDIT">
       <value>"$1": illegal edit in append-only collection</value>
     </diagnostic>
-     
+
     <diagnostic code="ZDDY0038" name="COLLECTION_QUEUE_BAD_EDIT">
       <value>"$1": illegal edit from queue collection</value>
     </diagnostic>
-     
+
     <diagnostic code="ZDDY0039" name="NON_ROOT_NODE_EDIT">
       <value>attempt to edit non-root node in collection "$1"</value>
     </diagnostic>
-     
+
     <diagnostic code="ZDDY0040" name="INCONSISTENT_EDIT">
       <value>attempt to edit an item with a template of a different kind (for example an object with a node).</value>
     </diagnostic>
-     
+
     <diagnostic code="ZDST0001" name="COLLECTION_ALREADY_DECLARED">
       <value>"$1": collection already declared</value>
     </diagnostic>

=== modified file 'src/diagnostics/pregenerated/dict_en.cpp'
--- src/diagnostics/pregenerated/dict_en.cpp	2013-01-19 20:47:55 +0000
+++ src/diagnostics/pregenerated/dict_en.cpp	2013-01-25 22:22:25 +0000
@@ -916,6 +916,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_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\""; },
   { "~XQST0046_BadHexDigit_3", "'$3': invalid hexedecimal digit" },
   { "~XQST0106_CONFLICTING", "conflicting" },
   { "~XQST0106_THE_SAME", "the same" },

=== modified file 'src/diagnostics/pregenerated/dict_zed_keys.h'
--- src/diagnostics/pregenerated/dict_zed_keys.h	2013-01-19 20:47:55 +0000
+++ src/diagnostics/pregenerated/dict_zed_keys.h	2013-01-25 22:22:25 +0000
@@ -55,6 +55,8 @@
 #define ZED_XPDY0002_VariableHasNoValue_2 "~XPDY0002_VariableHasNoValue_2"
 #define ZED_XPDY0002_VariableUndeclared_2 "~XPDY0002_VariableUndeclared_2"
 #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_FTST0009_BadStopWordsLang "~FTST0009_BadStopWordsLang"
 #define ZED_FTST0009_BadStemmerLang "~FTST0009_BadStemmerLang"
 #define ZED_FTST0009_BadThesaurusLang "~FTST0009_BadThesaurusLang"

=== modified file 'src/runtime/parsing_and_serializing/parsing_and_serializing_impl.cpp'
--- src/runtime/parsing_and_serializing/parsing_and_serializing_impl.cpp	2012-10-08 12:09:36 +0000
+++ src/runtime/parsing_and_serializing/parsing_and_serializing_impl.cpp	2013-01-25 22:22:25 +0000
@@ -26,6 +26,9 @@
 #include "runtime/api/plan_iterator_wrapper.h"
 #include "compiler/api/compilercb.h"
 
+#include "diagnostics/assert.h"
+#include "diagnostics/util_macros.h"
+
 #include "store/api/store.h"
 #include "store/api/item.h"
 #include "store/api/item_factory.h"
@@ -74,9 +77,9 @@
       is = iss.get();
     }
 
-    
+
     baseUri = theSctx->get_base_uri();
-    
+
 
     try {
       store::LoadProperties loadProps;
@@ -117,12 +120,10 @@
   if (lElemName->getLocalName() != "serialization-parameters")
   {
     ztd::string_builder lSb;
-    lSb << "the serialization parameters element must have the name \"serialization parameters\". "
-      << "\"" << lElemName->getLocalName() << "\" was found";
-    throw XQUERY_EXCEPTION(
-      err::XQDY0027,
-      ERROR_PARAMS(lSb.str()),
-      ERROR_LOC( aLoc ));
+    lSb << lElemName->getLocalName();
+
+    RAISE_ERROR(err::XQDY0027, aLoc,
+      ERROR_PARAMS(ZED(XQDY0027_SerializationElementName_2), lSb));
   }
 
   // the provided element must be in the correct namespace otherwise
@@ -131,20 +132,12 @@
   if (lElemName->getNamespace() != "http://www.w3.org/2010/xslt-xquery-serialization";)
   {
     ztd::string_builder lSb;
-    zstring lFoundNs("No");
+    zstring lFoundNs("");
     if (lElemName->getNamespace().size() > 0)
-    {
-      lFoundNs = "<";
       lFoundNs += lElemName->getNamespace();
-      lFoundNs += ">";
-    }
 
-    lSb << "the serialization-parameters element must be in the <http://www.w3.org/2010/xslt-xquery-serialization> namespace. "
-      << lFoundNs << " namespace was found";
-    throw XQUERY_EXCEPTION(
-      err::XQDY0027,
-      ERROR_PARAMS(lSb .str()),
-      ERROR_LOC( aLoc ));
+    RAISE_ERROR(err::XQDY0027, aLoc,
+      ERROR_PARAMS(ZED(XQDY0027_SerializationElementNs_2), lFoundNs));
   }
 
 #ifndef ZORBA_NO_XMLSCHEMA

=== modified file 'src/types/schema/SchemaValidatorFilter.cpp'
--- src/types/schema/SchemaValidatorFilter.cpp	2012-09-19 21:16:15 +0000
+++ src/types/schema/SchemaValidatorFilter.cpp	2013-01-25 22:22:25 +0000
@@ -240,7 +240,7 @@
                                         fPrefixBuf,
                                         ElemStack::Mode_Element,
                                         colonPos);
-
+    std::cout << " processStartEvent - : setXsiType" << "\n";
     ((XercSchemaValidator*)fValidator)->setXsiType(fPrefixBuf.getRawBuffer(),
                                                    theXsiType + colonPos + 1,
                                                    atUriId);
@@ -858,6 +858,8 @@
     // Ignore schema location hints
     if(XMLString::equals(localname, SchemaSymbols::fgXSI_TYPE))
     {
+      std::cout << "   svf attrEvent: " << StrX(localname) << "  T: " <<
+                StrX(typeName) << " xsi:type \n";
       theXsiType = curAttr->getValue();
     }
     else if(XMLString::equals(localname, SchemaSymbols::fgATT_NILL) &&
@@ -1083,6 +1085,7 @@
           else
             typeName = SchemaSymbols::fgATTVAL_ANYTYPE;
         }
+        std::cout << " top : theElemDepth:" << theElemDepth << "\n";
       }
     }
   }


Follow ups