← Back to team overview

zorba-coders team mailing list archive

[Merge] lp:~zorba-coders/zorba/ns-nodes into lp:zorba

 

Markos Zaharioudakis has proposed merging lp:~zorba-coders/zorba/ns-nodes into lp:zorba.

Commit message:
Fixed bug #1188285

Requested reviews:
  Markos Zaharioudakis (markos-za)

For more details, see:
https://code.launchpad.net/~zorba-coders/zorba/ns-nodes/+merge/170942

Fixed bug #1188285
-- 
https://code.launchpad.net/~zorba-coders/zorba/ns-nodes/+merge/170942
Your team Zorba Coders is subscribed to branch lp:zorba.
=== modified file 'src/runtime/core/constructors.cpp'
--- src/runtime/core/constructors.cpp	2013-06-20 09:52:25 +0000
+++ src/runtime/core/constructors.cpp	2013-06-22 11:01:26 +0000
@@ -316,6 +316,7 @@
   zstring baseuri;
   zstring pre;
   zstring ns;
+  const store::NsBindings& localBindings = theLocalBindings->getLocalBindings();
 
   ElementIteratorState* state;
   DEFAULT_STACK_INIT(ElementIteratorState, state, planState);
@@ -385,7 +386,7 @@
                                         typeName,
                                         true,
                                         false,
-                                        theLocalBindings->getLocalBindings(),
+                                        localBindings,
                                         state->baseUri,
                                         false);
   }
@@ -443,6 +444,23 @@
             break;
         }
 
+        if (childKind == store::StoreConsts::namespaceNode)
+        {
+          csize numLocalBindings = localBindings.size();
+
+          for (csize i = 0; i < numLocalBindings; ++i)
+          {
+            const zstring& pre = localBindings[i].first;
+            const zstring& ns = localBindings[i].second;
+
+            if (pre == child->getNamespacePrefix() && ns != child->getNamespaceUri())
+            {
+              RAISE_ERROR(err::XQDY0102, loc,
+              ERROR_PARAMS(child->getNamespaceUri(), pre, ns));
+            }
+          }
+        }
+
         if (child->getParent() != result.getp())
           child->copy(result, copymode);
       }

=== modified file 'src/store/naive/node_items.cpp'
--- src/store/naive/node_items.cpp	2013-06-11 23:38:49 +0000
+++ src/store/naive/node_items.cpp	2013-06-22 11:01:26 +0000
@@ -3412,6 +3412,11 @@
   {
     if (!ns.empty())
     {
+      if (prefix.empty() && theName->getNamespace().empty())
+      {
+        throw XQUERY_EXCEPTION(err::XQDY0102, ERROR_PARAMS(ns2, prefix, ns));
+      }
+
       addLocalBinding(prefix, ns);
       return;
     }

=== modified file 'test/fots/CMakeLists.txt'
--- test/fots/CMakeLists.txt	2013-06-20 12:00:37 +0000
+++ test/fots/CMakeLists.txt	2013-06-22 11:01:26 +0000
@@ -230,7 +230,6 @@
 EXPECTED_FOTS_FAILURE (prod-CastExpr.schema CastAs-ListType-27 1110217)
 EXPECTED_FOTS_FAILURE (prod-CastExpr.schema CastAs-ListType-31 1110217)
 EXPECTED_FOTS_FAILURE (prod-CompDocConstructor K2-ConDocNode-2 1188302)
-EXPECTED_FOTS_FAILURE (prod-CompNamespaceConstructor nscons-042 1188285)
 EXPECTED_FOTS_FAILURE (prod-DirElemContent Constr-cont-charref-2 1130998)
 EXPECTED_FOTS_FAILURE (prod-FunctionCall FunctionCall-007 1114221)
 EXPECTED_FOTS_FAILURE (prod-FunctionCall FunctionCall-008 1114221)


Follow ups