← Back to team overview

zorba-coders team mailing list archive

[Merge] lp:~zorba-coders/zorba/bug-1073978 into lp:zorba

 

Matthias Brantner has proposed merging lp:~zorba-coders/zorba/bug-1073978 into lp:zorba.

Commit message:
fix for bug #1073978 (FOTS: option default ns not supported)

Requested reviews:
  Matthias Brantner (matthias-brantner)
Related bugs:
  Bug #1073978 in Zorba: "FOTS: option default ns not supported"
  https://bugs.launchpad.net/zorba/+bug/1073978

For more details, see:
https://code.launchpad.net/~zorba-coders/zorba/bug-1073978/+merge/138355
-- 
https://code.launchpad.net/~zorba-coders/zorba/bug-1073978/+merge/138355
Your team Zorba Coders is subscribed to branch lp:zorba.
=== modified file 'ChangeLog'
--- ChangeLog	2012-11-20 01:01:49 +0000
+++ ChangeLog	2012-12-06 01:19:22 +0000
@@ -19,6 +19,7 @@
   * Fixed bug in castable expr when the target type is xs:QName.
   * Fixed bug #1062093 (bug in var reference iterators with an associated
     position that is negative)
+  * Fixed bug #1073978 (FOTS: option default ns not supported)
   * Fixed bug #1061222 (bad message for errors in index key type declaration)
   * Fixed bug #1065175 (preceding::node()[1] returns wrong results)
   * Fixed bug #1065321 (following:text() doesn't return results in doc order)

=== modified file 'src/compiler/translator/translator.cpp'
--- src/compiler/translator/translator.cpp	2012-11-20 18:17:10 +0000
+++ src/compiler/translator/translator.cpp	2012-12-06 01:19:22 +0000
@@ -3329,10 +3329,25 @@
       store::Item_t qnameItem;
       zstring value = opt_decl->get_val().str();
 
-      expand_no_default_qname(qnameItem, opt_decl->get_qname(), loc);
+      rchandle<QName> lQName = opt_decl->get_qname();
+      if (lQName->get_namespace().empty() && lQName->get_prefix().empty())
+      {
+        theSctx->expand_qname(
+           qnameItem,
+           static_context::XQUERY_OPTION_NS,
+           "",
+           lQName->get_localname(),
+           lQName->get_location());
+      }
+      else
+      {
+        expand_no_default_qname(qnameItem, lQName, loc);
+        if (qnameItem->getPrefix().empty() && qnameItem->getNamespace().empty())
+        {
+          RAISE_ERROR(err::XPST0081, loc, ERROR_PARAMS(qnameItem->getStringValue()));
+        }
+      }
 
-      if (qnameItem->getPrefix().empty() && qnameItem->getNamespace().empty())
-        RAISE_ERROR(err::XPST0081, loc, ERROR_PARAMS(qnameItem->getStringValue()));
 
       if (qnameItem->getNamespace() == static_context::ZORBA_OPTION_FEATURE_NS &&
           value == "http-uri-resolution")

=== modified file 'src/context/static_context.cpp'
--- src/context/static_context.cpp	2012-12-02 07:25:04 +0000
+++ src/context/static_context.cpp	2012-12-06 01:19:22 +0000
@@ -495,6 +495,10 @@
 "http://www.zorba-xquery.com/options/optimizer";;
 
 const char*
+static_context::XQUERY_OPTION_NS =
+"http://www.w3.org/2011/xquery-options";;
+
+const char*
 static_context::ZORBA_VERSIONING_NS =
 "http://www.zorba-xquery.com/options/versioning";;
 

=== modified file 'src/context/static_context.h'
--- src/context/static_context.h	2012-11-12 17:12:41 +0000
+++ src/context/static_context.h	2012-12-06 01:19:22 +0000
@@ -562,6 +562,7 @@
   static const char* ZORBA_OPTION_WARN_NS;
   static const char* ZORBA_OPTION_FEATURE_NS;
   static const char* ZORBA_OPTION_OPTIM_NS;
+  static const char* XQUERY_OPTION_NS;
   static const char* ZORBA_VERSIONING_NS;
 
 protected:


Follow ups