← Back to team overview

zorba-coders team mailing list archive

[Merge] lp:~zorba-coders/zorba/bug1132937 into lp:zorba

 

Rodolfo Ochoa has proposed merging lp:~zorba-coders/zorba/bug1132937 into lp:zorba.

Commit message:
Fixes for API
- Check for JSONiq usage from all languages API
- Added JSON items to ItemFactory
- Using generated zorba_api.php
- Fix for std::vector usage in Ruby
- Added diagnostic handler on some tests
- Fix on C++ API that prevents to compile to any using the API
- General small-bugfixing and CMAKE script improvement

Requested reviews:
  Cezar Andrei (cezar-andrei)
  Chris Hillery (ceejatec)
Related bugs:
  Bug #1132937 in Zorba: "JSONiq for Language Bindings"
  https://bugs.launchpad.net/zorba/+bug/1132937

For more details, see:
https://code.launchpad.net/~zorba-coders/zorba/bug1132937/+merge/155640

Fixes for API
- Check for JSONiq usage from all languages API
- Added JSON items to ItemFactory
- Using generated zorba_api.php
- Fix for std::vector usage in Ruby
- Added diagnostic handler on some tests
- Fix on C++ API that prevents to compile to any using the API
- General small-bugfixing and CMAKE script improvement
-- 
https://code.launchpad.net/~zorba-coders/zorba/bug1132937/+merge/155640
Your team Zorba Coders is subscribed to branch lp:zorba.
=== modified file 'doc/php/examples/CMakeLists.txt'
--- doc/php/examples/CMakeLists.txt	2013-02-07 17:24:36 +0000
+++ doc/php/examples/CMakeLists.txt	2013-03-27 00:42:25 +0000
@@ -14,30 +14,31 @@
 
 IF(PHP5_FOUND)
 
-  MESSAGE(STATUS "PHP Found and Active!")
-
+  MESSAGE(STATUS "PHP Found, installing examples...")
+  
   SET(phpPath ${CMAKE_BINARY_DIR}/swig/php)
-  MESSAGE(STATUS "PHP Path:" ${phpPath})
   IF (MSVC_IDE)
     SET(phpExtensionPath ${CMAKE_BINARY_DIR}/swig/php/@CMAKE_BUILD_TYPE@)
   ELSE (MSVC_IDE)
     SET(phpExtensionPath ${CMAKE_BINARY_DIR}/swig/php)
   ENDIF (MSVC_IDE)
-  MESSAGE(STATUS "PHP Extension Path: " ${phpExtensionPath})
-  SET(phpIncludePath ${CMAKE_BINARY_DIR}/swig/php)
-  MESSAGE(STATUS "PHP Include Path: " ${phpExtensionPath})
+  SET(phpIncludePath ${CMAKE_BINARY_DIR}/swig/php/Zorba)
+  
+  IF (WIN32)
+    STRING(REGEX REPLACE "/" "\\\\" phpExtensionPath "${phpExtensionPath}")
+    STRING(REGEX REPLACE "/" "\\\\" phpPath "${phpPath}")
+    STRING(REGEX REPLACE "/" "\\\\" phpIncludePath "${phpIncludePath}")
+  ENDIF (WIN32)
+  
   CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/php.ini.in ${CMAKE_CURRENT_BINARY_DIR}/php.ini)
-  MESSAGE(STATUS "Configuration file: " ${CMAKE_CURRENT_BINARY_DIR}/php.ini)
   CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/simple.php.in ${CMAKE_CURRENT_BINARY_DIR}/simple.php)
-  MESSAGE(STATUS "Simple configuration file: " ${CMAKE_CURRENT_BINARY_DIR}/simple.php)
   CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/test.php.in ${CMAKE_CURRENT_BINARY_DIR}/test.php)
-  MESSAGE(STATUS "PHP test  file configured: " ${CMAKE_CURRENT_BINARY_DIR}/test.php)
-  ADD_TEST("php1" ${PHP5_EXECUTABLE} -c ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_BINARY_DIR}/simple.php)
-  MESSAGE(STATUS "Installing: " ${CMAKE_CURRENT_BINARY_DIR}/simple.php)
+  
+  IF (NOT WIN32)  #Disabled, on windows there is a bug in php - Segfault within Try..Catch
+    ADD_TEST("php1" ${PHP5_EXECUTABLE} -c ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_BINARY_DIR}/simple.php)
+  ENDIF (NOT WIN32)
+    
   ADD_TEST("php2" ${PHP5_EXECUTABLE} -c ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_BINARY_DIR}/test.php)
-
-  MESSAGE(STATUS "Installing: " ${CMAKE_CURRENT_BINARY_DIR}/test.php)
-  
   
   INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/simple.php ${CMAKE_CURRENT_BINARY_DIR}/test.php
           COMPONENT "php_examples"

=== modified file 'doc/php/examples/php.ini.in'
--- doc/php/examples/php.ini.in	2013-02-07 17:24:36 +0000
+++ doc/php/examples/php.ini.in	2013-03-27 00:42:25 +0000
@@ -1,3 +1,3 @@
 enable_dl=On
 extension_dir=@phpExtensionPath@
-include_path=".:@phpIncludePath@"
\ No newline at end of file
+include_path="@phpIncludePath@"
\ No newline at end of file

=== modified file 'doc/php/examples/simple.php.in'
--- doc/php/examples/simple.php.in	2013-02-07 17:24:36 +0000
+++ doc/php/examples/simple.php.in	2013-03-27 00:42:25 +0000
@@ -14,7 +14,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-require '@phpPath@/Zorba/zorba_api_wrapper.php';
+require 'zorba_api_wrapper.php';
 
 function example_1(Zorba $aZorba)
 {

=== modified file 'doc/php/examples/test.php.in'
--- doc/php/examples/test.php.in	2012-01-18 08:31:25 +0000
+++ doc/php/examples/test.php.in	2013-03-27 00:42:25 +0000
@@ -14,7 +14,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-require '@phpPath@/Zorba/XQueryProcessor.php';
+require 'XQueryProcessor.php';
 
 function omitXMLDecl($xml)
 {

=== removed file 'doc/php/examples/zorba_api.php'
--- doc/php/examples/zorba_api.php	2013-02-07 17:24:36 +0000
+++ doc/php/examples/zorba_api.php	1970-01-01 00:00:00 +0000
@@ -1,178 +0,0 @@
-<?php
-/*
- * Copyright 2006-2012 The FLWOR Foundation.
- * 
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * 
- * http://www.apache.org/licenses/LICENSE-2.0
- * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-// Try to load our extension if it's not already loaded.
-if (!extension_loaded("zorba_api")) {
-  if (strtolower(substr(PHP_OS, 0, 3)) === 'win') {
-    if (!dl('zorba_api.dll')) return;
-  } else {
-    // PHP_SHLIB_SUFFIX is available as of PHP 4.3.0, for older PHP assume 'so'.
-    // It gives 'dylib' on MacOS X which is for libraries, modules are 'so'.
-    if (PHP_SHLIB_SUFFIX === 'PHP_SHLIB_SUFFIX' || PHP_SHLIB_SUFFIX === 'dylib') {
-      if (!dl('zorba_api.so')) return;
-    } else {
-      if (!dl('zorba_api.'.PHP_SHLIB_SUFFIX)) return;
-    }
-  }
-}
-
-class Item {
-  public $_cPtr=null;
-
-  static function createEmptyItem() {
-    $r=Item_createEmptyItem();
-    return is_resource($r) ? new Item($r) : $r;
-  }
-
-  function getStringValue() {
-    return Item_getStringValue($this->_cPtr);
-  }
-
-  function __construct() {
-    $this->_cPtr=new_Item();
-  }
-}
-
-class Iterator {
-  public $_cPtr=null;
-
-  function open() {
-    Iterator_open($this->_cPtr);
-  }
-
-  function next($arg1) {
-    return Iterator_next($this->_cPtr,$arg1);
-  }
-
-  function close() {
-    Iterator_close($this->_cPtr);
-  }
-
-  function destroy() {
-    Iterator_destroy($this->_cPtr);
-  }
-
-  function __construct($cPtr) {
-    $this->_cPtr=$cPtr;
-  }
-
-  public function __destruct() {
-    $this->destroy();
-  }
-}
-
-class XQuery {
-  public $_cPtr=null;
-
-  function execute() {
-    return XQuery_execute($this->_cPtr);
-  }
-
-  function isUpdateQuery() {
-    return XQuery_isUpdateQuery($this->_cPtr);
-  }
-
-  function applyUpdates() {
-    XQuery_applyUpdates($this->_cPtr);
-  }
-
-  function destroy() {
-    XQuery_destroy($this->_cPtr);
-  }
-
-  function iterator() {
-    $r=XQuery_iterator($this->_cPtr);
-    return is_resource($r) ? new Iterator($r) : $r;
-  }
-
-  function __construct($cPtr) {
-    $this->_cPtr=$cPtr;
-  }
-
-  function __destruct() {
-    $this->destroy();
-  }
-}
-
-class Store {
-  //public $_cPtr=null;
-
-  //function __construct() {
-  //  $this->_cPtr=new_Store();
-  //}
-}
-
-class InMemoryStore extends Store {
-  public $_cPtr=null;
-
-  static function getInstance() {
-    $r=InMemoryStore_getInstance();
-    return is_resource($r) ? new InMemoryStore($r) : $r;
-  }
-
-  static function shutdown($arg1) {
-    InMemoryStore_shutdown($arg1);
-  }
-
-  private function __construct($cPtr) {
-    $this->_cPtr=$cPtr;
-  }
-}
-
-class XmlDataManager {
-  public $_cPtr=null;
-
-  function loadDocument($aName,$aContent) {
-    XmlDataManager_loadDocument($this->_cPtr,$aName,$aContent);
-  }
-
-  function deleteDocument($aName) {
-    return XmlDataManager_deleteDocument($this->_cPtr,$aName);
-  }
-
-  function __construct($cPtr) {
-    $this->_cPtr=$cPtr;
-  }
-}
-
-class Zorba {
-  public $_cPtr=null;
-
-  static function getInstance($arg1) {
-    $r=Zorba_getInstance($arg1->_cPtr);
-    return is_resource($r) ? new Zorba($r) : $r;
-  }
-
-  function compileQuery($aStr) {
-    $r=Zorba_compileQuery($this->_cPtr,$aStr);
-    return is_resource($r) ? new XQuery($r) : $r;
-  }
-
-  function getXmlDataManager() {
-    $r=Zorba_getXmlDataManager($this->_cPtr);
-    return is_resource($r) ? new XmlDataManager($r) : $r;
-  }
-
-  function shutdown() {
-    Zorba_shutdown($this->_cPtr);
-  }
-
-  private function __construct($cPtr) {
-    $this->_cPtr=$cPtr;
-  }
-}
-?>

=== modified file 'include/zorba/internal/diagnostic.h'
--- include/zorba/internal/diagnostic.h	2013-02-26 04:12:43 +0000
+++ include/zorba/internal/diagnostic.h	2013-03-27 00:42:25 +0000
@@ -201,6 +201,7 @@
   column_type column_end_;
 
   friend bool operator==( location const&, location const& );
+  friend bool operator!=( location const&, location const& );
 
   // for plan serialization
   friend void serialization::operator&( serialization::Archiver&, location& );
@@ -224,9 +225,7 @@
  * @param j The second location.
  * @return Returns \c true only if the two locations are not equal.
  */
-inline bool operator!=( location const &i, location const &j ) {
-  return !(i == j);
-}
+bool operator!=( location const &i, location const &j );
 
 ///////////////////////////////////////////////////////////////////////////////
 

=== modified file 'include/zorba/xquery_exception.h'
--- include/zorba/xquery_exception.h	2013-02-26 04:12:43 +0000
+++ include/zorba/xquery_exception.h	2013-03-27 00:42:25 +0000
@@ -295,7 +295,7 @@
    * @return Returns \a true only if stack traces will be included.
    */
   static bool get_print_trace( std::ostream &o ) {
-    return static_cast<print_trace>( o.iword( get_ios_trace_index() ) );
+    return !!( o.iword( get_ios_trace_index() ) );
   }
 
   /**
@@ -404,7 +404,7 @@
  */
 inline std::ostream& operator<<( std::ostream &o,
                                  XQueryException::print_trace t ) {
-  XQueryException::set_print_trace( o, t );
+  XQueryException::set_print_trace( o, !!t );
   return o;
 }
 

=== modified file 'src/diagnostics/diagnostic.cpp'
--- src/diagnostics/diagnostic.cpp	2013-02-26 04:12:43 +0000
+++ src/diagnostics/diagnostic.cpp	2013-03-27 00:42:25 +0000
@@ -177,6 +177,10 @@
 
 location const location::empty;
 
+bool operator!=( location const &i, location const &j ) {
+  return !(i == j);
+}
+
 bool operator==( location const &i, location const &j ) {
   return i.file_       == j.file_
       && i.line_       == j.line_

=== modified file 'src/precompiled/stdafx.h'
--- src/precompiled/stdafx.h	2013-02-07 17:24:36 +0000
+++ src/precompiled/stdafx.h	2013-03-27 00:42:25 +0000
@@ -44,7 +44,6 @@
   #include "compiler/parser/parse_constants.h"
   #include "zorbautils/checked_vector.h"
   #include "compiler/parser/xquery_driver.h"
-  #include "util/sorter.h"
   #include "compiler/xqueryx/xqueryx_to_xquery.h"
   #include <zorba/store_manager.h>
   #include <zorba/xquery.h>

=== modified file 'src/unit_tests/test_mem_sizeof.cpp'
--- src/unit_tests/test_mem_sizeof.cpp	2013-02-05 04:00:09 +0000
+++ src/unit_tests/test_mem_sizeof.cpp	2013-03-27 00:42:25 +0000
@@ -14,6 +14,7 @@
  * limitations under the License.
  */
 
+#include "stdafx.h"
 #include <iostream>
 #include <string>
 

=== modified file 'swig/Config.h'
--- swig/Config.h	2012-08-06 22:08:44 +0000
+++ swig/Config.h	2013-03-27 00:42:25 +0000
@@ -18,5 +18,4 @@
 
 #define ZORBA_STREAM_BUFFER_SIZE @ZORBA_STREAM_BUFFER_SIZE@
 
-
 #endif
\ No newline at end of file

=== modified file 'swig/DiagnosticHandler.i'
--- swig/DiagnosticHandler.i	2013-02-07 17:24:36 +0000
+++ swig/DiagnosticHandler.i	2013-03-27 00:42:25 +0000
@@ -20,11 +20,11 @@
 
   void DiagnosticHandler::error (const zorba::ZorbaException &ze) 
   {
-    if ( zorba::XQueryException const *xe = dynamic_cast<zorba::XQueryException const*>( &ze ) ) {
+    if (zorba::XQueryException const *xe = dynamic_cast<zorba::XQueryException const*>( &ze )) {
       const XQueryException xe2(xe);
       error(xe2); 
     }
-    if ( zorba::UserException const *ue = dynamic_cast<zorba::UserException const*>( &ze ) ) {
+    if (zorba::UserException const *ue = dynamic_cast<zorba::UserException const*>( &ze )) {
       const UserException ue2(ue);
       error(ue2); 
     }

=== modified file 'swig/DynamicContext.h'
--- swig/DynamicContext.h	2013-02-07 17:24:36 +0000
+++ swig/DynamicContext.h	2013-03-27 00:42:25 +0000
@@ -36,14 +36,14 @@
   DynamicContext(const DynamicContext& aCtx):theContext(aCtx.theContext) {}
   DynamicContext(zorba::DynamicContext* aCtx):theContext(aCtx) {}
 
-  bool 	getContextItem (Item& aItem);
+  bool  getContextItem (Item& aItem);
 
   /** \brief Retrieve the dateTime Item used at the time the query is executed
    *         (see setCurrentDateTime()).
    *
    * @return Item the dateTime Item used at the time the query is executed.
    */
-  Item 	getCurrentDateTime ();
+  Item  getCurrentDateTime ();
 
   /** \brief Return the value of the default collection that is used when calling the
    *         fn:collection function without a parameter.
@@ -51,7 +51,7 @@
    * @return Item the default collection that is set in this dynamic context.
    * @throw ZorbaException if an error occured.
    */
-  Item 	getDefaultCollection ();
+  Item  getDefaultCollection ();
 
   /** \brief Retrieve the implicit timezone used in comparisons or arithmetic operations
    *         of date, time, or dateTime values.
@@ -60,7 +60,7 @@
    *         and an DiagnosticHandler is used.
    * @throw ZorbaException if an error occured.
    */
-  int 	getImplicitTimezone ();
+  int  getImplicitTimezone ();
 
   /** \brief Returns the current value of an external
    * variable. Exactly one of the two return values (aItem or
@@ -78,7 +78,7 @@
    * @return true if the variable has been retrieved successfully, false otherwise.
    * @throw ZorbaException if an error occured.
    */
-  bool 	getVariable (const std::string& aNamespace, const std::string& aLocalname, Item& aItem, Iterator& aIterator);
+  bool  getVariable (const std::string& aNamespace, const std::string& aLocalname, Item& aItem, Iterator& aIterator);
   
   /** \brief Defines the context item.
    *

=== modified file 'swig/DynamicContext.i'
--- swig/DynamicContext.i	2013-02-07 17:24:36 +0000
+++ swig/DynamicContext.i	2013-03-27 00:42:25 +0000
@@ -25,10 +25,10 @@
   Item DynamicContext::getDefaultCollection () {
     return Item(theContext->getDefaultCollection());
   }
-  int 	DynamicContext::getImplicitTimezone (){
+  int  DynamicContext::getImplicitTimezone (){
     return theContext->getImplicitTimezone();
   }
-  bool 	DynamicContext::getVariable (const std::string& aNamespace, const std::string& aLocalname, Item& aItem, Iterator& aIterator) {
+  bool  DynamicContext::getVariable (const std::string& aNamespace, const std::string& aLocalname, Item& aItem, Iterator& aIterator) {
     return theContext->getVariable(aNamespace, aLocalname, aItem.theItem, aIterator.theIterator);
   }
 

=== modified file 'swig/Exceptions.i'
--- swig/Exceptions.i	2013-02-07 17:24:36 +0000
+++ swig/Exceptions.i	2013-03-27 00:42:25 +0000
@@ -115,9 +115,9 @@
  private:
   XQueryException();
  public:
-  virtual unsigned int 	getColumnBegin () const;
-  virtual unsigned int 	getLineBegin () const;
-  virtual std::string 	getQueryURI () const;
+  virtual unsigned int  getColumnBegin () const;
+  virtual unsigned int  getLineBegin () const;
+  virtual std::string   getQueryURI () const;
 };
 
 /* vim:set et sw=2 ts=2: */

=== modified file 'swig/Item.h'
--- swig/Item.h	2013-02-07 17:24:36 +0000
+++ swig/Item.h	2013-03-27 00:42:25 +0000
@@ -159,7 +159,7 @@
    * @return Item the int value of the Item.
    * @throw ZorbaException if an error occured.
    */
-  double 	getDoubleValue () const;
+  double  getDoubleValue () const;
 
   /** \brief Get the long value of the Item.
    *
@@ -211,7 +211,7 @@
    * @return element or document parent node of this node.
    * @throw ZorbaException if an error occured, e.g. the Item is not of type node.
    */
-  Item 	getParent () const;
+  Item  getParent () const;
 
   /** \brief Get the (optional) value of a QName's prefix.
    *

=== modified file 'swig/Item.i'
--- swig/Item.i	2013-02-07 17:24:36 +0000
+++ swig/Item.i	2013-03-27 00:42:25 +0000
@@ -60,7 +60,7 @@
   int Item::getIntValue () const
   { return theItem.getIntValue(); }
 
-  double 	Item::getDoubleValue () const
+  double  Item::getDoubleValue () const
   { return theItem.getDoubleValue(); }
 
   long long Item::getLongValue () const
@@ -89,7 +89,7 @@
   bool Item::getNodeName (Item &aNodeName) const
   { return theItem.getNodeName( aNodeName.theItem ); }
 
-  Item 	Item::getParent () const
+  Item  Item::getParent () const
   { return theItem.getParent(); }
 
   std::string Item::getPrefix () const

=== modified file 'swig/ItemFactory.h'
--- swig/ItemFactory.h	2013-02-07 17:24:36 +0000
+++ swig/ItemFactory.h	2013-03-27 00:42:25 +0000
@@ -40,7 +40,7 @@
        * @param aURI String representation of the AnyURI.
        * @return The AnyURI Item.
        */
-    Item 	createAnyURI (const std::string &aURI);
+    Item  createAnyURI (const std::string &aURI);
 
       /**
       * Create a new attribute node N and place it among the
@@ -57,10 +57,9 @@
       * @param aTypedValue The typed value of the new node.
       * @return            The new node N created by this method
       */
-    Item 	createAttributeNode (Item& aParent, Item& aNodeName, Item& aTypeName, Item& aTypedValue);
-#ifndef SWIGRUBY
-    Item 	createAttributeNode (Item& aParent, Item& aNodeName, Item& aTypeName, std::vector< Item > aTypedValue);
-#endif
+    Item  createAttributeNode (Item& aParent, Item& aNodeName, Item& aTypeName, Item& aTypedValue);
+
+    Item  createAttributeNode (Item& aParent, Item& aNodeName, Item& aTypeName, std::vector< Item > aTypedValue);
 
       /** \brief Creates a Base64Binary Item
        *         see [http://www.w3.org/TR/xmlschema-2/#base64Binary]
@@ -69,7 +68,7 @@
        * @param aLength the length of the base64 binary data.
        * @return The Base64Binary Item.
        */
-    Item 	createBase64Binary (const char *aBinData, size_t aLength);
+    Item  createBase64Binary (const char *aBinData, size_t aLength);
 
       /** \brief Creates a Base64Binary Item
        *         see [http://www.w3.org/TR/xmlschema-2/#base64Binary]
@@ -77,7 +76,7 @@
        * @param aStream A stream containing the Base64 encoded data.
        * @return the Base64Binary Item.
        */
-    Item 	createBase64Binary (std::istream &aStream);
+    Item  createBase64Binary (std::istream &aStream);
 
       /** \brief Creates a Base64Binary Item
        *         see [http://www.w3.org/TR/xmlschema-2/#base64Binary]
@@ -86,7 +85,7 @@
        * @param aLength the length of the data
        * @return the Base64Binary Item.
        */
-    Item 	createBase64Binary (const unsigned char *aBinData, size_t aLength);
+    Item  createBase64Binary (const unsigned char *aBinData, size_t aLength);
 
       /** \brief Creates a Boolean Item
        *         see [http://www.w3.org/TR/xmlschema-2/#bool]
@@ -94,7 +93,7 @@
        * @param aValue bool representation of the Boolean.
        * @return The Boolean Item.
        */
-    Item 	createBoolean (bool aValue);
+    Item  createBoolean (bool aValue);
 
       /** \brief Creates a Byte Item
        *         see [http://www.w3.org/TR/xmlschema-2/#byte]
@@ -102,7 +101,7 @@
        * @param aByte char representation of the Byte.
        * @return The Byte Item.
        */
-    Item 	createByte (char aByte);
+    Item  createByte (char aByte);
 
       /**
        * Create a new comment node N and place it as the last child of a given
@@ -113,7 +112,7 @@
        * @param aContent The content of the new node.
        * @return        The new node N created by this method
        */
-    Item 	createCommentNode (Item &aParent, const std::string &aContent);
+    Item  createCommentNode (Item &aParent, const std::string &aContent);
 
       /** \brief Creates a Date Item
        *         see [http://www.w3.org/TR/xmlschema-2/#date]
@@ -121,7 +120,7 @@
        * @param aDate String representation of the Date (e.g. 2002-10-10).
        * @return The Date Item.
        */
-    Item 	createDate (const std::string &aDate);
+    Item  createDate (const std::string &aDate);
 
       /** \brief Creates a Date Item
        *         see [http://www.w3.org/TR/xmlschema-2/#date]
@@ -131,7 +130,7 @@
        * @param aDay short-valued representation of the day.
        * @return The Date Item.
        */
-    Item 	createDate (short aYear, short aMonth, short aDay);
+    Item  createDate (short aYear, short aMonth, short aDay);
 
       /** \brief Creates a DateTime Item
        *         see [http://www.w3.org/TR/xmlschema-2/#dateTime]
@@ -140,7 +139,7 @@
        *        (for example, 2002-10-10T12:00:00-05:00).
        * @return The DateTime Item.
        */
-    Item 	createDateTime (const std::string &aDateTimeValue);
+    Item  createDateTime (const std::string &aDateTimeValue);
 
       /** \brief Creates a DateTime Item
        *         see [http://www.w3.org/TR/xmlschema-2/#dateTime]
@@ -154,7 +153,7 @@
        * @param aTimeZone_hours short-valued representation of the difference in hours to UTC.
        * @return The DateTime Item.
        */
-    Item 	createDateTime (short aYear, short aMonth, short aDay, short aHour, short aMinute, double aSecond, short aTimeZone_hours);
+    Item  createDateTime (short aYear, short aMonth, short aDay, short aHour, short aMinute, double aSecond, short aTimeZone_hours);
 
       /** \brief Creates a Decimal Item
        *         see [http://www.w3.org/TR/xmlschema-2/#decimal]
@@ -162,7 +161,7 @@
        * @param aValue String representation of the Decimal (e.g. 12678967.543233).
        * @return The Decimal Item.
        */
-    Item 	createDecimal (const std::string &aValue);
+    Item  createDecimal (const std::string &aValue);
 
       /** \brief Creates a Decimal Item
        *         see [http://www.w3.org/TR/xmlschema-2/#decimal]
@@ -170,7 +169,7 @@
        * @param aValue double representation of the Decimal.
        * @return The Decimal Item.
        */
-    Item 	createDecimalFromDouble (double aValue);
+    Item  createDecimalFromDouble (double aValue);
 
       /** \brief Creates a Decimal Item
        *         see [http://www.w3.org/TR/xmlschema-2/#decimal]
@@ -178,7 +177,7 @@
        * @param aValue unsigned long representation of the Decimal.
        * @return The Decimal Item.
        */
-    Item 	createDecimalFromLong (unsigned long aValue);
+    Item  createDecimalFromLong (unsigned long aValue);
 
       /** \brief Creates a Double Item
        *         see [http://www.w3.org/TR/xmlschema-2/#double]
@@ -186,7 +185,7 @@
        * @param aValue String representation of the Double.
        * @return The Double Item.
        */
-    Item 	createDouble (const std::string &aValue);
+    Item  createDouble (const std::string &aValue);
 
       /** \brief Creates a Double Item
        *         see [http://www.w3.org/TR/xmlschema-2/#double]
@@ -194,7 +193,7 @@
        * @param aValue double representation of the Double.
        * @return The Double Item.
        */
-    Item 	createDouble (double aValue);
+    Item  createDouble (double aValue);
 
       /** \brief Creates a Duration Item
        *         see [http://www.w3.org/TR/xmlschema-2/#duration]
@@ -202,7 +201,7 @@
        * @param aValue String representation of the NCName.
        * @return The Duration Item.
        */
-    Item 	createDuration (const std::string &aValue);
+    Item  createDuration (const std::string &aValue);
 
       /** \brief Creates a Duration Item
        *         see [http://www.w3.org/TR/xmlschema-2/#duration]
@@ -215,7 +214,7 @@
        * @param aSeconds double-valued representation of the seconds and fractional seconds.
        * @return The Duration Item.
        */
-    Item 	createDuration (short aYear, short aMonths, short aDays, short aHours, short aMinutes, double aSeconds);
+    Item  createDuration (short aYear, short aMonths, short aDays, short aHours, short aMinutes, double aSeconds);
 
       /** \brief Creates a dayTimeDuration Item
        *         see [http://www.w3.org/TR/xpath-functions/#duration-subtypes]
@@ -223,7 +222,7 @@
        * @param aValue String lexical representation of the duration.
        * @return the dayTimeDuration Item.
        */
-    Item 	createDayTimeDuration (const std::string &aValue);
+    Item  createDayTimeDuration (const std::string &aValue);
 
       /** \brief Creates a yearMonthDuration Item
        *         see [http://www.w3.org/TR/xpath-functions/#duration-subtypes]
@@ -231,7 +230,7 @@
        * @param aValue String lexical representation of the duration.
        * @return the yearMonthDuration Item.
        */
-    Item 	createYearMonthDuration (const std::string &aValue);
+    Item  createYearMonthDuration (const std::string &aValue);
 
       /** \brief Creates a documentNode Item
        *         see [http://www.w3.org/TR/xpath-functions/#duration-subtypes]
@@ -240,8 +239,8 @@
        * @param aDocUri String representation of the Document URI.
        * @return the documentNode Item.
        */
-    Item 	createDocumentNode (const std::string &aBaseUri, const std::string &aDocUri);
-#ifndef SWIGRUBY
+    Item  createDocumentNode (const std::string &aBaseUri, const std::string &aDocUri);
+
       /**
       * @brief Creates a new element node.
       *
@@ -264,8 +263,7 @@
       *                       property of P.
       * @return               The new node N created by this method
       */
-    Item 	createElementNode (Item &aParent, Item &aNodeName, Item &aTypeName, bool aHasTypedValue, bool aHasEmptyValue, std::vector< std::pair< std::string, std::string > > aNsBindings);
-#endif
+    Item  createElementNode (Item &aParent, Item &aNodeName, Item &aTypeName, bool aHasTypedValue, bool aHasEmptyValue, std::vector< std::pair< std::string, std::string > > aNsBindings);
 
       /**
       * @brief Creates a new element node.
@@ -286,7 +284,7 @@
       *                       complex type with empty content.
       * @return               The new node N created by this method
       */
-    Item 	createElementNode (Item &aParent, Item &aNodeName, Item &aTypeName, bool aHasTypedValue, bool aHasEmptyValue);
+    Item  createElementNode (Item &aParent, Item &aNodeName, Item &aTypeName, bool aHasTypedValue, bool aHasEmptyValue);
 
       /** \brief creates a float item
        *         see [http://www.w3.org/tr/xmlschema-2/#float]
@@ -294,7 +292,7 @@
        * @param aValue string representation of the float.
        * @return the float item.
        */
-    Item 	createFloat (const std::string &aValue);
+    Item  createFloat (const std::string &aValue);
 
       /** \brief creates a float item
        *         see [http://www.w3.org/tr/xmlschema-2/#float]
@@ -302,7 +300,7 @@
        * @param aValue float representation of the float.
        * @return the float item.
        */
-    Item 	createFloat (float aValue);
+    Item  createFloat (float aValue);
 
       /** \brief Creates a gDay Item
        *         see [http://www.w3.org/TR/xmlschema-2/#gDay]
@@ -310,7 +308,7 @@
        * @param aValue String representation of the gDay.
        * @return The gDay Item.
        */
-    Item 	createGDay (const std::string &aValue);
+    Item  createGDay (const std::string &aValue);
 
       /** \brief Creates a gDay Item
        *         see [http://www.w3.org/TR/xmlschema-2/#gDay]
@@ -318,7 +316,7 @@
        * @param aDay short representation of the gDay.
        * @return The gDay Item.
        */
-    Item 	createGDay (short aDay);
+    Item  createGDay (short aDay);
 
       /** \brief Creates a gMonth Item
        *         see [http://www.w3.org/TR/xmlschema-2/#gMonth]
@@ -326,7 +324,7 @@
        * @param aValue String representation of the gMonth.
        * @return The gMonth Item.
        */
-    Item 	createGMonth (const std::string &aValue);
+    Item  createGMonth (const std::string &aValue);
 
       /** \brief Creates a gMonth Item
        *         see [http://www.w3.org/TR/xmlschema-2/#gMonth]
@@ -334,7 +332,7 @@
        * @param aMonth short representation of the gMonth.
        * @return The gMonth Item.
        */
-    Item 	createGMonth (short aMonth);
+    Item  createGMonth (short aMonth);
 
       /** \brief Creates a gMonthDay Item
        *         see [http://www.w3.org/TR/xmlschema-2/#gMonthDay]
@@ -342,7 +340,7 @@
        * @param aValue String representation of the gMonthDay.
        * @return The gMonthDay Item.
        */
-    Item 	createGMonthDay (const std::string &aValue);
+    Item  createGMonthDay (const std::string &aValue);
 
       /** \brief Creates a gMonthDay Item
        *         see [http://www.w3.org/TR/xmlschema-2/#gMonthDay]
@@ -351,7 +349,7 @@
        * @param aDay short representation of the day.
        * @return The gMonthDay Item.
        */
-    Item 	createGMonthDay (short aMonth, short aDay);
+    Item  createGMonthDay (short aMonth, short aDay);
 
       /** \brief Creates a gYear Item
        *         see [http://www.w3.org/TR/xmlschema-2/#gYear]
@@ -359,7 +357,7 @@
        * @param aYear short representation of the gYear.
        * @return The gYear Item.
        */
-    Item 	createGYear (short aYear);
+    Item  createGYear (short aYear);
 
       /** \brief Creates a gYear Item
        *         see [http://www.w3.org/TR/xmlschema-2/#gYear]
@@ -367,7 +365,7 @@
        * @param aValue String representation of the gYear.
        * @return The gYear Item.
        */
-    Item 	createGYear (const std::string &aValue);
+    Item  createGYear (const std::string &aValue);
 
       /** \brief Creates a gYearMonth Item
        *         see [http://www.w3.org/TR/xmlschema-2/#gYearMonth]
@@ -375,7 +373,7 @@
        * @param aValue String representation of the gYearMonth.
        * @return The gYearMonth Item.
        */
-    Item 	createGYearMonth (const std::string &aValue);
+    Item  createGYearMonth (const std::string &aValue);
 
       /** \brief Creates a gYearMonth Item
        *         see [http://www.w3.org/TR/xmlschema-2/#gYearMonth]
@@ -384,7 +382,7 @@
        * @param aMonth short representation of the month.
        * @return The gYearMonth Item.
        */
-    Item 	createGYearMonth (short aYear, short aMonth);
+    Item  createGYearMonth (short aYear, short aMonth);
 
       /** \brief Creates a HexBinary Item
        *         see [http://www.w3.org/TR/xmlschema-2/#hexBinary]
@@ -393,7 +391,7 @@
        * @param aSize size of the hexdata.
        * @return The HexBinary Item.
        */
-    Item 	createHexBinary (const char *aHexData, size_t aSize);
+    Item  createHexBinary (const char *aHexData, size_t aSize);
 
       /** \brief Creates a Int Item
        *         see [http://www.w3.org/TR/xmlschema-2/#int]
@@ -401,7 +399,7 @@
        * @param aInt int representation of the Int.
        * @return The NCName Item.
        */
-    Item 	createInt (int aInt);
+    Item  createInt (int aInt);
 
       /** \brief Creates an Integer Item
        *         see [http://www.w3.org/TR/xmlschema-2/#integer]
@@ -409,7 +407,7 @@
        * @param aInteger String representation of the Integer.
        * @return The Integer Item.
        */
-    Item 	createInteger (const std::string &aInteger);
+    Item  createInteger (const std::string &aInteger);
 
       /** \brief Creates an Integer Item
        *         see [http://www.w3.org/TR/xmlschema-2/#integer]
@@ -417,7 +415,7 @@
        * @param aInteger unsigned long representation of the Integer.
        * @return The Integer Item.
        */
-    Item 	createInteger (long long aInteger);
+    Item  createInteger (long long aInteger);
 
       /** \brief Creates a Long Item
        *         see [http://www.w3.org/TR/xmlschema-2/#long]
@@ -425,7 +423,7 @@
        * @param aLong long long representation of the Long.
        * @return The Long Item.
        */
-    Item 	createLong (long long aLong);
+    Item  createLong (long long aLong);
 
       /** \brief Creates a NCName Item
        *         see [http://www.w3.org/TR/xmlschema-2/#NCName]
@@ -433,7 +431,7 @@
        * @param aValue String representation of the NCName.
        * @return The NCName Item.
        */
-    Item 	createNCName (const std::string &aValue);
+    Item  createNCName (const std::string &aValue);
 
       /** \brief Creates a negativeInteger Item
        *         see [http://www.w3.org/TR/xmlschema-2/#negativeInteger]
@@ -441,7 +439,7 @@
        * @param aValue long long representation of the negativeInteger.
        * @return The negativeInteger Item.
        */
-    Item 	createNegativeInteger (long long aValue);
+    Item  createNegativeInteger (long long aValue);
 
       /** \brief Creates a nonNegativeInteger Item
        *         see [http://www.w3.org/TR/xmlschema-2/#nonNegativeInteger]
@@ -449,7 +447,7 @@
        * @param aValue unsigned long representation of the nonNegativeInteger.
        * @return The nonNegativeInteger Item.
        */
-    Item 	createNonNegativeInteger (unsigned long long aValue);
+    Item  createNonNegativeInteger (unsigned long long aValue);
 
       /** \brief Creates a nonPositiveInteger Item
        *         see [http://www.w3.org/TR/xmlschema-2/#nonPositiveInteger]
@@ -457,7 +455,7 @@
        * @param aValue long long representation of the NCName.
        * @return The nonPositiveInteger Item.
        */
-    Item 	createNonPositiveInteger (long long aValue);
+    Item  createNonPositiveInteger (long long aValue);
 
       /**
       * Create a new Processing Instruction node N and place it among the
@@ -470,7 +468,7 @@
       * @param aBaseUri The Base URI of the new node, may be NULL.
       * @return         The new node N created by this method
       */
-    Item 	createPiNode (Item &aParent, const std::string &aTarget, const std::string &aContent, const std::string &aBaseUri);
+    Item  createPiNode (Item &aParent, const std::string &aTarget, const std::string &aContent, const std::string &aBaseUri);
 
       /** \brief Creates a positiveInteger\ Item
        *         see [http://www.w3.org/TR/xmlschema-2/#positiveInteger]
@@ -478,7 +476,7 @@
        * @param aValue unsigned long representation of the positiveInteger.
        * @return The positiveInteger Item.
        */
-    Item 	createPositiveInteger (unsigned long long aValue);
+    Item  createPositiveInteger (unsigned long long aValue);
 
     /** \brief Creates a QName Item
        *         see [http://www.w3.org/TR/xmlschema-2/#QName]
@@ -489,7 +487,7 @@
        *
        * @return The QName Item.
        */
-    Item 	createQName (const std::string &aNamespace, const std::string &aPrefix, const std::string &aLocalname);
+    Item  createQName (const std::string &aNamespace, const std::string &aPrefix, const std::string &aLocalname);
 
       /** \brief Creates a QName Item
        *         see [http://www.w3.org/TR/xmlschema-2/#QName]
@@ -498,7 +496,7 @@
        * @param aLocalname String representation of the localname.       *
        * @return The QName Item.
        */
-    Item 	createQName (const std::string &aNamespace, const std::string &aLocalname);
+    Item  createQName (const std::string &aNamespace, const std::string &aLocalname);
 
       /** \brief Creates a QName Item
        *         see [http://www.w3.org/TR/xmlschema-2/#QName]
@@ -509,7 +507,7 @@
        * @param aQNameString String in the QName notation by James Clark.
        * @return The QName Item.
        */
-    Item 	createQName (const std::string &aQNameString);
+    Item  createQName (const std::string &aQNameString);
 
       /** \brief Creates a Short Item
        *         see [http://www.w3.org/TR/xmlschema-2/#short]
@@ -517,8 +515,8 @@
        * @param aShort short representation of the Short.
        * @return The Short Item.
        */
-    Item 	createShort (short aShort);
-    //Item 	createStreamableString (std::istream &stream, StreamReleaser streamReleaser, bool seekable=false);
+    Item  createShort (short aShort);
+    //Item  createStreamableString (std::istream &stream, StreamReleaser streamReleaser, bool seekable=false);
 
       /** \brief Creates a String Item
        *         see [http://www.w3.org/TR/xmlschema-2/#string]
@@ -526,7 +524,7 @@
        * @param aString String representation of the String Item.
        * @return The String Item
        */
-    Item 	createString (const std::string &aString);
+    Item  createString (const std::string &aString);
 
       /**
       * Create a new text node N and place it among the
@@ -537,7 +535,7 @@
       * @param aContent The content of the new node.
       * @return        The new node N created by this method
       */
-    Item 	createTextNode (Item &aParent, const std::string &aContent);
+    Item  createTextNode (Item &aParent, const std::string &aContent);
 
       /** \brief Creates a Time Item
        *         see [http://www.w3.org/TR/xmlschema-2/#time]
@@ -548,7 +546,7 @@
        * @param aTimeZone_hours short representation of the timezone difference in hours to UTC.
        * @return The Time Item.
        */
-    Item 	createTime (short aHour, short aMinute, double aSecond, short aTimeZone_hours);
+    Item  createTime (short aHour, short aMinute, double aSecond, short aTimeZone_hours);
 
       /** \brief Creates a Time Item
        *         see [http://www.w3.org/TR/xmlschema-2/#time]
@@ -558,7 +556,7 @@
        * @param aSecond double representation of the seconds and fractional seconds.
        * @return The Time Item.
        */
-    Item 	createTime (short aHour, short aMinute, double aSecond);
+    Item  createTime (short aHour, short aMinute, double aSecond);
 
       /** \brief Creates a Time Item
        *         see [http://www.w3.org/TR/xmlschema-2/#time]
@@ -566,7 +564,7 @@
        * @param aValue String representation of the Time.
        * @return The Time Item
        */
-    Item 	createTime (const std::string &aValue);
+    Item  createTime (const std::string &aValue);
 
       /** \brief Creates an Unsigned Byte Item
        *         see [http://www.w3.org/TR/xmlschema-2/#unsignedByte]
@@ -574,7 +572,7 @@
        * @param aValue unsignedByte unsigned char representation of the unsigned byte.
        * @return The Unsigned Byte Item.
        */
-    Item 	createUnsignedByte (const unsigned char aValue);
+    Item  createUnsignedByte (const unsigned char aValue);
 
       /** \brief Creates an unsigned int Item
        *         see [http://www.w3.org/TR/xmlschema-2/#unsignedInt]
@@ -582,7 +580,7 @@
        * @param aValue unsigned int representation of the unsignedInt.
        * @return The unsignedInt Item.
        */
-    Item 	createUnsignedInt (unsigned int aValue);
+    Item  createUnsignedInt (unsigned int aValue);
 
       /** \brief Creates an unsignedLong Item
        *         see [http://www.w3.org/TR/xmlschema-2/#unsignedLong]
@@ -590,7 +588,7 @@
        * @param aValue unsignedLong long long representation of the unsignedLong.
        * @return The unsignedLong Item.
        */
-    Item 	createUnsignedLong (unsigned long long aValue);
+    Item  createUnsignedLong (unsigned long long aValue);
 
       /** \brief Creates a unsignedShort Item
        *         see [http://www.w3.org/TR/xmlschema-2/#unsignedShort]
@@ -598,7 +596,55 @@
        * @param aValue unsigned short representation of the unsignedShort.
        * @return The unsignedShort Item.
        */
-    Item 	createUnsignedShort (unsigned short aValue);
+    Item  createUnsignedShort (unsigned short aValue);
+    
+    /**
+     * \brief Create a JSON null item.
+     */
+    Item createJSONNull();
+
+    /**
+     * \brief Create a JSON Number item from a string. 
+     * This will actually be
+     * an xs:integer, xs:double, or xs:decimal, depending on the content
+     * of the string.
+     *
+     * @param aString The input string.
+     */
+    Item createJSONNumber(std::string aString);
+
+    /**
+     * \brief Create a JSON Object containing the specified JSON Pairs.
+     *
+     * @param aNames A vector containing the name and value of each pair.
+     */
+    Item createJSONObject(std::vector<std::pair<Item, Item> >& aNames);
+
+    /**
+     * \brief Create a JSON Object containing the specified string Pairs.
+     *
+     * @param aNames A vector containing the name and value of each pair.
+     */
+    Item createJSONObject(std::vector<std::pair<std::string, std::string> >& aNames);
+
+    /**
+     * \brief Create a JSON Array containing the specified items.
+     *
+     * @param aItems a Vector<Item> containing Items which may
+     * be stored in a JSON Array (namely JSON Arrays, JSON Objects,
+     * JSON nulls, valid JSON numeric types, or xs:strings).
+     */
+    Item createJSONArray(std::vector<Item>& aItems);
+
+    /**
+     * \brief Create a JSON Array containing the specified items.
+     *
+     * @param aItems a Vector<String> containing strings which may
+     * be stored in a JSON Array.
+     */
+    Item createJSONArray(std::vector<std::string>& aItems);
+
+    
 }; // class ItemFactory
 
 #endif
\ No newline at end of file

=== modified file 'swig/ItemFactory.i'
--- swig/ItemFactory.i	2013-02-07 17:24:36 +0000
+++ swig/ItemFactory.i	2013-03-27 00:42:25 +0000
@@ -3,16 +3,15 @@
 
 
  
-  Item 	ItemFactory::createAnyURI (const std::string &aURI){
+  Item  ItemFactory::createAnyURI (const std::string &aURI){
     return Item(theItemFactory->createAnyURI(aURI));
   }
   
-  Item 	ItemFactory::createAttributeNode (Item& aParent, Item& aNodeName, Item& aTypeName, Item& aTypedValue){
+  Item  ItemFactory::createAttributeNode (Item& aParent, Item& aNodeName, Item& aTypeName, Item& aTypedValue){
     return Item( theItemFactory->createAttributeNode( aParent.theItem, aNodeName.theItem, aTypeName.theItem, aTypedValue.theItem ));
   }
   
-#ifndef SWIGRUBY
-  Item 	ItemFactory::createAttributeNode (Item& aParent, Item& aNodeName, Item& aTypeName, std::vector< Item > aTypedValue){
+  Item  ItemFactory::createAttributeNode (Item& aParent, Item& aNodeName, Item& aTypeName, std::vector< Item > aTypedValue){
 
     std::vector< zorba::Item > typedValue;
     typedValue.reserve(aTypedValue.size());
@@ -22,71 +21,70 @@
     }
     return Item( theItemFactory->createAttributeNode (aParent.theItem, aNodeName.theItem, aTypeName.theItem, typedValue ));
   }
-#endif
   
-  Item 	ItemFactory::createBase64Binary (const char *aBinData, size_t aLength){
+  Item  ItemFactory::createBase64Binary (const char *aBinData, size_t aLength){
     return Item( theItemFactory->createBase64Binary(aBinData, aLength));
   }
-  Item 	ItemFactory::createBase64Binary (std::istream &aStream){
+  Item  ItemFactory::createBase64Binary (std::istream &aStream){
     return Item( theItemFactory->createBase64Binary(aStream));
   }
-  Item 	ItemFactory::createBase64Binary (const unsigned char *aBinData, size_t aLength){
+  Item  ItemFactory::createBase64Binary (const unsigned char *aBinData, size_t aLength){
     return Item( theItemFactory->createBase64Binary(aBinData, aLength));
   }
-  Item 	ItemFactory::createBoolean (bool aValue){
+  Item  ItemFactory::createBoolean (bool aValue){
     return Item( theItemFactory->createBoolean(aValue));
   }
-  Item 	ItemFactory::createByte (char aByte){
+  Item  ItemFactory::createByte (char aByte){
     return Item( theItemFactory->createByte(aByte));
   }
-  Item 	ItemFactory::createCommentNode (Item &aParent, const std::string &aContent){
+  Item  ItemFactory::createCommentNode (Item &aParent, const std::string &aContent){
     zorba::String lContent = zorba::String(aContent);
     return Item( theItemFactory->createCommentNode (aParent.theItem, lContent));
   }
-  Item 	ItemFactory::createDate (const std::string &aDate){
+  Item  ItemFactory::createDate (const std::string &aDate){
     return Item( theItemFactory->createDate(aDate));
   }
-  Item 	ItemFactory::createDate (short aYear, short aMonth, short aDay){
+  Item  ItemFactory::createDate (short aYear, short aMonth, short aDay){
     return Item( theItemFactory->createDate (aYear, aMonth, aDay));
   }
-  Item 	ItemFactory::createDateTime (const std::string &aDateTimeValue){
+  Item  ItemFactory::createDateTime (const std::string &aDateTimeValue){
     return Item( theItemFactory->createDateTime (aDateTimeValue));
   }
-  Item 	ItemFactory::createDateTime (short aYear, short aMonth, short aDay, short aHour, short aMinute, double aSecond, short aTimeZone_hours){
+  Item  ItemFactory::createDateTime (short aYear, short aMonth, short aDay, short aHour, short aMinute, double aSecond, short aTimeZone_hours){
     return Item( theItemFactory->createDateTime (aYear, aMonth, aDay, aHour, aMinute, aSecond, aTimeZone_hours));
   }
-  Item 	ItemFactory::createDecimal (const std::string &aValue){
+  Item  ItemFactory::createDecimal (const std::string &aValue){
     return Item( theItemFactory->createDecimal (aValue));
   }
-  Item 	ItemFactory::createDecimalFromDouble (double aValue){
+  Item  ItemFactory::createDecimalFromDouble (double aValue){
     return Item( theItemFactory->createDecimalFromDouble (aValue));
   }
-  Item 	ItemFactory::createDecimalFromLong (unsigned long aValue){
+  Item  ItemFactory::createDecimalFromLong (unsigned long aValue){
     return Item( theItemFactory->createDecimalFromLong (aValue));
   }
-  Item 	ItemFactory::createDouble (const std::string &aValue){
-    return Item( theItemFactory->createDouble (aValue));
-  }
-  Item 	ItemFactory::createDouble (double aValue){
-    return Item( theItemFactory->createDouble (aValue));
-  }
-  Item 	ItemFactory::createDuration (const std::string &aValue){
+  Item  ItemFactory::createDouble (const std::string &aValue){
+    return Item( theItemFactory->createDouble (aValue));
+  }
+  Item  ItemFactory::createDouble (double aValue){
+    return Item( theItemFactory->createDouble (aValue));
+  }
+  Item  ItemFactory::createDuration (const std::string &aValue){
     return Item( theItemFactory->createDuration (aValue));
   }
-  Item 	ItemFactory::createDuration (short aYear, short aMonths, short aDays, short aHours, short aMinutes, double aSeconds){
+  Item  ItemFactory::createDuration (short aYear, short aMonths, short aDays, short aHours, short aMinutes, double aSeconds){
     return Item( theItemFactory->createDuration (aYear, aMonths, aDays, aHours, aMinutes, aSeconds));
   }
-  Item 	ItemFactory::createDayTimeDuration (const std::string &aValue){
+  Item  ItemFactory::createDayTimeDuration (const std::string &aValue){
     return Item( theItemFactory->createDayTimeDuration (aValue));
   }
-  Item 	ItemFactory::createYearMonthDuration (const std::string &aValue){
+  Item  ItemFactory::createYearMonthDuration (const std::string &aValue){
     return Item( theItemFactory->createYearMonthDuration (aValue));
   }
-  Item 	ItemFactory::createDocumentNode (const std::string &aBaseUri, const std::string &aDocUri){
+  Item  ItemFactory::createDocumentNode (const std::string &aBaseUri, const std::string &aDocUri){
     return Item( theItemFactory->createDocumentNode (aBaseUri, aDocUri));
   }
-#ifndef SWIGRUBY
-  Item 	ItemFactory::createElementNode (Item &aParent, Item& aNodeName, Item& aTypeName, bool aHasTypedValue, bool aHasEmptyValue, std::vector< std::pair< std::string, std::string > > aNsBindings){
+
+  Item  ItemFactory::createElementNode (Item &aParent, Item& aNodeName, Item& aTypeName, bool aHasTypedValue, bool aHasEmptyValue, std::vector< std::pair< std::string, std::string > > aNsBindings){
     std::vector< std::pair< zorba::String, zorba::String > > items;
     items.reserve(aNsBindings.size());
     std::vector< std::pair< std::string, std::string > >::iterator iter;
@@ -98,128 +96,184 @@
     }
     return Item( theItemFactory->createElementNode (aParent.theItem, aNodeName.theItem, aTypeName.theItem, aHasTypedValue, aHasEmptyValue, items));
   }
-#endif
-  Item 	ItemFactory::createElementNode (Item &aParent, Item& aNodeName, Item& aTypeName, bool aHasTypedValue, bool aHasEmptyValue){
+
+  Item  ItemFactory::createElementNode (Item &aParent, Item& aNodeName, Item& aTypeName, bool aHasTypedValue, bool aHasEmptyValue){
     return Item( theItemFactory->createElementNode (aParent.theItem, aNodeName.theItem, aTypeName.theItem, aHasTypedValue, aHasEmptyValue, std::vector<std::pair<zorba::String, zorba::String> >()));
   }
-  Item 	ItemFactory::createFloat (const std::string &aValue){
-    return Item( theItemFactory->createFloat (aValue));
-  }
-  Item 	ItemFactory::createFloat (float aValue){
-    return Item( theItemFactory->createFloat (aValue));
-  }
-  Item 	ItemFactory::createGDay (const std::string &aValue){
+  Item  ItemFactory::createFloat (const std::string &aValue){
+    return Item( theItemFactory->createFloat (aValue));
+  }
+  Item  ItemFactory::createFloat (float aValue){
+    return Item( theItemFactory->createFloat (aValue));
+  }
+  Item  ItemFactory::createGDay (const std::string &aValue){
     return Item( theItemFactory->createGDay (aValue));
   }
-  Item 	ItemFactory::createGDay (short aDay){
+  Item  ItemFactory::createGDay (short aDay){
     return Item( theItemFactory->createGDay (aDay));
   }
-  Item 	ItemFactory::createGMonth (const std::string &aValue){
+  Item  ItemFactory::createGMonth (const std::string &aValue){
     return Item( theItemFactory->createGMonth (aValue));
   }
-  Item 	ItemFactory::createGMonth (short aMonth){
+  Item  ItemFactory::createGMonth (short aMonth){
     return Item( theItemFactory->createGMonth (aMonth));
   }
-  Item 	ItemFactory::createGMonthDay (const std::string &aValue){
+  Item  ItemFactory::createGMonthDay (const std::string &aValue){
     return Item( theItemFactory->createGMonthDay (aValue));
   }
-  Item 	ItemFactory::createGMonthDay (short aMonth, short aDay){
+  Item  ItemFactory::createGMonthDay (short aMonth, short aDay){
     return Item( theItemFactory->createGMonthDay (aMonth, aDay));
   }
-  Item 	ItemFactory::createGYear (short aYear){
+  Item  ItemFactory::createGYear (short aYear){
     return Item( theItemFactory->createGYear (aYear));
   }
-  Item 	ItemFactory::createGYear (const std::string &aValue){
+  Item  ItemFactory::createGYear (const std::string &aValue){
     return Item( theItemFactory->createGYear (aValue));
   }
-  Item 	ItemFactory::createGYearMonth (const std::string &aValue){
+  Item  ItemFactory::createGYearMonth (const std::string &aValue){
     return Item( theItemFactory->createGYearMonth (aValue));
   }
-  Item 	ItemFactory::createGYearMonth (short aYear, short aMonth){
+  Item  ItemFactory::createGYearMonth (short aYear, short aMonth){
     return Item( theItemFactory->createGYearMonth (aYear, aMonth));
   }
-  Item 	ItemFactory::createHexBinary (const char *aHexData, size_t aSize){
+  Item  ItemFactory::createHexBinary (const char *aHexData, size_t aSize){
     return Item( theItemFactory->createHexBinary (aHexData, aSize));
   }
-  Item 	ItemFactory::createInt (int aInt){
+  Item  ItemFactory::createInt (int aInt){
     return Item( theItemFactory->createInt (aInt));
   }
-  Item 	ItemFactory::createInteger (const std::string &aInteger){
-    return Item( theItemFactory->createInteger (aInteger));
-  }
-  Item 	ItemFactory::createInteger (long long aInteger){
-    return Item( theItemFactory->createInteger (aInteger));
-  }
-  Item 	ItemFactory::createLong (long long aLong){
+  Item  ItemFactory::createInteger (const std::string &aInteger){
+    return Item( theItemFactory->createInteger (aInteger));
+  }
+  Item  ItemFactory::createInteger (long long aInteger){
+    return Item( theItemFactory->createInteger (aInteger));
+  }
+  Item  ItemFactory::createLong (long long aLong){
     return Item( theItemFactory->createLong (aLong));
   }
-  Item 	ItemFactory::createNCName (const std::string &aValue){
+  Item  ItemFactory::createNCName (const std::string &aValue){
     return Item( theItemFactory->createNCName (aValue));
   }
-  Item 	ItemFactory::createNegativeInteger (long long aValue){
+  Item  ItemFactory::createNegativeInteger (long long aValue){
     return Item( theItemFactory->createNegativeInteger (aValue));
   }
-  Item 	ItemFactory::createNonNegativeInteger (unsigned long long aValue){
+  Item  ItemFactory::createNonNegativeInteger (unsigned long long aValue){
     return Item( theItemFactory->createNonNegativeInteger (aValue));
   }
-  Item 	ItemFactory::createNonPositiveInteger (long long aValue){
+  Item  ItemFactory::createNonPositiveInteger (long long aValue){
     return Item( theItemFactory->createNonPositiveInteger (aValue));
   }
-  Item 	ItemFactory::createPiNode (Item &aParent, const std::string &aTarget, const std::string &aContent, const std::string &aBaseUri){
+  Item  ItemFactory::createPiNode (Item &aParent, const std::string &aTarget, const std::string &aContent, const std::string &aBaseUri){
     zorba::String lTarget = zorba::String(aTarget);
     zorba::String lContent = zorba::String(aContent);
     zorba::String lBaseUri = zorba::String(aBaseUri);
     return Item( theItemFactory->createPiNode (aParent.theItem, lTarget, lContent, lBaseUri));
   }
-  Item 	ItemFactory::createPositiveInteger (unsigned long long aValue){
+  Item  ItemFactory::createPositiveInteger (unsigned long long aValue){
     return Item( theItemFactory->createPositiveInteger (aValue));
   }
-  Item 	ItemFactory::createQName (const std::string &aNamespace, const std::string &aPrefix, const std::string &aLocalname){
+  Item  ItemFactory::createQName (const std::string &aNamespace, const std::string &aPrefix, const std::string &aLocalname){
     return Item( theItemFactory->createQName (aNamespace, aPrefix, aLocalname));
   }
-  Item 	ItemFactory::createQName (const std::string &aNamespace, const std::string &aLocalname){
+  Item  ItemFactory::createQName (const std::string &aNamespace, const std::string &aLocalname){
     return Item( theItemFactory->createQName (aNamespace, aLocalname));
   }
-  Item 	ItemFactory::createQName (const std::string &aQNameString){
+  Item  ItemFactory::createQName (const std::string &aQNameString){
     return Item( theItemFactory->createQName (aQNameString));
   }
-  Item 	ItemFactory::createShort (short aShort){
+  Item  ItemFactory::createShort (short aShort){
     return Item( theItemFactory->createShort (aShort));
   }
   /*
-  Item 	ItemFactory::createStreamableString (std::istream &stream, StreamReleaser streamReleaser, bool seekable=false){
+  Item  ItemFactory::createStreamableString (std::istream &stream, StreamReleaser streamReleaser, bool seekable=false){
     return Item( theItemFactory->createStreamableString (std::istream &stream, StreamReleaser streamReleaser, seekable));
   }
   */
-  Item 	ItemFactory::createString (const std::string &aString){
+  Item  ItemFactory::createString (const std::string &aString){
     return Item( theItemFactory->createString (aString));
   }
-  Item 	ItemFactory::createTextNode (Item &aParent, const std::string &aContent){
+  Item  ItemFactory::createTextNode (Item &aParent, const std::string &aContent){
     zorba::String lContent = zorba::String(aContent);
     return Item( theItemFactory->createTextNode (aParent.theItem, lContent));
   }
-  Item 	ItemFactory::createTime (short aHour, short aMinute, double aSecond, short aTimeZone_hours){
+  Item  ItemFactory::createTime (short aHour, short aMinute, double aSecond, short aTimeZone_hours){
     return Item( theItemFactory->createTime (aHour, aMinute, aSecond, aTimeZone_hours));
   }
-  Item 	ItemFactory::createTime (short aHour, short aMinute, double aSecond){
+  Item  ItemFactory::createTime (short aHour, short aMinute, double aSecond){
     return Item( theItemFactory->createTime (aHour, aMinute, aSecond));
   }
-  Item 	ItemFactory::createTime (const std::string &aValue){
+  Item  ItemFactory::createTime (const std::string &aValue){
     return Item( theItemFactory->createTime (aValue));
   }
-  Item 	ItemFactory::createUnsignedByte (const unsigned char aValue){
+  Item  ItemFactory::createUnsignedByte (const unsigned char aValue){
     return Item( theItemFactory->createUnsignedByte (aValue));
   }
-  Item 	ItemFactory::createUnsignedInt (unsigned int aValue){
+  Item  ItemFactory::createUnsignedInt (unsigned int aValue){
     return Item( theItemFactory->createUnsignedInt (aValue));
   }
-  Item 	ItemFactory::createUnsignedLong (unsigned long long aValue){
+  Item  ItemFactory::createUnsignedLong (unsigned long long aValue){
     return Item( theItemFactory->createUnsignedLong (aValue));
   }
-  Item 	ItemFactory::createUnsignedShort (unsigned short aValue){
+  Item  ItemFactory::createUnsignedShort (unsigned short aValue){
     return Item( theItemFactory->createUnsignedShort (aValue));
   }
 
+  Item ItemFactory::createJSONNull() {
+    return Item( theItemFactory->createJSONNull() );
+  }
+
+  Item ItemFactory::createJSONNumber(std::string aString) {
+    return Item( theItemFactory->createJSONNumber(aString));
+  }
+
+  Item ItemFactory::createJSONObject(std::vector<std::pair<Item, Item> >& aNames) {
+    std::vector< std::pair< zorba::Item, zorba::Item > > names;
+    names.reserve(aNames.size());
+ 
+    for(std::vector< std::pair< Item, Item > >::iterator iter = aNames.begin(); iter != aNames.end(); iter++) {
+      std::pair< zorba::Item, zorba::Item > pair;
+      pair.first = (*iter).first.theItem;
+      pair.second = (*iter).second.theItem;
+      names.push_back(pair);
+    }
+    return Item( theItemFactory->createJSONObject (names) );
+  }
+
+  Item ItemFactory::createJSONObject(std::vector<std::pair<std::string, std::string> >& aNames) {
+    std::vector< std::pair< zorba::Item, zorba::Item > > names;
+    names.reserve(aNames.size());
+ 
+    for(std::vector<std::pair<std::string, std::string> >::iterator iter = aNames.begin(); iter != aNames.end(); iter++) {
+      std::pair< zorba::Item, zorba::Item > pair;
+      pair.first = theItemFactory->createString( (*iter).first );
+      pair.second = theItemFactory->createString( (*iter).second );
+      names.push_back(pair);
+    }
+    return Item( theItemFactory->createJSONObject (names) );
+  }
+
+  Item ItemFactory::createJSONArray(std::vector<Item>& aItems) {
+    std::vector< zorba::Item > items;
+    items.reserve(aItems.size());
+ 
+    for(std::vector< Item >::iterator iter = aItems.begin(); iter != aItems.end(); iter++) {
+      zorba::Item item = (*iter).theItem;
+      items.push_back(item);
+    }
+    return Item( theItemFactory->createJSONArray (items) );
+  }
+
+  Item ItemFactory::createJSONArray(std::vector<std::string>& aItems) {
+    std::vector< zorba::Item > items;
+    items.reserve(aItems.size());
+
+    for(std::vector< std::string >::iterator iter = aItems.begin(); iter != aItems.end(); iter++) {
+      zorba::Item item = theItemFactory->createString(*iter);
+      items.push_back(item);
+    }
+    return Item( theItemFactory->createJSONArray (items) );
+  }
+
 
 %}  // end Implementation
 

=== modified file 'swig/StaticContext.i'
--- swig/StaticContext.i	2013-02-07 17:24:36 +0000
+++ swig/StaticContext.i	2013-03-27 00:42:25 +0000
@@ -35,13 +35,13 @@
 bool StaticContext::containsFunction(const std::string &aFnNameUri, const std::string &aFnNameLocal, int arity) const 
   { return theStaticContext->containsFunction(aFnNameUri, aFnNameLocal, arity); }
 
-StaticContext	StaticContext::createChildContext() const
+StaticContext StaticContext::createChildContext() const
   { return StaticContext(theStaticContext->createChildContext()); }
   
-void 	StaticContext::declareOption (const Item &aQName, const std::string &aOptionVal)
+void  StaticContext::declareOption (const Item &aQName, const std::string &aOptionVal)
   { return theStaticContext->declareOption(aQName.theItem, aOptionVal); }
 
-void 	StaticContext::disableFunction (const Item &aQName, int arity)
+void  StaticContext::disableFunction (const Item &aQName, int arity)
   { theStaticContext->disableFunction( aQName.theItem, arity); }
 
 std::string StaticContext::getBaseURI () const
@@ -65,7 +65,7 @@
       result = ZorbaConstants::PRESERVE_CONSTRUCTION;
     }
     return result;
-  }		
+  }  
 
 ZorbaConstants::PreserveMode StaticContext::getCopyNamespacesModePreserve()
   { 

=== modified file 'swig/TypeIdentifier.i'
--- swig/TypeIdentifier.i	2012-03-27 00:56:11 +0000
+++ swig/TypeIdentifier.i	2013-03-27 00:42:25 +0000
@@ -19,7 +19,7 @@
   zorba::IdentTypes::quantifier_t 
   TypeIdentifier::convertQuantifier(IdentTypes::Quantifier quantifier)
   {
-    zorba::IdentTypes::quantifier_t result;
+    zorba::IdentTypes::quantifier_t result = zorba::IdentTypes::QUANT_ONE;
     switch (quantifier) {
       case IdentTypes::QUANT_ONE:
         result = zorba::IdentTypes::QUANT_ONE;
@@ -44,7 +44,7 @@
   IdentTypes::Kind TypeIdentifier::getKind()
   {
     zorba::IdentTypes::kind_t lKind = theTypeIdentifier->getKind();
-    IdentTypes::Kind result;
+    IdentTypes::Kind result = IdentTypes::ANY_NODE_TYPE;
     switch (lKind) {
       case zorba::IdentTypes::NAMED_TYPE:
         result = IdentTypes::NAMED_TYPE;
@@ -92,7 +92,7 @@
   IdentTypes::Quantifier TypeIdentifier::getQuantifier()
   {
     zorba::IdentTypes::quantifier_t lQuantifier = theTypeIdentifier->getQuantifier();
-    IdentTypes::Quantifier result;
+    IdentTypes::Quantifier result = IdentTypes::QUANT_ONE;
     switch (lQuantifier) {
       case zorba::IdentTypes::QUANT_ONE:
         result = IdentTypes::QUANT_ONE;

=== modified file 'swig/ZorbaStreamBuffer.i'
--- swig/ZorbaStreamBuffer.i	2012-09-06 23:54:47 +0000
+++ swig/ZorbaStreamBuffer.i	2013-03-27 00:42:25 +0000
@@ -82,7 +82,7 @@
 
 std::streamsize ZorbaStreamBuffer::xsputn ( const char * BYTE, std::streamsize len ) {
   // Wrapping to virtual function
-  streamWrapper->write(BYTE, len);
+  streamWrapper->write(BYTE, static_cast<size_t>(len));
   return len;
 }
 

=== modified file 'swig/csharp/tests/CMakeLists.txt'
--- swig/csharp/tests/CMakeLists.txt	2012-07-27 22:56:27 +0000
+++ swig/csharp/tests/CMakeLists.txt	2013-03-27 00:42:25 +0000
@@ -21,6 +21,8 @@
 STRING(REGEX REPLACE "/" "\\\\" CSharpPath "${CSharpPath}")
 STRING(REGEX REPLACE "/" "\\\\" CSharpBuildPath "${CSharpBuildPath}")
 
+CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/satellites.json ${CMAKE_CURRENT_BINARY_DIR}/satellites.json COPYONLY)
+
 FILE(GLOB CSHARP_EXAMPLES RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}/" "${CMAKE_CURRENT_SOURCE_DIR}/*.in")
 FOREACH(CSHARP_EXAMPLE ${CSHARP_EXAMPLES})
   STRING(REPLACE ".in" "" CSHARP_EXAMPLE_DEST ${CSHARP_EXAMPLE})

=== added file 'swig/csharp/tests/satellites.json'
--- swig/csharp/tests/satellites.json	1970-01-01 00:00:00 +0000
+++ swig/csharp/tests/satellites.json	2013-03-27 00:42:25 +0000
@@ -0,0 +1,17 @@
+{
+  "creator" : "Satellites plugin version 0.6.4",
+  "satellites" : {
+    "AAU CUBESAT" : {
+      "tle1" : "1 27846U 03031G 10322.04074654  .00000056  00000-0  45693-4 0  8768",
+      "visible" : false
+    },
+    "AJISAI (EGS)" : {
+      "tle1" : "1 16908U 86061A 10321.84797408 -.00000083  00000-0  10000-3 0  3696",
+      "visible" : true
+    },
+    "AKARI (ASTRO-F)" : {
+      "tle1" : "1 28939U 06005A 10321.96319841  .00000176  00000-0  48808-4 0  4294",
+      "visible" : true
+    }
+  }
+}

=== modified file 'swig/csharp/tests/test01.cs'
--- swig/csharp/tests/test01.cs	2012-07-20 21:21:21 +0000
+++ swig/csharp/tests/test01.cs	2013-03-27 00:42:25 +0000
@@ -14,8 +14,6 @@
  * limitations under the License.
  */
 using System;
-using System.Collections.Generic;
-using System.Linq;
 using System.Text;
 using org.zorbaxquery.api;
 

=== added file 'swig/csharp/tests/test09.cs'
--- swig/csharp/tests/test09.cs	1970-01-01 00:00:00 +0000
+++ swig/csharp/tests/test09.cs	2013-03-27 00:42:25 +0000
@@ -0,0 +1,95 @@
+/*
+ * Copyright 2006-2012 The FLWOR Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+using System;
+using System.Text;
+using org.zorbaxquery.api;
+
+namespace ZorbaApplication
+{
+
+    class MyDiagnosticHandler : DiagnosticHandler {
+        public override void error(ZorbaException exception) {
+          System.Console.WriteLine("Exception catched in MyDiagnosticHandler");
+          System.Console.WriteLine("Description: " + exception.getDescription());
+        }
+    }
+
+    class Program
+    {
+        static String test(String query) {
+            MyDiagnosticHandler diagnosticHandler = new MyDiagnosticHandler();
+
+            InMemoryStore store = InMemoryStore.getInstance();
+            Zorba zorba = Zorba.getInstance(store);
+
+            XQuery xquery = zorba.compileQuery(query, diagnosticHandler);
+            
+            StringBuilder sbuilder = new StringBuilder();
+            sbuilder.Append(xquery.execute());
+
+            xquery.destroy();
+            xquery.Dispose();
+            
+            zorba.shutdown();
+            InMemoryStore.shutdown(store);
+            
+            return sbuilder.ToString();
+        }
+
+        static void Main(string[] args)
+        {
+            System.Console.WriteLine("Running: Compile query string using JSONiq");
+
+            String query = @" 
+              let $sats:=jn:json-doc('@CSharpPath@/tests/satellites.json')('satellites') 
+              return { 
+               'visible' : [ 
+                  for $sat in jn:keys($sats) 
+                  where $sats($sat)('visible') 
+                  return $sat 
+               ], 
+               'invisible' : [ 
+                  for $sat in jn:keys($sats) 
+                  where not($sats($sat)('visible')) 
+                  return $sat 
+               ] 
+              } 
+            ";
+            
+            String testResult = "{ \"visible\" : [ \"AJISAI (EGS)\", \"AKARI (ASTRO-F)\" ], \"invisible\" : [ \"AAU CUBESAT\" ] }";
+            System.Console.WriteLine("Query: " + query);
+            String result;
+            try {
+                result = test(query);
+            } catch(Exception e) {
+                System.Console.WriteLine("Failed");
+                Console.WriteLine("{0} Exception caught.", e);
+                return;
+            }
+            
+            System.Console.WriteLine("Expecting: " + testResult);
+            System.Console.WriteLine("Result: " + result);
+            
+            if (result.Equals(testResult)) {
+                System.Console.WriteLine("Success");
+            } else {
+                System.Console.WriteLine("Failed");
+            }
+
+            
+        }
+    }
+}

=== added file 'swig/csharp/tests/test10.cs'
--- swig/csharp/tests/test10.cs	1970-01-01 00:00:00 +0000
+++ swig/csharp/tests/test10.cs	2013-03-27 00:42:25 +0000
@@ -0,0 +1,86 @@
+/*
+ * Copyright 2006-2012 The FLWOR Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+using System;
+using System.Text;
+using org.zorbaxquery.api;
+
+namespace ZorbaApplication
+{
+
+    class MyDiagnosticHandler : DiagnosticHandler {
+        public override void error(ZorbaException exception) {
+          System.Console.WriteLine("Exception catched in MyDiagnosticHandler");
+          System.Console.WriteLine("Description: " + exception.getDescription());
+        }
+    }
+
+    class Program
+    {
+        static String test() {
+            MyDiagnosticHandler diagnosticHandler = new MyDiagnosticHandler();
+
+            InMemoryStore store = InMemoryStore.getInstance();
+            Zorba zorba = Zorba.getInstance(store);
+
+            ItemFactory itemFactory = zorba.getItemFactory();
+            Item iNull = itemFactory.createJSONNull();
+            System.Console.WriteLine( "Creating JSON Item null:  " +  iNull.serialize());
+            iNull.Dispose();
+            
+            Item iNumber = itemFactory.createJSONNumber("5");
+            System.Console.WriteLine( "Creating JSON Item number:  " + iNumber.serialize() );
+            iNumber.Dispose();
+            
+            StringVector sv = new StringVector();
+            sv.Add("Hello");
+            sv.Add("Zorba");
+            sv.Add("Hello");
+            sv.Add("Zorba");
+            Item iArray = itemFactory.createJSONArray(sv);
+            sv.Dispose();
+            System.Console.WriteLine( "Creating JSON Item array:  " + iArray.serialize() );
+            iArray.Dispose();
+            
+            zorba.shutdown();
+            InMemoryStore.shutdown(store);
+            
+            return "ok";
+        }
+
+        static void Main(string[] args)
+        {
+            System.Console.WriteLine("Running: Compile query string using Diagnostic Handler");
+
+            String testResult = "ok";
+            String result;
+            try {
+                result = test();
+            } catch(Exception e) {
+                System.Console.WriteLine("Failed");
+                Console.WriteLine("{0} Exception caught.", e);
+                return;
+            }
+            
+            if (result.Equals(testResult)) {
+                System.Console.WriteLine("Success");
+            } else {
+                System.Console.WriteLine("Failed");
+            }
+
+            
+        }
+    }
+}

=== modified file 'swig/java/CMakeLists.txt'
--- swig/java/CMakeLists.txt	2013-02-07 17:24:36 +0000
+++ swig/java/CMakeLists.txt	2013-03-27 00:42:25 +0000
@@ -32,21 +32,21 @@
 
   SET( CMAKE_SWIG_FLAGS -package org.zorbaxquery.api)
 
-  SWIG_ADD_MODULE( lib_zorba_java_api java zorba_api.i )
-  SWIG_LINK_LIBRARIES( lib_zorba_java_api zorba_simplestore ${JAVA_LIBRARY} )
+  SWIG_ADD_MODULE( zorba_api_java java zorba_api.i )
+  SWIG_LINK_LIBRARIES( zorba_api_java zorba_simplestore ${JAVA_LIBRARY} )
   IF (WIN32)
-    SET_TARGET_PROPERTIES( lib_zorba_java_api PROPERTIES PROJECT_LABEL "Java" OUTPUT_NAME "zorba_api" FOLDER "APIs")
+    SET_TARGET_PROPERTIES( zorba_api_java PROPERTIES PROJECT_LABEL "Java" OUTPUT_NAME "zorba_api" FOLDER "APIs")
   ELSE (WIN32)
-    SET_TARGET_PROPERTIES( lib_zorba_java_api PROPERTIES OUTPUT_NAME "libzorba_api")
+    SET_TARGET_PROPERTIES( zorba_api_java PROPERTIES OUTPUT_NAME "libzorba_api")
   ENDIF (WIN32)
   IF ( APPLE )
-    SET_TARGET_PROPERTIES( lib_zorba_java_api PROPERTIES SUFFIX .jnilib )
+    SET_TARGET_PROPERTIES( zorba_api_java PROPERTIES SUFFIX .jnilib )
   ENDIF ( APPLE )
 
   # The following fix was added because of the changes in CMake 2.8, which have the
   # result of naming the java binding library "liblibzorba_api.so" instead of "libzorba_api.so"
   IF (LINUX OR CYGWIN OR APPLE)
-    SET_TARGET_PROPERTIES( lib_zorba_java_api PROPERTIES PREFIX "" )
+    SET_TARGET_PROPERTIES( zorba_api_java PROPERTIES PREFIX "" )
   ENDIF (LINUX OR CYGWIN OR APPLE)
 
   FILE(GLOB ZORBA_API_HEADERS RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}/../" "${CMAKE_CURRENT_SOURCE_DIR}/../*.h")
@@ -60,7 +60,7 @@
     CONFIGURE_FILE("${CMAKE_CURRENT_SOURCE_DIR}/${ZORBA_JAVA_EXTRA}"  "${CMAKE_CURRENT_BINARY_DIR}/${ZORBA_JAVA_EXTRA}")
   ENDFOREACH(ZORBA_JAVA_EXTRA ${ZORBA_JAVA_EXTRAS})
   
-  ADD_CUSTOM_COMMAND(TARGET lib_zorba_java_api
+  ADD_CUSTOM_COMMAND(TARGET zorba_api_java
                  POST_BUILD
                  COMMAND cmake -E echo "Compiling Java files..."
                  COMMAND ${Java_JAVAC_EXECUTABLE} *.java -d ${CMAKE_CURRENT_BINARY_DIR}
@@ -79,12 +79,12 @@
 
   IF ( APPLE )
     INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/${ZORBA_SWIG_LIB_PREFIX}libzorba_api.jnilib DESTINATION ${JAVA_SITEARCH_DIR})
-		INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/zorba_api.jar DESTINATION ${JAVA_SITEARCH_DIR})
+    INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/zorba_api.jar DESTINATION ${JAVA_SITEARCH_DIR})
   ELSE ( APPLE )
-		IF(NOT WIN32)
+    IF(NOT WIN32)
       INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/libzorba_api.so DESTINATION ${JAVA_SITEARCH_DIR})
-		  INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/zorba_api.jar DESTINATION ${JAVA_SITEARCH_DIR})
-		ELSE(NOT WIN32)
+      INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/zorba_api.jar DESTINATION ${JAVA_SITEARCH_DIR})
+    ELSE(NOT WIN32)
       IF (MSVC_IDE)
         INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_BUILD_TYPE}/zorba_api.dll 
         DESTINATION share/java
@@ -100,7 +100,7 @@
         DESTINATION share/java
         COMPONENT "java_swig")
       ENDIF (MSVC_IDE)
-		ENDIF(NOT WIN32)
+    ENDIF(NOT WIN32)
   ENDIF ( APPLE )
 
  

=== modified file 'swig/php/CMakeLists.txt'
--- swig/php/CMakeLists.txt	2013-02-07 17:24:36 +0000
+++ swig/php/CMakeLists.txt	2013-03-27 00:42:25 +0000
@@ -24,25 +24,32 @@
     ADD_DEFINITIONS(-DZEND_WIN32 -DPHP_WIN32 -DZEND_INCLUDE_FULL_WINDOWS_HEADERS -DZEND_DEBUG=0 -DZTS=1)
   ENDIF (WIN32)
 
-  SWIG_ADD_MODULE (zorba_api php5 zorba_api.i)
+  SWIG_ADD_MODULE (zorba_api_php php5 zorba_api.i)
 
   IF (APPLE)
-    SWIG_LINK_LIBRARIES (zorba_api zorba_simplestore ${CMAKE_SHARED_MODULE_CREATE_C_FLAGS})
+    SWIG_LINK_LIBRARIES (zorba_api_php zorba_simplestore ${CMAKE_SHARED_MODULE_CREATE_C_FLAGS})
   ELSE (APPLE)
-    SWIG_LINK_LIBRARIES (zorba_api zorba_simplestore)
+    SWIG_LINK_LIBRARIES (zorba_api_php zorba_simplestore)
   ENDIF (APPLE)
 
+  #fix for library path, using windows backslash causes error
   IF (WIN32)
     STRING(REGEX REPLACE "\\\\" "/" PHP5_LIBRARY "${PHP5_LIBRARY}")
-    SWIG_LINK_LIBRARIES (zorba_api ${PHP5_LIBRARY})
+    SWIG_LINK_LIBRARIES (zorba_api_php ${PHP5_LIBRARY})
   ENDIF (WIN32)
 
   #Copy test to the build folder
   CONFIGURE_FILE("${CMAKE_CURRENT_SOURCE_DIR}/test.xq" "${CMAKE_CURRENT_BINARY_DIR}/test.xq" COPYONLY)
   
-  #Copy
+  #Copy alternate files
   CONFIGURE_FILE("${CMAKE_CURRENT_SOURCE_DIR}/XQueryProcessor.php" "${CMAKE_CURRENT_BINARY_DIR}/Zorba/XQueryProcessor.php" COPYONLY)
-  CONFIGURE_FILE("${CMAKE_CURRENT_SOURCE_DIR}/zorba_api_wrapper.php" "${CMAKE_CURRENT_BINARY_DIR}/Zorba/zorba_api_wrapper.php" COPYONLY)
+  #fix for swig error with wrapper name
+  ADD_CUSTOM_COMMAND(
+    TARGET zorba_api_php
+    POST_BUILD
+    COMMAND cmake -E echo "Fixing PHP wrapper..."
+    COMMAND cmake -P "${CMAKE_CURRENT_SOURCE_DIR}/postfix.cmake"
+  )
 
   FILE(GLOB ZORBA_API_HEADERS RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}/../" "${CMAKE_CURRENT_SOURCE_DIR}/../*.h")
   FOREACH(ZORBA_API_HEADER ${ZORBA_API_HEADERS})
@@ -51,10 +58,14 @@
 
   # The following fix was added because of the changes in CMake 2.8, which have the
   # result of naming the java binding library "liblibzorba_api.so" instead of "libzorba_api.so"
-  SET_TARGET_PROPERTIES( ${SWIG_MODULE_zorba_api_REAL_NAME} PROPERTIES PROJECT_LABEL "PHP" FOLDER "APIs")
   IF (LINUX OR CYGWIN OR APPLE)
     SET_TARGET_PROPERTIES (${SWIG_MODULE_zorba_api_REAL_NAME} PROPERTIES PREFIX "")
   ENDIF (LINUX OR CYGWIN OR APPLE)
+  
+  #set project folder location for IDEs
+  SET_TARGET_PROPERTIES(zorba_api_php PROPERTIES PROJECT_LABEL "PHP" FOLDER "APIs")
+
+  SET_TARGET_PROPERTIES(zorba_api_php PROPERTIES OUTPUT_NAME "zorba_api")
 
   IF (NOT WIN32 OR CYGWIN)
     STRING (REPLACE ${CMAKE_INSTALL_PREFIX} "" PHP5_INSTALL_PATH ${PHP5_EXTENSION_DIR})
@@ -67,7 +78,7 @@
         ${CMAKE_CURRENT_BINARY_DIR}/${ZORBA_SWIG_LIB_PREFIX}zorba_api.so
       DESTINATION ${PHP5_INSTALL_PATH}
     )
-	ELSE (NOT WIN32 OR CYGWIN)
+  ELSE (NOT WIN32 OR CYGWIN)
     IF (MSVC_IDE)
       INSTALL ( FILES 
         ${CMAKE_CURRENT_BINARY_DIR}/Zorba/XQueryProcessor.php
@@ -79,7 +90,7 @@
       INSTALL ( FILES 
         ${CMAKE_CURRENT_BINARY_DIR}/Zorba/XQueryProcessor.php
         ${CMAKE_CURRENT_BINARY_DIR}/Zorba/zorba_api_wrapper.php
-        ${CMAKE_CURRENT_BINARY_DIR}/php_zorba_api.dll
+        ${CMAKE_CURRENT_BINARY_DIR}/zorba_api.dll
         COMPONENT "php_swig"
         DESTINATION share/php )
     ENDIF (MSVC_IDE)

=== modified file 'swig/php/XQueryProcessor.php'
--- swig/php/XQueryProcessor.php	2012-01-17 13:30:49 +0000
+++ swig/php/XQueryProcessor.php	2013-03-27 00:42:25 +0000
@@ -1,5 +1,5 @@
 <?php
-require_once 'Zorba/zorba_api_wrapper.php';
+require_once 'zorba_api_wrapper.php';
 
 class XQueryCompilerException extends Exception{}
 class XQueryProcessorException extends Exception{}

=== added file 'swig/php/postfix.cmake'
--- swig/php/postfix.cmake	1970-01-01 00:00:00 +0000
+++ swig/php/postfix.cmake	2013-03-27 00:42:25 +0000
@@ -0,0 +1,8 @@
+
+FILE(READ "${CMAKE_CURRENT_BINARY_DIR}/zorba_api.php" FILE_CONTENT)
+STRING(REGEX REPLACE "php_zorba_api.dll" "zorba_api.dll" MODIFIED_FILE_CONTENT "${FILE_CONTENT}")
+STRING(REGEX REPLACE "zorba_api.so" "libzorba_api.so" MODIFIED_FILE_CONTENT "${MODIFIED_FILE_CONTENT}")
+STRING(REGEX REPLACE "'zorba_api.'" "'libzorba_api.'" MODIFIED_FILE_CONTENT "${MODIFIED_FILE_CONTENT}")
+FILE(WRITE "${CMAKE_CURRENT_BINARY_DIR}/zorba_api.php" "${MODIFIED_FILE_CONTENT}")
+
+CONFIGURE_FILE("${CMAKE_CURRENT_BINARY_DIR}/zorba_api.php" "${CMAKE_CURRENT_BINARY_DIR}/Zorba/zorba_api_wrapper.php" COPYONLY)

=== modified file 'swig/php/tests/CMakeLists.txt'
--- swig/php/tests/CMakeLists.txt	2013-02-07 17:24:36 +0000
+++ swig/php/tests/CMakeLists.txt	2013-03-27 00:42:25 +0000
@@ -1,4 +1,4 @@
-# Copyright 2006-2011 The FLWOR Foundation.
+# Copyright 2006-2013 The FLWOR Foundation.
 # 
 # Licensed under the Apache License, Version 2.0 (the "License");
 # you may not use this file except in compliance with the License.
@@ -18,69 +18,29 @@
 ELSE (MSVC_IDE)
   SET(phpExtensionPath ${CMAKE_BINARY_DIR}/swig/php)
 ENDIF (MSVC_IDE)
-SET(phpIncludePath ${CMAKE_BINARY_DIR}/swig/php)
+SET(phpIncludePath ${CMAKE_BINARY_DIR}/swig/php/Zorba)
+
+IF (WIN32)
+  STRING(REGEX REPLACE "/" "\\\\" phpExtensionPath "${phpExtensionPath}")
+  STRING(REGEX REPLACE "/" "\\\\" phpPath "${phpPath}")
+  STRING(REGEX REPLACE "/" "\\\\" phpIncludePath "${phpIncludePath}")
+ENDIF (WIN32)
 
 CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/php.ini.in ${CMAKE_CURRENT_BINARY_DIR}/php.ini)
-
 CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/books.xml ${CMAKE_CURRENT_BINARY_DIR}/books.xml COPYONLY)
-CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/compilerHints.xq ${CMAKE_CURRENT_BINARY_DIR}/compilerHints.xq COPYONLY)
-
-CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/test01.php ${CMAKE_CURRENT_BINARY_DIR}/test01.php)
-ADD_TEST("php_test01" ${PHP5_EXECUTABLE} -c ${CMAKE_CURRENT_BINARY_DIR} test01.php)
-SET_TESTS_PROPERTIES("php_test01" PROPERTIES PASS_REGULAR_EXPRESSION "Success")
-
-CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/test02.php ${CMAKE_CURRENT_BINARY_DIR}/test02.php)
-ADD_TEST("php_test02" ${PHP5_EXECUTABLE} -c ${CMAKE_CURRENT_BINARY_DIR} test02.php)
-SET_TESTS_PROPERTIES("php_test02" PROPERTIES PASS_REGULAR_EXPRESSION "Success")
-
-#CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/test03.php ${CMAKE_CURRENT_BINARY_DIR}/test03.php)
-#ADD_TEST("php_test03" ${PHP5_EXECUTABLE} -c ${CMAKE_CURRENT_BINARY_DIR} test03.php)
-#SET_TESTS_PROPERTIES("php_test03" PROPERTIES PASS_REGULAR_EXPRESSION "Success")
-
-CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/test04.php ${CMAKE_CURRENT_BINARY_DIR}/test04.php)
-ADD_TEST("php_test04" ${PHP5_EXECUTABLE} -c ${CMAKE_CURRENT_BINARY_DIR} test04.php)
-CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/test04.xq ${CMAKE_CURRENT_BINARY_DIR}/test04.xq COPYONLY)
-SET_TESTS_PROPERTIES("php_test04" PROPERTIES PASS_REGULAR_EXPRESSION "Success")
-
-CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/test05.php ${CMAKE_CURRENT_BINARY_DIR}/test05.php)
-ADD_TEST("php_test05" ${PHP5_EXECUTABLE} -c ${CMAKE_CURRENT_BINARY_DIR} test05.php)
-CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/test05.xq ${CMAKE_CURRENT_BINARY_DIR}/test05.xq COPYONLY)
-SET_TESTS_PROPERTIES("php_test05" PROPERTIES PASS_REGULAR_EXPRESSION "Success")
-
-CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/test06.php ${CMAKE_CURRENT_BINARY_DIR}/test06.php)
-ADD_TEST("php_test06" ${PHP5_EXECUTABLE} -c ${CMAKE_CURRENT_BINARY_DIR} test06.php)
-CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/test06.xq ${CMAKE_CURRENT_BINARY_DIR}/test06.xq COPYONLY)
-SET_TESTS_PROPERTIES("php_test06" PROPERTIES PASS_REGULAR_EXPRESSION "Success")
-
-CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/test07.php ${CMAKE_CURRENT_BINARY_DIR}/test07.php)
-ADD_TEST("php_test07" ${PHP5_EXECUTABLE} -c ${CMAKE_CURRENT_BINARY_DIR} test07.php)
-SET_TESTS_PROPERTIES("php_test07" PROPERTIES PASS_REGULAR_EXPRESSION "Success")
-
-CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/test08.php ${CMAKE_CURRENT_BINARY_DIR}/test08.php)
-ADD_TEST("php_test08" ${PHP5_EXECUTABLE} -c ${CMAKE_CURRENT_BINARY_DIR} test08.php)
-SET_TESTS_PROPERTIES("php_test08" PROPERTIES PASS_REGULAR_EXPRESSION "Success")
-
-#CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/test09.php ${CMAKE_CURRENT_BINARY_DIR}/test09.php)
-#ADD_TEST("php_test09" ${PHP5_EXECUTABLE} -c ${CMAKE_CURRENT_BINARY_DIR} test09.php)
-#SET_TESTS_PROPERTIES("php_test09" PROPERTIES PASS_REGULAR_EXPRESSION "Success")
-
-CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/test10.php ${CMAKE_CURRENT_BINARY_DIR}/test10.php)
-ADD_TEST("php_test10" ${PHP5_EXECUTABLE} -c ${CMAKE_CURRENT_BINARY_DIR} test10.php)
-SET_TESTS_PROPERTIES("php_test10" PROPERTIES PASS_REGULAR_EXPRESSION "Success")
-
-#CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/test11.php ${CMAKE_CURRENT_BINARY_DIR}/test11.php)
-#ADD_TEST("php_test11" ${PHP5_EXECUTABLE} -c ${CMAKE_CURRENT_BINARY_DIR} test11.php)
-#SET_TESTS_PROPERTIES("php_test11" PROPERTIES PASS_REGULAR_EXPRESSION "Success")
-
-#CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/test12.php ${CMAKE_CURRENT_BINARY_DIR}/test12.php)
-#ADD_TEST("php_test12" ${PHP5_EXECUTABLE} -c ${CMAKE_CURRENT_BINARY_DIR} test12.php)
-#SET_TESTS_PROPERTIES("php_test12" PROPERTIES PASS_REGULAR_EXPRESSION "Success")
-
-#CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/test13.php ${CMAKE_CURRENT_BINARY_DIR}/test13.php)
-#ADD_TEST("php_test13" ${PHP5_EXECUTABLE} -c ${CMAKE_CURRENT_BINARY_DIR} test13.php)
-#SET_TESTS_PROPERTIES("php_test13" PROPERTIES PASS_REGULAR_EXPRESSION "Success")
-
-#CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/test14.php ${CMAKE_CURRENT_BINARY_DIR}/test14.php)
-#ADD_TEST("php_test14" ${PHP5_EXECUTABLE} -c ${CMAKE_CURRENT_BINARY_DIR} test14.php)
-#SET_TESTS_PROPERTIES("php_test14" PROPERTIES PASS_REGULAR_EXPRESSION "Success")
-
+CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/satellites.json ${CMAKE_CURRENT_BINARY_DIR}/satellites.json COPYONLY)
+
+#copy tests
+FILE(GLOB ZORBA_PHP_TESTS RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}/" "${CMAKE_CURRENT_SOURCE_DIR}/*.php")
+FOREACH(ZORBA_PHP_TEST ${ZORBA_PHP_TESTS})
+  CONFIGURE_FILE("${CMAKE_CURRENT_SOURCE_DIR}/${ZORBA_PHP_TEST}"  "${CMAKE_CURRENT_BINARY_DIR}/${ZORBA_PHP_TEST}")
+  STRING(REGEX REPLACE ".php" "" ZORBA_PHP_TEST_NAME "${ZORBA_PHP_TEST}")
+  ADD_TEST("php_${ZORBA_PHP_TEST_NAME}" ${PHP5_EXECUTABLE} -c ${CMAKE_CURRENT_BINARY_DIR} ${ZORBA_PHP_TEST})
+  SET_TESTS_PROPERTIES("php_${ZORBA_PHP_TEST_NAME}" PROPERTIES PASS_REGULAR_EXPRESSION "Success")
+ENDFOREACH(ZORBA_PHP_TEST ${ZORBA_PHP_TESTS})
+
+#copy additional .xq files
+FILE(GLOB ZORBA_PHP_XQS RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}/" "${CMAKE_CURRENT_SOURCE_DIR}/*.xq")
+FOREACH(ZORBA_PHP_XQ ${ZORBA_PHP_XQS})
+  CONFIGURE_FILE("${CMAKE_CURRENT_SOURCE_DIR}/${ZORBA_PHP_XQ}"  "${CMAKE_CURRENT_BINARY_DIR}/${ZORBA_PHP_XQ}" COPYONLY)
+ENDFOREACH(ZORBA_PHP_XQ ${ZORBA_PHP_XQS})

=== modified file 'swig/php/tests/php.ini.in'
--- swig/php/tests/php.ini.in	2012-03-27 00:56:11 +0000
+++ swig/php/tests/php.ini.in	2013-03-27 00:42:25 +0000
@@ -1,3 +1,3 @@
 enable_dl=On
 extension_dir=@phpExtensionPath@
-include_path=".:@phpIncludePath@"
\ No newline at end of file
+include_path="@phpIncludePath@"
\ No newline at end of file

=== added file 'swig/php/tests/satellites.json'
--- swig/php/tests/satellites.json	1970-01-01 00:00:00 +0000
+++ swig/php/tests/satellites.json	2013-03-27 00:42:25 +0000
@@ -0,0 +1,17 @@
+{
+  "creator" : "Satellites plugin version 0.6.4",
+  "satellites" : {
+    "AAU CUBESAT" : {
+      "tle1" : "1 27846U 03031G 10322.04074654  .00000056  00000-0  45693-4 0  8768",
+      "visible" : false
+    },
+    "AJISAI (EGS)" : {
+      "tle1" : "1 16908U 86061A 10321.84797408 -.00000083  00000-0  10000-3 0  3696",
+      "visible" : true
+    },
+    "AKARI (ASTRO-F)" : {
+      "tle1" : "1 28939U 06005A 10321.96319841  .00000176  00000-0  48808-4 0  4294",
+      "visible" : true
+    }
+  }
+}

=== modified file 'swig/php/tests/test01.php'
--- swig/php/tests/test01.php	2012-03-27 00:56:11 +0000
+++ swig/php/tests/test01.php	2013-03-27 00:42:25 +0000
@@ -15,7 +15,7 @@
  * limitations under the License.
  */
 
-require '@phpPath@/Zorba/zorba_api_wrapper.php';
+require 'zorba_api_wrapper.php';
 
 print "Running: Get zorba instance and shutdown\n";
 

=== modified file 'swig/php/tests/test02.php'
--- swig/php/tests/test02.php	2012-03-27 00:56:11 +0000
+++ swig/php/tests/test02.php	2013-03-27 00:42:25 +0000
@@ -15,7 +15,7 @@
  * limitations under the License.
  */
 
-require '@phpPath@/Zorba/zorba_api_wrapper.php';
+require 'zorba_api_wrapper.php';
 
 function test(Zorba $aZorba) {
   $lQuery = $aZorba->compileQuery("(1,2,3,4,5)");

=== removed file 'swig/php/tests/test03.php'
--- swig/php/tests/test03.php	2012-03-27 00:56:11 +0000
+++ swig/php/tests/test03.php	1970-01-01 00:00:00 +0000
@@ -1,48 +0,0 @@
-<?
-/*
- * Copyright 2006-2012 The FLWOR Foundation.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * 
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-require '@phpPath@/Zorba/zorba_api_wrapper.php';
-
-class MyDiagnosticHandler(DiagnosticHandler handler) {
-  funtion error(self, *args) {
-    print "Error args: ", args;
-  }
-}
-
-function test(Zorba $aZorba)
-{
-  diagnosticHandler = MyDiagnosticHandler()
-  try {
-    xquery = zorba.compileQuery("1 div 0", diagnosticHandler);
-    print xquery.execute()
-  } catch (Exception e) {
-    print "Caught error: ";
-  }
-  return
-}
-
-$store = InMemoryStore::getInstance();
-$zorba = Zorba::getInstance($store);
-
-print "Running: Compile query string using Diagnostic Handler"
-test($zorba);
-print "Success";
-
-$zorba->shutdown();
-InMemoryStore::shutdown($store);
-
-?>
\ No newline at end of file

=== added file 'swig/php/tests/test03.php.disabled'
--- swig/php/tests/test03.php.disabled	1970-01-01 00:00:00 +0000
+++ swig/php/tests/test03.php.disabled	2013-03-27 00:42:25 +0000
@@ -0,0 +1,52 @@
+<?
+/*
+ * Copyright 2006-2013 The FLWOR Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+require 'zorba_api_wrapper.php';
+
+class MyDiagnosticHandler extends DiagnosticHandler {
+  public function error($args) {
+    print "Error caught in DiagnosticHandler: " . $args->getDescription() . "\n";
+  }
+}
+
+function test(Zorba $aZorba)
+{
+  $diagnosticHandler = new MyDiagnosticHandler();
+  try {
+    $xquery = $aZorba->compileQuery("1 div 0", $diagnosticHandler);
+    $xquery->execute();
+  } catch (ZorbaException $e) {
+    print "Caught unexpected Zorba error: " . $e->getDescription();
+    exit();
+  } catch (Exception $e) {
+    print "Caught error: " . $e;
+    exit();
+  }
+  return;
+}
+
+$store = InMemoryStore::getInstance();
+$zorba = Zorba::getInstance($store);
+
+print "Running: Compile query string using Diagnostic Handler\n";
+test($zorba);
+print "Success\n";
+
+$zorba->shutdown();
+InMemoryStore::shutdown($store);
+
+?>

=== modified file 'swig/php/tests/test04.php'
--- swig/php/tests/test04.php	2012-03-27 00:56:11 +0000
+++ swig/php/tests/test04.php	2013-03-27 00:42:25 +0000
@@ -15,7 +15,7 @@
  * limitations under the License.
  */
 
-require '@phpPath@/Zorba/zorba_api_wrapper.php';
+require 'zorba_api_wrapper.php';
 
 function test(Zorba $aZorba) {
   #Read and write result

=== modified file 'swig/php/tests/test05.php'
--- swig/php/tests/test05.php	2012-03-27 00:56:11 +0000
+++ swig/php/tests/test05.php	2013-03-27 00:42:25 +0000
@@ -15,7 +15,7 @@
  * limitations under the License.
  */
 
-require '@phpPath@/Zorba/zorba_api_wrapper.php';
+require 'zorba_api_wrapper.php';
 
 function test(Zorba $aZorba) {
   #Read and write result

=== modified file 'swig/php/tests/test06.php'
--- swig/php/tests/test06.php	2012-03-27 00:56:11 +0000
+++ swig/php/tests/test06.php	2013-03-27 00:42:25 +0000
@@ -15,7 +15,7 @@
  * limitations under the License.
  */
 
-require '@phpPath@/Zorba/zorba_api_wrapper.php';
+require 'zorba_api_wrapper.php';
 
 function test(Zorba $aZorba) {
   #Read and write result

=== modified file 'swig/php/tests/test07.php'
--- swig/php/tests/test07.php	2012-03-27 00:56:11 +0000
+++ swig/php/tests/test07.php	2013-03-27 00:42:25 +0000
@@ -15,7 +15,7 @@
  * limitations under the License.
  */
 
-require '@phpPath@/Zorba/zorba_api_wrapper.php';
+require 'zorba_api_wrapper.php';
 
 function test(Zorba $aZorba) {
   $filename = 'books.xml';

=== modified file 'swig/php/tests/test08.php'
--- swig/php/tests/test08.php	2012-03-27 00:56:11 +0000
+++ swig/php/tests/test08.php	2013-03-27 00:42:25 +0000
@@ -15,7 +15,7 @@
  * limitations under the License.
  */
 
-require '@phpPath@/Zorba/zorba_api_wrapper.php';
+require 'zorba_api_wrapper.php';
 
 function println($string) {
   print $string."\n";

=== modified file 'swig/php/tests/test09.php'
--- swig/php/tests/test09.php	2012-03-27 00:56:11 +0000
+++ swig/php/tests/test09.php	2013-03-27 00:42:25 +0000
@@ -15,66 +15,29 @@
  * limitations under the License.
  */
 
-require '@phpPath@/Zorba/zorba_api_wrapper.php';
+require 'zorba_api_wrapper.php';
 
 function test(Zorba $aZorba) {
-  $xquery = $aZorba->compileQuery("<a>text-a1<b at1='att1' at2='{1+2}'>text-b1</b>text-a2</a>");
-  
-  
-  $saxHandler = new SAX2ContentHandlerProxy();
-  $saxHandler->setStartDocumentHandler(startDocumentHandler);
-  $saxHandler->setEndDocumentHandler(endDocumentHandler);
-  $saxHandler->setStartElementHandler(startElementHandler);
-  $saxHandler->setEndElementHandler(endElementHandler);
-  $saxHandler->setCharactersHandler(charactersHandler);
-  $saxHandler->setProcessingInstructionHandler(processingInstructionHandler);
-  $saxHandler->setIgnorableWhitespaceHandler(ignorableWhitespaceHandler);
-  $saxHandler->setStartPrefixMappingHandler(startPrefixMappingHandler);
-  $saxHandler->setEndPrefixMappingHandler(endPrefixMappingHandler);
-  $saxHandler->setSkippedEntityHandler(skippedEntityHandler);
-  $xquery->executeSAX($saxHandler);
-
-  return;
-}
-
-function startDocumentHandler() {
-  print "Start Document";
-  return;
-}
-function endDocumentHandler() {
-  print "End Document";
-  return;
-}
-function startElementHandler($URI, $localName, $QName, $SAXAttributes) {
-  print "Start Element - " . $QName;
-  return;
-}
-function endElementHandler($URI, $localName, $QName) {
-  print "End Element - " . $QName;
-  return;
-}
-function charactersHandler($text) {
-  print "Characters - " . $text;
-  return;
-}
-function processingInstructionHandler($target, $data) {
-  print "Processing Instruction";
-  return;
-}
-function ignorableWhitespaceHandler($text) {
-  print "Ignorable Whitespace - " . $text;
-  return;
-}
-function startPrefixMappingHandler($prefix, $URI) {
-  print "Start Prefix Mapping - " . $prefix;
-  return;
-}
-function endPrefixMappingHandler($prefix) {
-  print "End Prefix Mapping - " . $prefix;
-  return;
-}
-function skippedEntityHandler($name) {
-  print "Skipped Entity - " . $name;
+  $filename = 'books.xml';
+  $f = fopen($filename, 'r');
+  $contents = fread($f, filesize($filename));
+  fclose($f);
+
+  $dataManager = $aZorba->getXmlDataManager();
+  $docIter = $dataManager->parseXML($contents);
+  $docIter->open();
+
+  $doc = Item::createEmptyItem();
+  $docIter->next($doc);
+
+  $docIter->close();
+  $docIter->destroy();
+
+  $xquery = $aZorba->compileQuery(".");
+  $dynCtx = $xquery->getDynamicContext();
+  $dynCtx->setContextItem($doc);
+  print $xquery->execute()."\n";
+  
   return;
 }
 
@@ -82,7 +45,7 @@
 $store = InMemoryStore::getInstance();
 $zorba = Zorba::getInstance($store);
 
-print "Running: XQuery execute - executeSAX\n";
+print "Running: XQuery execute - Get Iterator and print info from its items\n";
 test($zorba);
 print "Success";
 

=== modified file 'swig/php/tests/test10.php'
--- swig/php/tests/test10.php	2012-03-27 00:56:11 +0000
+++ swig/php/tests/test10.php	2013-03-27 00:42:25 +0000
@@ -1,6 +1,6 @@
 <?
 /*
- * Copyright 2006-2012 The FLWOR Foundation.
+ * Copyright 2006-2013 The FLWOR Foundation.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -15,41 +15,53 @@
  * limitations under the License.
  */
 
-require '@phpPath@/Zorba/zorba_api_wrapper.php';
-
-function test(Zorba $aZorba) {
-  $filename = 'books.xml';
-  $f = fopen($filename, 'r');
-  $contents = fread($f, filesize($filename));
-  fclose($f);
-
-  $dataManager = $aZorba->getXmlDataManager();
-  $docIter = $dataManager->parseXML($contents);
-  $docIter->open();
-
-  $doc = Item::createEmptyItem();
-  $docIter->next($doc);
-
-  $docIter->close();
-  $docIter->destroy();
-
-  $xquery = $aZorba->compileQuery(".");
-  $dynCtx = $xquery->getDynamicContext();
-  $dynCtx->setContextItem($doc);
-  print $xquery->execute()."\n";
-  
+require 'zorba_api_wrapper.php';
+
+class MyDiagnosticHandler extends DiagnosticHandler {
+  public function error($args) {
+    print "Error caught in DiagnosticHandler: " . $args->getDescription() . "\n";
+  }
+}
+
+function test(Zorba $aZorba, $query)
+{
+  $diagnosticHandler = new MyDiagnosticHandler();
+  $xquery = $aZorba->compileQuery($query, $diagnosticHandler);
+  try {
+    print $xquery->execute();
+  } catch (Exception $e) {
+    print "Caught error: " . $e;
+    exit();
+  }
+  $xquery->destroy();
   return;
 }
 
-
 $store = InMemoryStore::getInstance();
 $zorba = Zorba::getInstance($store);
 
-print "Running: XQuery execute - Get Iterator and print info from its items\n";
-test($zorba);
-print "Success";
+print "Running: Compile query string using JSONiq \n";
+
+$query = <<<'eoquery'
+ let $sats:=jn:json-doc("@phpPath@/tests/satellites.json")('satellites') 
+ return { 
+   'visible' : [ 
+      for $sat in jn:keys($sats) 
+      where $sats($sat)('visible') 
+      return $sat 
+   ], 
+   'invisible' : [ 
+      for $sat in jn:keys($sats) 
+      where not($sats($sat)('visible')) 
+      return $sat 
+   ] 
+ } 
+eoquery;
+
+test($zorba, $query);
+print "Success\n";
 
 $zorba->shutdown();
 InMemoryStore::shutdown($store);
 
-?>
\ No newline at end of file
+?>

=== modified file 'swig/php/tests/test11.php'
--- swig/php/tests/test11.php	2013-02-07 17:24:36 +0000
+++ swig/php/tests/test11.php	2013-03-27 00:42:25 +0000
@@ -1,6 +1,6 @@
 <?
 /*
- * Copyright 2006-2012 The FLWOR Foundation.
+ * Copyright 2006-2013 The FLWOR Foundation.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -15,34 +15,45 @@
  * limitations under the License.
  */
 
-require '@phpPath@/Zorba/zorba_api_wrapper.php';
+require 'zorba_api_wrapper.php';
 
-class MyDiagnosticHandler(DiagnosticHandler handler) {
-  funtion error(self, *args) {
-    print "Error args: ", args;
+class MyDiagnosticHandler extends DiagnosticHandler {
+  public function error($args) {
+    print "Error caught in DiagnosticHandler: " . $args->getDescription() . "\n";
   }
 }
 
 function test(Zorba $aZorba)
 {
-  diagnosticHandler = MyDiagnosticHandler()
+  $diagnosticHandler = new MyDiagnosticHandler();
   try {
-    xquery = zorba.compileQuery("1 div 0", diagnosticHandler);
-    print xquery.execute()
-  } catch (Exception e) {
-    print "Caught error: ";
+    $itemFactory = $aZorba->getItemFactory();
+    print "Creating JSON Item null:  ". $itemFactory->createJSONNull()->serialize() . "\n";
+    print "Creating JSON Item number:  ". $itemFactory->createJSONNumber("5")->serialize() . "\n";
+    $sv = new StringVector(4);
+    $sv->set(0, "Hello");
+    $sv->set(1, "Zorba");
+    $sv->set(2, "Hello");
+    $sv->set(3, "Zorba");
+    print "Creating JSON Item array:  ". $itemFactory->createJSONArray($sv)->serialize() . "\n";
+    print "Success";
+  } catch (ZorbaException $e) {
+    print "Caught unexpected Zorba error: " . $e->getDescription() . "\n" ;
+    exit();
+  } catch (Exception $e) {
+    print "Caught error: " . $e . "\n";
+    exit();
   }
-  return
+  return;
 }
 
 $store = InMemoryStore::getInstance();
 $zorba = Zorba::getInstance($store);
 
-print "Running: Compile query string using Diagnostic Handler"
+print "Running: Compile query string using Diagnostic Handler\n";
 test($zorba);
-print "Success";
 
 $zorba->shutdown();
 InMemoryStore::shutdown($store);
 
-?>
\ No newline at end of file
+?>

=== removed file 'swig/php/tests/test12.php'
--- swig/php/tests/test12.php	2012-03-27 00:56:11 +0000
+++ swig/php/tests/test12.php	1970-01-01 00:00:00 +0000
@@ -1,52 +0,0 @@
-<?
-/*
- * Copyright 2006-2012 The FLWOR Foundation.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * 
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-//require '@phpPath@/Zorba/zorba_api_wrapper.php';
-require 'C:/dev/zapi/build/swig/php/Zorba/zorba_api_wrapper.php';
-
-class MyDiagnosticHandler(zorba_api.DiagnosticHandler): 
-  def error(self, *args):
-    print "Error args: ", args
-
-def test(zorba):
-  #Read and write result
-  print 'Executing: compilerHints.xq'
-  f = open('compilerHints.xq', 'r')
-  lines = f.read()
-  f.close()
-  diagnosticHandler = MyDiagnosticHandler()
-  compilerHints = zorba_api.CompilerHints()
-  compilerHints.setOptimizationLevel(1)
-  xquery = zorba.compileQuery(lines, compilerHints, diagnosticHandler)
-  
-  result = xquery.execute()
-  print result
-  return
-
-
-store = zorba_api.InMemoryStore_getInstance()
-zorba = zorba_api.Zorba_getInstance(store)
-
-print "Running: CompileQuery string + Dignostinc handler + CompilerHint - with optimization 1"
-test(zorba)
-print "Success"
-
-
-zorba.shutdown()
-zorba_api.InMemoryStore_shutdown(store)
-
-?>
\ No newline at end of file

=== removed file 'swig/php/tests/test13.php'
--- swig/php/tests/test13.php	2012-03-27 00:56:11 +0000
+++ swig/php/tests/test13.php	1970-01-01 00:00:00 +0000
@@ -1,53 +0,0 @@
-<?
-/*
- * Copyright 2006-2012 The FLWOR Foundation.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * 
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-//require '@phpPath@/Zorba/zorba_api_wrapper.php';
-require 'C:/dev/zapi/build/swig/php/Zorba/zorba_api_wrapper.php';
-
-class MyDiagnosticHandler(zorba_api.DiagnosticHandler): 
-  def error(self, *args):
-    print "Error args: ", args
-
-def test(zorba):
-  #Read and write result
-  print 'Executing: compilerHints.xq'
-  f = open('compilerHints.xq', 'r')
-  lines = f.read()
-  f.close()
-  diagnosticHandler = MyDiagnosticHandler()
-  compilerHints = zorba_api.CompilerHints()
-  compilerHints.setLibModule(True)
-  compilerHints.setOptimizationLevel(0)
-  xquery = zorba.compileQuery(lines, compilerHints, diagnosticHandler)
-  
-  result = xquery.execute()
-  print result
-  return
-
-
-store = zorba_api.InMemoryStore_getInstance()
-zorba = zorba_api.Zorba_getInstance(store)
-
-print "Running: CompileQuery string + Dignostinc handler + CompilerHint - with optimization 0 - setLibModule(True)"
-test(zorba)
-print "Success"
-
-
-zorba.shutdown()
-zorba_api.InMemoryStore_shutdown(store)
-
-?>
\ No newline at end of file

=== removed file 'swig/php/tests/test14.php'
--- swig/php/tests/test14.php	2012-03-27 00:56:11 +0000
+++ swig/php/tests/test14.php	1970-01-01 00:00:00 +0000
@@ -1,53 +0,0 @@
-<?
-/*
- * Copyright 2006-2012 The FLWOR Foundation.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * 
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-//require '@phpPath@/Zorba/zorba_api_wrapper.php';
-require 'C:/dev/zapi/build/swig/php/Zorba/zorba_api_wrapper.php';
-
-class MyDiagnosticHandler(zorba_api.DiagnosticHandler): 
-  def error(self, *args):
-    print "Error args: ", args
-
-def test(zorba):
-  #Read and write result
-  print 'Executing: compilerHints.xq'
-  f = open('compilerHints.xq', 'r')
-  lines = f.read()
-  f.close()
-  diagnosticHandler = MyDiagnosticHandler()
-  compilerHints = zorba_api.CompilerHints()
-  compilerHints.setLibModule(True)
-  compilerHints.setOptimizationLevel(1)
-  xquery = zorba.compileQuery(lines, compilerHints, diagnosticHandler)
-  
-  result = xquery.execute()
-  print result
-  return
-
-
-store = zorba_api.InMemoryStore_getInstance()
-zorba = zorba_api.Zorba_getInstance(store)
-
-print "Running: CompileQuery string + Dignostinc handler + CompilerHint - with optimization 1 - setLibModule(True)"
-test(zorba)
-print "Success"
-
-
-zorba.shutdown()
-zorba_api.InMemoryStore_shutdown(store)
-
-?>
\ No newline at end of file

=== removed file 'swig/php/tests/zorba_api.php'
--- swig/php/tests/zorba_api.php	2012-03-27 00:56:11 +0000
+++ swig/php/tests/zorba_api.php	1970-01-01 00:00:00 +0000
@@ -1,178 +0,0 @@
-<?php
-/*
- * Copyright 2006-2012 The FLWOR Foundation.
- * 
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * 
- * http://www.apache.org/licenses/LICENSE-2.0
- * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-// Try to load our extension if it's not already loaded.
-if (!extension_loaded("zorba_api")) {
-  if (strtolower(substr(PHP_OS, 0, 3)) === 'win') {
-    if (!dl('zorba_api.dll')) return;
-  } else {
-    // PHP_SHLIB_SUFFIX is available as of PHP 4.3.0, for older PHP assume 'so'.
-    // It gives 'dylib' on MacOS X which is for libraries, modules are 'so'.
-    if (PHP_SHLIB_SUFFIX === 'PHP_SHLIB_SUFFIX' || PHP_SHLIB_SUFFIX === 'dylib') {
-      if (!dl('zorba_api.so')) return;
-    } else {
-      if (!dl('zorba_api.'.PHP_SHLIB_SUFFIX)) return;
-    }
-  }
-}
-
-class Item {
-  public $_cPtr=null;
-
-  static function createEmptyItem() {
-    $r=Item_createEmptyItem();
-    return is_resource($r) ? new Item($r) : $r;
-  }
-
-  function getStringValue() {
-    return Item_getStringValue($this->_cPtr);
-  }
-
-  function __construct() {
-    $this->_cPtr=new_Item();
-  }
-}
-
-class Iterator {
-  public $_cPtr=null;
-
-  function open() {
-    Iterator_open($this->_cPtr);
-  }
-
-  function next($arg1) {
-    return Iterator_next($this->_cPtr,$arg1);
-  }
-
-  function close() {
-    Iterator_close($this->_cPtr);
-  }
-
-  function destroy() {
-    Iterator_destroy($this->_cPtr);
-  }
-
-  function __construct($cPtr) {
-    $this->_cPtr=$cPtr;
-  }
-
-  public function __destruct() {
-    $this->destroy();
-  }
-}
-
-class XQuery {
-  public $_cPtr=null;
-
-  function execute() {
-    return XQuery_execute($this->_cPtr);
-  }
-
-  function isUpdateQuery() {
-    return XQuery_isUpdateQuery($this->_cPtr);
-  }
-
-  function applyUpdates() {
-    XQuery_applyUpdates($this->_cPtr);
-  }
-
-  function destroy() {
-    XQuery_destroy($this->_cPtr);
-  }
-
-  function iterator() {
-    $r=XQuery_iterator($this->_cPtr);
-    return is_resource($r) ? new Iterator($r) : $r;
-  }
-
-  function __construct($cPtr) {
-    $this->_cPtr=$cPtr;
-  }
-
-  function __destruct() {
-    $this->destroy();
-  }
-}
-
-class Store {
-  //public $_cPtr=null;
-
-  //function __construct() {
-  //  $this->_cPtr=new_Store();
-  //}
-}
-
-class InMemoryStore extends Store {
-  public $_cPtr=null;
-
-  static function getInstance() {
-    $r=InMemoryStore_getInstance();
-    return is_resource($r) ? new InMemoryStore($r) : $r;
-  }
-
-  static function shutdown($arg1) {
-    InMemoryStore_shutdown($arg1);
-  }
-
-  private function __construct($cPtr) {
-    $this->_cPtr=$cPtr;
-  }
-}
-
-class XmlDataManager {
-  public $_cPtr=null;
-
-  function loadDocument($aName,$aContent) {
-    XmlDataManager_loadDocument($this->_cPtr,$aName,$aContent);
-  }
-
-  function deleteDocument($aName) {
-    return XmlDataManager_deleteDocument($this->_cPtr,$aName);
-  }
-
-  function __construct($cPtr) {
-    $this->_cPtr=$cPtr;
-  }
-}
-
-class Zorba {
-  public $_cPtr=null;
-
-  static function getInstance($arg1) {
-    $r=Zorba_getInstance($arg1->_cPtr);
-    return is_resource($r) ? new Zorba($r) : $r;
-  }
-
-  function compileQuery($aStr) {
-    $r=Zorba_compileQuery($this->_cPtr,$aStr);
-    return is_resource($r) ? new XQuery($r) : $r;
-  }
-
-  function getXmlDataManager() {
-    $r=Zorba_getXmlDataManager($this->_cPtr);
-    return is_resource($r) ? new XmlDataManager($r) : $r;
-  }
-
-  function shutdown() {
-    Zorba_shutdown($this->_cPtr);
-  }
-
-  private function __construct($cPtr) {
-    $this->_cPtr=$cPtr;
-  }
-}
-?>

=== modified file 'swig/php/zorba_api.i'
--- swig/php/zorba_api.i	2013-02-07 17:24:36 +0000
+++ swig/php/zorba_api.i	2013-03-27 00:42:25 +0000
@@ -13,6 +13,9 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
+
+%rename (IteratorImpl) Iterator;
+
 %begin %{
 #include <iostream>
 
@@ -36,8 +39,13 @@
 %{
 #include "zend_exceptions.h"
 %}
+
+TSRMLS_FETCH();
+
 %include ../zorba_api.i
+
 %{
+
 #define SWIG_exception(code, msg) { mt_zend_throw_exception(0, msg, code TSRMLS_CC); }
 
 ZEND_API zval * mt_zend_throw_exception(zend_class_entry *exception_ce, const char *message, long code TSRMLS_DC);

=== removed file 'swig/php/zorba_api_wrapper.php'
--- swig/php/zorba_api_wrapper.php	2013-02-07 17:24:36 +0000
+++ swig/php/zorba_api_wrapper.php	1970-01-01 00:00:00 +0000
@@ -1,1215 +0,0 @@
-<?php
-//Try to load the extension if it's not already loaded.
-if(!extension_loaded('zorba_api')) {
-  $zorbaExtNotLoaded = "Zorba extension couldn't loaded";
-  if(function_exists('dl')) {
-    if(strtolower(substr(PHP_OS, 0, 3)) === 'win') {
-      if(!dl('zorba_api.dll')) {
-        throw new Exception($zorbaExtNotLoaded);
-      }  
-    } else {
-      $suffix = "so";
-      if(PHP_SHLIB_SUFFIX === 'PHP_SHLIB_SUFFIX' || PHP_SHLIB_SUFFIX === 'dylib') {
-        $suffix = PHP_SHLIB_SUFFIX;
-      }
-      if(!dl('zorba_api.'.$suffix)) {
-        if(!dl('libzorba_api.'.$suffix)) {
-          throw new Exception($zorbaExtNotLoaded);
-        }
-      }
-    }
-  } else {
-    throw new Exception($zorbaExtNotLoaded);
-  }
-}
-
-class DynamicContext{
-  public $_cPtr=null;
-
-  public function __set($var, $value) {
-    $r =  DynamicContext___set($this->_cPtr, $var, $value);
-    return $r;
-
-  }
-
-  public function __isset($var) {
-    $r =  DynamicContext___isset($this->_cPtr, $var);
-    return $r;
-
-  }
-
-  public function __get($var) {
-    $r =  DynamicContext___get($this->_cPtr, $var);
-    return $r;
-
-  }
-
-  public function setVariable($aNamespace, $aLocalname, $arg3) {
-    $r =  DynamicContext_setVariable($this->_cPtr, $aNamespace, $aLocalname, $arg3);
-    return $r;
-
-  }
-
-  public function setContextItem($arg1) {
-    $r =  DynamicContext_setContextItem($this->_cPtr, $arg1);
-    return $r;
-
-  }
-
-  public function __construct($ptr) {
-  	$this->_cPtr = $ptr;
-  }
-
-}
-
-class Item{
-  public $_cPtr=null;
-
-  public function __set($var, $value) {
-    $r =  Item___set($this->_cPtr, $var, $value);
-    return $r;
-
-  }
-
-  public function __isset($var) {
-    $r =  Item___isset($this->_cPtr, $var);
-    return $r;
-
-  }
-
-  public function __get($var) {
-    $r =  Item___get($this->_cPtr, $var);
-    return $r;
-
-  }
-
-  static  public function createEmptyItem() {
-    $r =  Item_createEmptyItem();
-    return is_resource($r) ? new Item($r) : $r;
-
-  }
-
-  public function getStringValue() {
-    $r =  Item_getStringValue($this->_cPtr);
-    return $r;
-
-  }
-
-  public function serialize() {
-    $r =  Item_serialize($this->_cPtr);
-    return $r;
-
-  }
-
-  public function getAtomizationValue() {
-    $r =  Item_getAtomizationValue($this->_cPtr);
-    return is_resource($r) ? new IteratorImpl($r) : $r;
-
-  }
-
-  public function getAttributes() {
-    $r =  Item_getAttributes($this->_cPtr);
-    return is_resource($r) ? new IteratorImpl($r) : $r;
-
-  }
-
-  public function getBooleanValue() {
-    $r =  Item_getBooleanValue($this->_cPtr);
-    return $r;
-
-  }
-
-  public function getChildren() {
-    $r =  Item_getChildren($this->_cPtr);
-    return is_resource($r) ? new IteratorImpl($r) : $r;
-
-  }
-
-  public function getEBV() {
-    $r =  Item_getEBV($this->_cPtr);
-    return is_resource($r) ? new Item($r) : $r;
-
-  }
-
-  public function getIntValue() {
-    $r =  Item_getIntValue($this->_cPtr);
-    return $r;
-
-  }
-
-  public function getLocalName() {
-    $r =  Item_getLocalName($this->_cPtr);
-    return $r;
-
-  }
-
-  public function getNamespace() {
-    $r =  Item_getNamespace($this->_cPtr);
-    return $r;
-
-  }
-
-  public function getNodeName($aNodeName) {
-    $r =  Item_getNodeName($this->_cPtr, $aNodeName);
-    return $r;
-
-  }
-
-  public function getPrefix() {
-    $r =  Item_getPrefix($this->_cPtr);
-    return $r;
-
-  }
-
-  public function getType() {
-    $r =  Item_getType($this->_cPtr);
-    return is_resource($r) ? new Item($r) : $r;
-
-  }
-
-  public function getUnsignedIntValue() {
-    $r =  Item_getUnsignedIntValue($this->_cPtr);
-    return $r;
-
-  }
-
-  public function getNodeKind() {
-    $r =  Item_getNodeKind($this->_cPtr);
-    return $r;
-
-  }
-
-  public function isAtomic() {
-    $r =  Item_isAtomic($this->_cPtr);
-    return $r;
-
-  }
-
-  public function isNaN() {
-    $r =  Item_isNaN($this->_cPtr);
-    return $r;
-
-  }
-
-  public function isNode() {
-    $r =  Item_isNode($this->_cPtr);
-    return $r;
-
-  }
-
-  public function isNull() {
-    $r =  Item_isNull($this->_cPtr);
-    return $r;
-
-  }
-
-  public function isPosOrNegInf() {
-    $r =  Item_isPosOrNegInf($this->_cPtr);
-    return $r;
-
-  }
-
-  public function __construct($ptr) {
-  	$this->_cPtr = $ptr;
-  }
-
-}
-
-class IteratorImpl{
-  public $_cPtr=null;
-
-  public function __set($var, $value) {
-    $r =  Iterator___set($this->_cPtr, $var, $value);
-    return $r;
-
-  }
-
-  public function __isset($var) {
-    $r =  Iterator___isset($this->_cPtr, $var);
-    return $r;
-
-  }
-
-  public function __get($var) {
-    $r =  Iterator___get($this->_cPtr, $var);
-    return $r;
-
-  }
-
-  public function open() {
-    $r =  Iterator_open($this->_cPtr);
-    return $r;
-
-  }
-
-  public function next($arg1) {
-    $r =  Iterator_next($this->_cPtr, $arg1);
-    return $r;
-
-  }
-
-  public function close() {
-    $r =  Iterator_close($this->_cPtr);
-    return $r;
-
-  }
-
-  public function destroy() {
-    $r =  Iterator_destroy($this->_cPtr);
-    return $r;
-
-  }
-
-  public function __construct($ptr) {
-  	$this->_cPtr = $ptr;
-  }
-
-}
-
-class XQuery{
-  public $_cPtr=null;
-
-  public function __set($var, $value) {
-    $r =  XQuery___set($this->_cPtr, $var, $value);
-    return $r;
-
-  }
-
-  public function __isset($var) {
-    $r =  XQuery___isset($this->_cPtr, $var);
-    return $r;
-
-  }
-
-  public function __get($var) {
-    $r =  XQuery___get($this->_cPtr, $var);
-    return $r;
-
-  }
-
-  public function execute() {
-    $r =  XQuery_execute($this->_cPtr);
-    return $r;
-
-  }
-
-  public function printPlanAsXML() {
-    $r =  XQuery_printPlanAsXML($this->_cPtr);
-    return $r;
-
-  }
-
-  public function printPlanAsDOT() {
-    $r =  XQuery_printPlanAsDOT($this->_cPtr);
-    return $r;
-
-  }
-
-  public function compile($aQuery, $aStaticContext=null) {
-    switch(func_num_args()) {
-    case 1: $r =  XQuery_compile($this->_cPtr, $aQuery);break;
-    case 2: $r =  XQuery_compile($this->_cPtr, $aQuery, $aStaticContext);break;
-    default: $r =  XQuery_compile($this->_cPtr, $aQuery, $aStaticContext);
-    }
-    return $r;
-
-  }
-
-  public function destroy() {
-    $r =  XQuery_destroy($this->_cPtr);
-    return $r;
-
-  }
-
-  public function iterator() {
-    $r =  XQuery_iterator($this->_cPtr);
-    return is_resource($r) ? new IteratorImpl($r) : $r;
-
-  }
-
-  public function getDynamicContext() {
-    $r =  XQuery_getDynamicContext($this->_cPtr);
-    return is_resource($r) ? new DynamicContext($r) : $r;
-
-  }
-
-  public function __construct($ptr) {
-  	$this->_cPtr = $ptr;
-  }
-
-}
-
-class Store{
-  public $_cPtr=null;
-
-  public function __set($var, $value) {
-    $r =  Store___set($this->_cPtr, $var, $value);
-    return $r;
-
-  }
-
-  public function __isset($var) {
-    $r =  Store___isset($this->_cPtr, $var);
-    return $r;
-
-  }
-
-  public function __get($var) {
-    $r =  Store___get($this->_cPtr, $var);
-    return $r;
-
-  }
-
-  public function __construct($ptr) {
-  	$this->_cPtr = $ptr;
-  }
-
-}
-
-class InMemoryStore extends Store{
-  public $_cPtr=null;
-
-  static  public function getInstance() {
-    $r =  InMemoryStore_getInstance();
-    return is_resource($r) ? new InMemoryStore($r) : $r;
-
-  }
-
-  static  public function shutdown($arg1) {
-    $r =  InMemoryStore_shutdown($arg1);
-    return $r;
-
-  }
-
-}
-
-class DocumentManager{
-  public $_cPtr=null;
-
-  public function __set($var, $value) {
-    $r =  DocumentManager___set($this->_cPtr, $var, $value);
-    return $r;
-
-  }
-
-  public function __isset($var) {
-    $r =  DocumentManager___isset($this->_cPtr, $var);
-    return $r;
-
-  }
-
-  public function __get($var) {
-    $r =  DocumentManager___get($this->_cPtr, $var);
-    return $r;
-
-  }
-
-  public function put($aName, $aDoc) {
-    $r =  DocumentManager_put($this->_cPtr, $aName, $aDoc);
-    return $r;
-
-  }
-
-  public function remove($aName) {
-    $r =  DocumentManager_remove($this->_cPtr, $aName);
-    return $r;
-
-  }
-
-  public function document($aName) {
-    $r =  DocumentManager_document($this->_cPtr, $aName);
-    return is_resource($r) ? new Item($r) : $r;
-
-  }
-
-  public function isAvailableDocument($aName) {
-    $r =  DocumentManager_isAvailableDocument($this->_cPtr, $aName);
-    return $r;
-
-  }
-
-  public function __construct($ptr) {
-  	$this->_cPtr = $ptr;
-  }
-
-}
-
-class XmlDataManager{
-  public $_cPtr=null;
-
-  public function __set($var, $value) {
-    $r =  XmlDataManager___set($this->_cPtr, $var, $value);
-    return $r;
-
-  }
-
-  public function __isset($var) {
-    $r =  XmlDataManager___isset($this->_cPtr, $var);
-    return $r;
-
-  }
-
-  public function __get($var) {
-    $r =  XmlDataManager___get($this->_cPtr, $var);
-    return $r;
-
-  }
-
-  public function getDocumentManager() {
-    $r =  XmlDataManager_getDocumentManager($this->_cPtr);
-    return is_resource($r) ? new DocumentManager($r) : $r;
-
-  }
-
-  public function parseXML($aDoc) {
-    $r =  XmlDataManager_parseXML($this->_cPtr, $aDoc);
-    return is_resource($r) ? new IteratorImpl($r) : $r;
-
-  }
-
-  public function __construct($ptr) {
-  	$this->_cPtr = $ptr;
-  }
-
-}
-
-class ZorbaException{
-  public $_cPtr=null;
-
-  public function __set($var, $value) {
-    $r =  ZorbaException___set($this->_cPtr, $var, $value);
-    return $r;
-
-  }
-
-  public function __isset($var) {
-    $r =  ZorbaException___isset($this->_cPtr, $var);
-    return $r;
-
-  }
-
-  public function __get($var) {
-    $r =  ZorbaException___get($this->_cPtr, $var);
-    return $r;
-
-  }
-
-  public function __construct($ptr) {
-  	$this->_cPtr = $ptr;
-  }
-
-  public function getDescription() {
-    $r =  ZorbaException_getDescription($this->_cPtr);
-    return $r;
-
-  }
-
-  public function getErrorCode() {
-    $r =  ZorbaException_getErrorCode($this->_cPtr);
-    return $r;
-
-  }
-
-  public function getFileLineNumber() {
-    $r =  ZorbaException_getFileLineNumber($this->_cPtr);
-    return $r;
-
-  }
-
-  public function getFileName() {
-    $r =  ZorbaException_getFileName($this->_cPtr);
-    return $r;
-
-  }
-
-  static  public function getErrorCodeAsString($aErrorCode) {
-    $r =  ZorbaException_getErrorCodeAsString($aErrorCode);
-    return $r;
-
-  }
-
-}
-
-class XQueryException extends ZorbaException{
-  public $_cPtr=null;
-
-  public function getColumnBegin() {
-    $r =  XQueryException_getColumnBegin($this->_cPtr);
-    return $r;
-
-  }
-
-  public function getLineBegin() {
-    $r =  XQueryException_getLineBegin($this->_cPtr);
-    return $r;
-
-  }
-
-  public function getQueryURI() {
-    $r =  XQueryException_getQueryURI($this->_cPtr);
-    return $r;
-
-  }
-
-}
-
-class CompilerHints{
-  public $_cPtr=null;
-
-  public function __set($var, $value) {
-    $r =  CompilerHints___set($this->_cPtr, $var, $value);
-    return $r;
-
-  }
-
-  public function __isset($var) {
-    $r =  CompilerHints___isset($this->_cPtr, $var);
-    return $r;
-
-  }
-
-  public function __get($var) {
-    $r =  CompilerHints___get($this->_cPtr, $var);
-    return $r;
-
-  }
-
-  public function getLibModule() {
-    $r =  CompilerHints_getLibModule($this->_cPtr);
-    return $r;
-
-  }
-
-  public function setLibModule($aLibModule) {
-    $r =  CompilerHints_setLibModule($this->_cPtr, $aLibModule);
-    return $r;
-
-  }
-
-  public function getOptimizationLevel() {
-    $r =  CompilerHints_getOptimizationLevel($this->_cPtr);
-    return $r;
-
-  }
-
-  public function setOptimizationLevel($aOptLevel) {
-    $r =  CompilerHints_setOptimizationLevel($this->_cPtr, $aOptLevel);
-    return $r;
-
-  }
-
-  public function __construct($ptr) {
-  	$this->_cPtr = $ptr;
-  }
-
-}
-
-class StaticContext{
-  public $_cPtr=null;
-
-  public function __set($var, $value) {
-    $r =  StaticContext___set($this->_cPtr, $var, $value);
-    return $r;
-
-  }
-
-  public function __isset($var) {
-    $r =  StaticContext___isset($this->_cPtr, $var);
-    return $r;
-
-  }
-
-  public function __get($var) {
-    $r =  StaticContext___get($this->_cPtr, $var);
-    return $r;
-
-  }
-
-  public function __construct($ptr) {
-  	$this->_cPtr = $ptr;
-  }
-
-  public function addColation($aURI) {
-    $r =  StaticContext_addColation($this->_cPtr, $aURI);
-    return $r;
-
-  }
-
-  public function addNamespace($aPrefix, $aURI) {
-    $r =  StaticContext_addNamespace($this->_cPtr, $aPrefix, $aURI);
-    return $r;
-
-  }
-
-  public function addReference() {
-    $r =  StaticContext_addReference($this->_cPtr);
-    return $r;
-
-  }
-
-  public function containsFunction($aFnNameUri, $aFnNameLocal, $arity) {
-    $r =  StaticContext_containsFunction($this->_cPtr, $aFnNameUri, $aFnNameLocal, $arity);
-    return $r;
-
-  }
-
-  public function createChildContext() {
-    $r =  StaticContext_createChildContext($this->_cPtr);
-    return is_resource($r) ? new StaticContext($r) : $r;
-
-  }
-
-  public function declareOption($aQName, $aOptionVal) {
-    $r =  StaticContext_declareOption($this->_cPtr, $aQName, $aOptionVal);
-    return $r;
-
-  }
-
-  public function disableFunction($aQName, $arity) {
-    $r =  StaticContext_disableFunction($this->_cPtr, $aQName, $arity);
-    return $r;
-
-  }
-
-  public function free() {
-    $r =  StaticContext_free($this->_cPtr);
-    return $r;
-
-  }
-
-  public function getBaseURI() {
-    $r =  StaticContext_getBaseURI($this->_cPtr);
-    return $r;
-
-  }
-
-  public function getBoundarySpacePolicy() {
-    $r =  StaticContext_getBoundarySpacePolicy($this->_cPtr);
-    return $r;
-
-  }
-
-  public function getConstructionMode() {
-    $r =  StaticContext_getConstructionMode($this->_cPtr);
-    return $r;
-
-  }
-
-  public function getCopyNamespacesMode($aPreserve, $aInherit) {
-    $r =  StaticContext_getCopyNamespacesMode($this->_cPtr, $aPreserve, $aInherit);
-    return $r;
-
-  }
-
-  public function getDefaultCollation() {
-    $r =  StaticContext_getDefaultCollation($this->_cPtr);
-    return $r;
-
-  }
-
-  public function getDefaultElementAndTypeNamespace() {
-    $r =  StaticContext_getDefaultElementAndTypeNamespace($this->_cPtr);
-    return $r;
-
-  }
-
-  public function getDefaultFunctionNamespace() {
-    $r =  StaticContext_getDefaultFunctionNamespace($this->_cPtr);
-    return $r;
-
-  }
-
-  public function getDefaultOrderForEmptySequences() {
-    $r =  StaticContext_getDefaultOrderForEmptySequences($this->_cPtr);
-    return $r;
-
-  }
-
-  public function getNamespaceURIByPrefix($aPrefix) {
-    $r =  StaticContext_getNamespaceURIByPrefix($this->_cPtr, $aPrefix);
-    return $r;
-
-  }
-
-  public function getOption($aQName, $aOptionValue) {
-    $r =  StaticContext_getOption($this->_cPtr, $aQName, $aOptionValue);
-    return $r;
-
-  }
-
-  public function getOrderingMode() {
-    $r =  StaticContext_getOrderingMode($this->_cPtr);
-    return $r;
-
-  }
-
-  public function getRefCount() {
-    $r =  StaticContext_getRefCount($this->_cPtr);
-    return $r;
-
-  }
-
-  public function getRevalidationMode() {
-    $r =  StaticContext_getRevalidationMode($this->_cPtr);
-    return $r;
-
-  }
-
-  public function getXPath1_0CompatibMode() {
-    $r =  StaticContext_getXPath1_0CompatibMode($this->_cPtr);
-    return $r;
-
-  }
-
-  public function loadProlog($aProlog, $hints) {
-    $r =  StaticContext_loadProlog($this->_cPtr, $aProlog, $hints);
-    return $r;
-
-  }
-
-  public function removeReference() {
-    $r =  StaticContext_removeReference($this->_cPtr);
-    return $r;
-
-  }
-
-  public function resetTraceStream() {
-    $r =  StaticContext_resetTraceStream($this->_cPtr);
-    return $r;
-
-  }
-
-  public function setBaseURI($aBaseURI) {
-    $r =  StaticContext_setBaseURI($this->_cPtr, $aBaseURI);
-    return $r;
-
-  }
-
-  public function setBoundarySpacePolicy($aMode) {
-    $r =  StaticContext_setBoundarySpacePolicy($this->_cPtr, $aMode);
-    return $r;
-
-  }
-
-  public function setConstructionMode($aMode) {
-    $r =  StaticContext_setConstructionMode($this->_cPtr, $aMode);
-    return $r;
-
-  }
-
-  public function setCopyNamespacesMode($aPreserve, $aInherit) {
-    $r =  StaticContext_setCopyNamespacesMode($this->_cPtr, $aPreserve, $aInherit);
-    return $r;
-
-  }
-
-  public function setDefaultCollation($aURI) {
-    $r =  StaticContext_setDefaultCollation($this->_cPtr, $aURI);
-    return $r;
-
-  }
-
-  public function setDefaultElementAndTypeNamespace($aURI) {
-    $r =  StaticContext_setDefaultElementAndTypeNamespace($this->_cPtr, $aURI);
-    return $r;
-
-  }
-
-  public function setDefaultFunctionNamespace($aURI) {
-    $r =  StaticContext_setDefaultFunctionNamespace($this->_cPtr, $aURI);
-    return $r;
-
-  }
-
-  public function setDefaultOrderForEmptySequences($aMode) {
-    $r =  StaticContext_setDefaultOrderForEmptySequences($this->_cPtr, $aMode);
-    return $r;
-
-  }
-
-  public function setOrderingMode($aMode) {
-    $r =  StaticContext_setOrderingMode($this->_cPtr, $aMode);
-    return $r;
-
-  }
-
-  public function setRevalidationMode($aMode) {
-    $r =  StaticContext_setRevalidationMode($this->_cPtr, $aMode);
-    return $r;
-
-  }
-
-  public function setXPath1_0CompatibMode($aMode) {
-    $r =  StaticContext_setXPath1_0CompatibMode($this->_cPtr, $aMode);
-    return $r;
-
-  }
-
-  public function destroy() {
-    $r =  StaticContext_destroy($this->_cPtr);
-    return $r;
-
-  }
-
-}
-
-class Zorba{
-  public $_cPtr=null;
-
-  public function __set($var, $value) {
-    $r =  Zorba___set($this->_cPtr, $var, $value);
-    return $r;
-
-  }
-
-  public function __isset($var) {
-    $r =  Zorba___isset($this->_cPtr, $var);
-    return $r;
-
-  }
-
-  public function __get($var) {
-    $r =  Zorba___get($this->_cPtr, $var);
-    return $r;
-
-  }
-
-  static  public function getInstance($arg1) {
-    $r =  Zorba_getInstance($arg1);
-    return is_resource($r) ? new Zorba($r) : $r;
-
-  }
-
-  public function createStaticContext() {
-    $r =  Zorba_createStaticContext($this->_cPtr);
-    return is_resource($r) ? new StaticContext($r) : $r;
-
-  }
-
-  public function createQuery() {
-    $r =  Zorba_createQuery($this->_cPtr);
-    return is_resource($r) ? new XQuery($r) : $r;
-
-  }
-
-  public function compileQuery($aStr, $aStaticContext=null) {
-    switch(func_num_args()) {
-    case 1: $r =  Zorba_compileQuery($this->_cPtr, $aStr);break;
-    case 2: $r =  Zorba_compileQuery($this->_cPtr, $aStr, $aStaticContext);break;
-    default: $r =  Zorba_compileQuery($this->_cPtr, $aStr, $aStaticContext);
-    }
-    return is_resource($r) ? new XQuery($r) : $r;
-
-  }
-
-  public function getItemFactory() {
-    $r =  Zorba_getItemFactory($this->_cPtr);
-    return is_resource($r) ? new ItemFactory($r) : $r;
-
-  }
-
-  public function getXmlDataManager() {
-    $r =  Zorba_getXmlDataManager($this->_cPtr);
-    return is_resource($r) ? new XmlDataManager($r) : $r;
-
-  }
-
-  public function shutdown() {
-    $r =  Zorba_shutdown($this->_cPtr);
-    return $r;
-
-  }
-
-  public function __construct($ptr) {
-  	$this->_cPtr = $ptr;
-  }
-
-}
-
-class ItemFactory{
-  public $_cPtr=null;
-
-  public function __set($var, $value) {
-    $r =  ItemFactory___set($this->_cPtr, $var, $value);
-    return $r;
-
-  }
-
-  public function __isset($var) {
-    $r =  ItemFactory___isset($this->_cPtr, $var);
-    return $r;
-
-  }
-
-  public function __get($var) {
-    $r =  ItemFactory___get($this->_cPtr, $var);
-    return $r;
-
-  }
-
-  public function __construct($ptr) {
-  	$this->_cPtr = $ptr;
-  }
-
-  public function createAnyURI($aURI) {
-    $r =  ItemFactory_createAnyURI($this->_cPtr, $aURI);
-    return is_resource($r) ? new Item($r) : $r;
-
-  }
-
-  public function createAttributeNode($aParent, $aNodeName, $aTypeName, $aTypedValue) {
-    $r =  ItemFactory_createAttributeNode($this->_cPtr, $aParent, $aNodeName, $aTypeName, $aTypedValue);
-    return is_resource($r) ? new Item($r) : $r;
-
-  }
-
-  public function createBase64Binary($aBinData_or_aStream, $aLength=null) {
-    switch(func_num_args()) {
-    case 1: $r =  ItemFactory_createBase64Binary($this->_cPtr, $aBinData_or_aStream);break;
-    case 2: $r =  ItemFactory_createBase64Binary($this->_cPtr, $aBinData_or_aStream, $aLength);break;
-    default: $r =  ItemFactory_createBase64Binary($this->_cPtr, $aBinData_or_aStream, $aLength);
-    }
-    return is_resource($r) ? new Item($r) : $r;
-
-  }
-
-  public function createBoolean($aValue) {
-    $r =  ItemFactory_createBoolean($this->_cPtr, $aValue);
-    return is_resource($r) ? new Item($r) : $r;
-
-  }
-
-  public function createByte($aByte) {
-    $r =  ItemFactory_createByte($this->_cPtr, $aByte);
-    return is_resource($r) ? new Item($r) : $r;
-
-  }
-
-  public function createDate($aDate_or_aYear, $aMonth=null, $aDay=null) {
-    switch(func_num_args()) {
-    case 1: $r =  ItemFactory_createDate($this->_cPtr, $aDate_or_aYear);break;
-    case 2: $r =  ItemFactory_createDate($this->_cPtr, $aDate_or_aYear, $aMonth);break;
-    case 3: $r =  ItemFactory_createDate($this->_cPtr, $aDate_or_aYear, $aMonth, $aDay);break;
-    default: $r =  ItemFactory_createDate($this->_cPtr, $aDate_or_aYear, $aMonth, $aDay);
-    }
-    return is_resource($r) ? new Item($r) : $r;
-
-  }
-
-  public function createDateTime($aDateTimeValue_or_aYear, $aMonth=null, $aDay=null, $aHour=null, $aMinute=null, $aSecond=null, $aTimeZone_hours=null) {
-    switch(func_num_args()) {
-    case 1: $r =  ItemFactory_createDateTime($this->_cPtr, $aDateTimeValue_or_aYear);break;
-    case 2: $r =  ItemFactory_createDateTime($this->_cPtr, $aDateTimeValue_or_aYear, $aMonth);break;
-    case 3: $r =  ItemFactory_createDateTime($this->_cPtr, $aDateTimeValue_or_aYear, $aMonth, $aDay);break;
-    case 4: $r =  ItemFactory_createDateTime($this->_cPtr, $aDateTimeValue_or_aYear, $aMonth, $aDay, $aHour);break;
-    case 5: $r =  ItemFactory_createDateTime($this->_cPtr, $aDateTimeValue_or_aYear, $aMonth, $aDay, $aHour, $aMinute);break;
-    case 6: $r =  ItemFactory_createDateTime($this->_cPtr, $aDateTimeValue_or_aYear, $aMonth, $aDay, $aHour, $aMinute, $aSecond);break;
-    case 7: $r =  ItemFactory_createDateTime($this->_cPtr, $aDateTimeValue_or_aYear, $aMonth, $aDay, $aHour, $aMinute, $aSecond, $aTimeZone_hours);break;
-    default: $r =  ItemFactory_createDateTime($this->_cPtr, $aDateTimeValue_or_aYear, $aMonth, $aDay, $aHour, $aMinute, $aSecond, $aTimeZone_hours);
-    }
-    return is_resource($r) ? new Item($r) : $r;
-
-  }
-
-  public function createDecimal($aValue) {
-    $r =  ItemFactory_createDecimal($this->_cPtr, $aValue);
-    return is_resource($r) ? new Item($r) : $r;
-
-  }
-
-  public function createDecimalFromDouble($aValue) {
-    $r =  ItemFactory_createDecimalFromDouble($this->_cPtr, $aValue);
-    return is_resource($r) ? new Item($r) : $r;
-
-  }
-
-  public function createDecimalFromLong($aValue) {
-    $r =  ItemFactory_createDecimalFromLong($this->_cPtr, $aValue);
-    return is_resource($r) ? new Item($r) : $r;
-
-  }
-
-  public function createDouble($aValue) {
-    $r =  ItemFactory_createDouble($this->_cPtr, $aValue);
-    return is_resource($r) ? new Item($r) : $r;
-
-  }
-
-  public function createDuration($aValue_or_aYear, $aMonths=null, $aDays=null, $aHours=null, $aMinutes=null, $aSeconds=null) {
-    switch(func_num_args()) {
-    case 1: $r =  ItemFactory_createDuration($this->_cPtr, $aValue_or_aYear);break;
-    case 2: $r =  ItemFactory_createDuration($this->_cPtr, $aValue_or_aYear, $aMonths);break;
-    case 3: $r =  ItemFactory_createDuration($this->_cPtr, $aValue_or_aYear, $aMonths, $aDays);break;
-    case 4: $r =  ItemFactory_createDuration($this->_cPtr, $aValue_or_aYear, $aMonths, $aDays, $aHours);break;
-    case 5: $r =  ItemFactory_createDuration($this->_cPtr, $aValue_or_aYear, $aMonths, $aDays, $aHours, $aMinutes);break;
-    case 6: $r =  ItemFactory_createDuration($this->_cPtr, $aValue_or_aYear, $aMonths, $aDays, $aHours, $aMinutes, $aSeconds);break;
-    default: $r =  ItemFactory_createDuration($this->_cPtr, $aValue_or_aYear, $aMonths, $aDays, $aHours, $aMinutes, $aSeconds);
-    }
-    return is_resource($r) ? new Item($r) : $r;
-
-  }
-
-  public function createFloat($aValue) {
-    $r =  ItemFactory_createFloat($this->_cPtr, $aValue);
-    return is_resource($r) ? new Item($r) : $r;
-
-  }
-
-  public function createGDay($aValue_or_aDay) {
-    $r =  ItemFactory_createGDay($this->_cPtr, $aValue_or_aDay);
-    return is_resource($r) ? new Item($r) : $r;
-
-  }
-
-  public function createGMonth($aValue_or_aMonth) {
-    $r =  ItemFactory_createGMonth($this->_cPtr, $aValue_or_aMonth);
-    return is_resource($r) ? new Item($r) : $r;
-
-  }
-
-  public function createGMonthDay($aValue_or_aMonth, $aDay=null) {
-    switch(func_num_args()) {
-    case 1: $r =  ItemFactory_createGMonthDay($this->_cPtr, $aValue_or_aMonth);break;
-    case 2: $r =  ItemFactory_createGMonthDay($this->_cPtr, $aValue_or_aMonth, $aDay);break;
-    default: $r =  ItemFactory_createGMonthDay($this->_cPtr, $aValue_or_aMonth, $aDay);
-    }
-    return is_resource($r) ? new Item($r) : $r;
-
-  }
-
-  public function createGYear($aYear_or_aValue) {
-    $r =  ItemFactory_createGYear($this->_cPtr, $aYear_or_aValue);
-    return is_resource($r) ? new Item($r) : $r;
-
-  }
-
-  public function createGYearMonth($aValue_or_aYear, $aMonth=null) {
-    switch(func_num_args()) {
-    case 1: $r =  ItemFactory_createGYearMonth($this->_cPtr, $aValue_or_aYear);break;
-    case 2: $r =  ItemFactory_createGYearMonth($this->_cPtr, $aValue_or_aYear, $aMonth);break;
-    default: $r =  ItemFactory_createGYearMonth($this->_cPtr, $aValue_or_aYear, $aMonth);
-    }
-    return is_resource($r) ? new Item($r) : $r;
-
-  }
-
-  public function createHexBinary($aHexData, $aSize) {
-    $r =  ItemFactory_createHexBinary($this->_cPtr, $aHexData, $aSize);
-    return is_resource($r) ? new Item($r) : $r;
-
-  }
-
-  public function createInt($aInt) {
-    $r =  ItemFactory_createInt($this->_cPtr, $aInt);
-    return is_resource($r) ? new Item($r) : $r;
-
-  }
-
-  public function createInteger($aInteger) {
-    $r =  ItemFactory_createInteger($this->_cPtr, (string)$aInteger);
-    return is_resource($r) ? new Item($r) : $r;
-
-  }
-
-  public function createLong($aLong) {
-    $r =  ItemFactory_createLong($this->_cPtr, $aLong);
-    return is_resource($r) ? new Item($r) : $r;
-
-  }
-
-  public function createNCName($aValue) {
-    $r =  ItemFactory_createNCName($this->_cPtr, $aValue);
-    return is_resource($r) ? new Item($r) : $r;
-
-  }
-
-  public function createNegativeInteger($aValue) {
-    $r =  ItemFactory_createNegativeInteger($this->_cPtr, $aValue);
-    return is_resource($r) ? new Item($r) : $r;
-
-  }
-
-  public function createNonNegativeInteger($aValue) {
-    $r =  ItemFactory_createNonNegativeInteger($this->_cPtr, $aValue);
-    return is_resource($r) ? new Item($r) : $r;
-
-  }
-
-  public function createNonPositiveInteger($aValue) {
-    $r =  ItemFactory_createNonPositiveInteger($this->_cPtr, $aValue);
-    return is_resource($r) ? new Item($r) : $r;
-
-  }
-
-  public function createPositiveInteger($aValue) {
-    $r =  ItemFactory_createPositiveInteger($this->_cPtr, $aValue);
-    return is_resource($r) ? new Item($r) : $r;
-
-  }
-
-  public function createQName($aNamespace_or_aQNameString, $aPrefix_or_aLocalname=null, $aLocalname=null) {
-    switch(func_num_args()) {
-    case 1: $r =  ItemFactory_createQName($this->_cPtr, $aNamespace_or_aQNameString);break;
-    case 2: $r =  ItemFactory_createQName($this->_cPtr, $aNamespace_or_aQNameString, $aPrefix_or_aLocalname);break;
-    case 3: $r =  ItemFactory_createQName($this->_cPtr, $aNamespace_or_aQNameString, $aPrefix_or_aLocalname, $aLocalname);break;
-    default: $r =  ItemFactory_createQName($this->_cPtr, $aNamespace_or_aQNameString, $aPrefix_or_aLocalname, $aLocalname);
-    }
-    return is_resource($r) ? new Item($r) : $r;
-
-  }
-
-  public function createShort($aShort) {
-    $r =  ItemFactory_createShort($this->_cPtr, $aShort);
-    return is_resource($r) ? new Item($r) : $r;
-
-  }
-
-  public function createString($aString) {
-    $r =  ItemFactory_createString($this->_cPtr, $aString);
-    return is_resource($r) ? new Item($r) : $r;
-
-  }
-
-  public function createTextNode($parent, $content) {
-    $r =  ItemFactory_createTextNode($this->_cPtr, $parent, $content);
-    return is_resource($r) ? new Item($r) : $r;
-
-  }
-
-  public function createTime($aHour_or_aValue, $aMinute=null, $aSecond=null, $aTimeZone_hours=null) {
-    switch(func_num_args()) {
-    case 1: $r =  ItemFactory_createTime($this->_cPtr, $aHour_or_aValue);break;
-    case 2: $r =  ItemFactory_createTime($this->_cPtr, $aHour_or_aValue, $aMinute);break;
-    case 3: $r =  ItemFactory_createTime($this->_cPtr, $aHour_or_aValue, $aMinute, $aSecond);break;
-    case 4: $r =  ItemFactory_createTime($this->_cPtr, $aHour_or_aValue, $aMinute, $aSecond, $aTimeZone_hours);break;
-    default: $r =  ItemFactory_createTime($this->_cPtr, $aHour_or_aValue, $aMinute, $aSecond, $aTimeZone_hours);
-    }
-    return is_resource($r) ? new Item($r) : $r;
-
-  }
-
-  public function createUnsignedByte($aValue) {
-    $r =  ItemFactory_createUnsignedByte($this->_cPtr, $aValue);
-    return is_resource($r) ? new Item($r) : $r;
-
-  }
-
-  public function createUnsignedInt($aValue) {
-    $r =  ItemFactory_createUnsignedInt($this->_cPtr, $aValue);
-    return is_resource($r) ? new Item($r) : $r;
-
-  }
-
-  public function createUnsignedLong($aValue) {
-    $r =  ItemFactory_createUnsignedLong($this->_cPtr, $aValue);
-    return is_resource($r) ? new Item($r) : $r;
-
-  }
-
-  public function createUnsignedShort($aValue) {
-    $r =  ItemFactory_createUnsignedShort($this->_cPtr, $aValue);
-    return is_resource($r) ? new Item($r) : $r;
-
-  }
-
-}

=== modified file 'swig/python/tests/CMakeLists.txt'
--- swig/python/tests/CMakeLists.txt	2013-02-07 17:24:36 +0000
+++ swig/python/tests/CMakeLists.txt	2013-03-27 00:42:25 +0000
@@ -14,65 +14,66 @@
   
 SET(pythonPath ${CMAKE_BINARY_DIR}/swig/python)
 
-CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/books.xml.in ${CMAKE_CURRENT_BINARY_DIR}/books.xml COPYONLY)
-CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/compilerHints.xq.in ${CMAKE_CURRENT_BINARY_DIR}/compilerHints.xq COPYONLY)
+CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/books.xml ${CMAKE_CURRENT_BINARY_DIR}/books.xml COPYONLY)
+CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/compilerHints.xq ${CMAKE_CURRENT_BINARY_DIR}/compilerHints.xq COPYONLY)
 
-CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/test01.py.in ${CMAKE_CURRENT_BINARY_DIR}/test01.py)
+CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/test01.py ${CMAKE_CURRENT_BINARY_DIR}/test01.py)
 ADD_TEST("python_test01" ${PYTHON_EXECUTABLE} test01.py)
 SET_TESTS_PROPERTIES("python_test01" PROPERTIES PASS_REGULAR_EXPRESSION "Success")
 
-CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/test02.py.in ${CMAKE_CURRENT_BINARY_DIR}/test02.py)
+CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/test02.py ${CMAKE_CURRENT_BINARY_DIR}/test02.py)
 ADD_TEST("python_test02" ${PYTHON_EXECUTABLE} test02.py)
 SET_TESTS_PROPERTIES("python_test02" PROPERTIES PASS_REGULAR_EXPRESSION "Success")
 
-CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/test03.py.in ${CMAKE_CURRENT_BINARY_DIR}/test03.py)
+CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/test03.py ${CMAKE_CURRENT_BINARY_DIR}/test03.py)
 ADD_TEST("python_test03" ${PYTHON_EXECUTABLE} test03.py)
 SET_TESTS_PROPERTIES("python_test03" PROPERTIES PASS_REGULAR_EXPRESSION "Success")
 
-CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/test04.py.in ${CMAKE_CURRENT_BINARY_DIR}/test04.py)
+CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/test04.py ${CMAKE_CURRENT_BINARY_DIR}/test04.py)
 ADD_TEST("python_test04" ${PYTHON_EXECUTABLE} test04.py)
-CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/test04.xq.in ${CMAKE_CURRENT_BINARY_DIR}/test04.xq COPYONLY)
+CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/test04.xq ${CMAKE_CURRENT_BINARY_DIR}/test04.xq COPYONLY)
 SET_TESTS_PROPERTIES("python_test04" PROPERTIES PASS_REGULAR_EXPRESSION "Success")
 
-CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/test05.py.in ${CMAKE_CURRENT_BINARY_DIR}/test05.py)
+CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/test05.py ${CMAKE_CURRENT_BINARY_DIR}/test05.py)
 ADD_TEST("python_test05" ${PYTHON_EXECUTABLE} test05.py)
-CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/test05.xq.in ${CMAKE_CURRENT_BINARY_DIR}/test05.xq COPYONLY)
+CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/test05.xq ${CMAKE_CURRENT_BINARY_DIR}/test05.xq COPYONLY)
 SET_TESTS_PROPERTIES("python_test05" PROPERTIES PASS_REGULAR_EXPRESSION "Success")
 
-CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/test06.py.in ${CMAKE_CURRENT_BINARY_DIR}/test06.py)
+CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/test06.py ${CMAKE_CURRENT_BINARY_DIR}/test06.py)
 ADD_TEST("python_test06" ${PYTHON_EXECUTABLE} test06.py)
-CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/test06.xq.in ${CMAKE_CURRENT_BINARY_DIR}/test06.xq COPYONLY)
+CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/test06.xq ${CMAKE_CURRENT_BINARY_DIR}/test06.xq COPYONLY)
 SET_TESTS_PROPERTIES("python_test06" PROPERTIES PASS_REGULAR_EXPRESSION "Success")
 
-CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/test07.1.py.in ${CMAKE_CURRENT_BINARY_DIR}/test07.1.py)
+CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/test07.1.py ${CMAKE_CURRENT_BINARY_DIR}/test07.1.py)
 ADD_TEST("python_test07.1" ${PYTHON_EXECUTABLE} test07.1.py)
-CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/test07.2.py.in ${CMAKE_CURRENT_BINARY_DIR}/test07.2.py)
+CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/test07.2.py ${CMAKE_CURRENT_BINARY_DIR}/test07.2.py)
 ADD_TEST("python_test07.2" ${PYTHON_EXECUTABLE} test07.2.py)
 SET_TESTS_PROPERTIES("python_test07.1" PROPERTIES PASS_REGULAR_EXPRESSION "Success")
 SET_TESTS_PROPERTIES("python_test07.2" PROPERTIES PASS_REGULAR_EXPRESSION "Success")
 
-CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/test08.py.in ${CMAKE_CURRENT_BINARY_DIR}/test08.py)
+CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/test08.py ${CMAKE_CURRENT_BINARY_DIR}/test08.py)
 ADD_TEST("python_test08" ${PYTHON_EXECUTABLE} test08.py)
 SET_TESTS_PROPERTIES("python_test08" PROPERTIES PASS_REGULAR_EXPRESSION "Success")
 
 
-CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/test10.py.in ${CMAKE_CURRENT_BINARY_DIR}/test10.py)
+CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/test10.py ${CMAKE_CURRENT_BINARY_DIR}/test10.py)
 ADD_TEST("python_test10" ${PYTHON_EXECUTABLE} test10.py)
 SET_TESTS_PROPERTIES("python_test10" PROPERTIES PASS_REGULAR_EXPRESSION "Success")
 
-CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/test11.py.in ${CMAKE_CURRENT_BINARY_DIR}/test11.py)
+CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/test11.py ${CMAKE_CURRENT_BINARY_DIR}/test11.py)
 ADD_TEST("python_test11" ${PYTHON_EXECUTABLE} test11.py)
 SET_TESTS_PROPERTIES("python_test11" PROPERTIES PASS_REGULAR_EXPRESSION "Success")
 
-#CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/test12.py.in ${CMAKE_CURRENT_BINARY_DIR}/test12.py)
-#ADD_TEST("python_test12" ${PYTHON_EXECUTABLE} test12.py)
-#SET_TESTS_PROPERTIES("python_test12" PROPERTIES PASS_REGULAR_EXPRESSION "Success")
-
-#CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/test13.py.in ${CMAKE_CURRENT_BINARY_DIR}/test13.py)
-#ADD_TEST("python_test13" ${PYTHON_EXECUTABLE} test13.py)
-#SET_TESTS_PROPERTIES("python_test13" PROPERTIES PASS_REGULAR_EXPRESSION "Success")
-
-#CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/test14.py.in ${CMAKE_CURRENT_BINARY_DIR}/test14.py)
+# CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/satellites.json ${CMAKE_CURRENT_BINARY_DIR}/satellites.json COPYONLY)
+# CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/test12.py ${CMAKE_CURRENT_BINARY_DIR}/test12.py)
+# ADD_TEST("python_test12" ${PYTHON_EXECUTABLE} test12.py)
+# SET_TESTS_PROPERTIES("python_test12" PROPERTIES PASS_REGULAR_EXPRESSION "Success")
+
+# CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/test13.py ${CMAKE_CURRENT_BINARY_DIR}/test13.py)
+# ADD_TEST("python_test13" ${PYTHON_EXECUTABLE} test13.py)
+# SET_TESTS_PROPERTIES("python_test13" PROPERTIES PASS_REGULAR_EXPRESSION "Success")
+
+#CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/test14.py ${CMAKE_CURRENT_BINARY_DIR}/test14.py)
 #ADD_TEST("python_test14" ${PYTHON_EXECUTABLE} test14.py)
 #SET_TESTS_PROPERTIES("python_test14" PROPERTIES PASS_REGULAR_EXPRESSION "Success")
 

=== added file 'swig/python/tests/books.xml'
--- swig/python/tests/books.xml	1970-01-01 00:00:00 +0000
+++ swig/python/tests/books.xml	2013-03-27 00:42:25 +0000
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<books>
+  <book>
+    <title>Book 1</title>
+    <author>Author 1</author>
+  </book>
+  <book featured="YES">
+    <title>Book 2</title>
+    <author>Author 2</author>
+  </book>
+</books>

=== removed file 'swig/python/tests/books.xml.in'
--- swig/python/tests/books.xml.in	2013-02-07 17:24:36 +0000
+++ swig/python/tests/books.xml.in	1970-01-01 00:00:00 +0000
@@ -1,11 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" ?>
-<books>
-  <book>
-    <title>Book 1</title>
-    <author>Author 1</author>
-  </book>
-  <book featured="YES">
-    <title>Book 2</title>
-    <author>Author 2</author>
-  </book>
-</books>

=== added file 'swig/python/tests/compilerHints.xq'
--- swig/python/tests/compilerHints.xq	1970-01-01 00:00:00 +0000
+++ swig/python/tests/compilerHints.xq	2013-03-27 00:42:25 +0000
@@ -0,0 +1,4 @@
+for tumbling window $w in (2, 4, 6, 8, 10, 12, 14)
+    start at $s when fn:true()
+    only end at $e when $e - $s eq 2
+return avg($w)

=== removed file 'swig/python/tests/compilerHints.xq.in'
--- swig/python/tests/compilerHints.xq.in	2013-02-07 17:24:36 +0000
+++ swig/python/tests/compilerHints.xq.in	1970-01-01 00:00:00 +0000
@@ -1,4 +0,0 @@
-for tumbling window $w in (2, 4, 6, 8, 10, 12, 14)
-    start at $s when fn:true()
-    only end at $e when $e - $s eq 2
-return avg($w)

=== added file 'swig/python/tests/satellites.json'
--- swig/python/tests/satellites.json	1970-01-01 00:00:00 +0000
+++ swig/python/tests/satellites.json	2013-03-27 00:42:25 +0000
@@ -0,0 +1,17 @@
+{
+  "creator" : "Satellites plugin version 0.6.4",
+  "satellites" : {
+    "AAU CUBESAT" : {
+      "tle1" : "1 27846U 03031G 10322.04074654  .00000056  00000-0  45693-4 0  8768",
+      "visible" : false
+    },
+    "AJISAI (EGS)" : {
+      "tle1" : "1 16908U 86061A 10321.84797408 -.00000083  00000-0  10000-3 0  3696",
+      "visible" : true
+    },
+    "AKARI (ASTRO-F)" : {
+      "tle1" : "1 28939U 06005A 10321.96319841  .00000176  00000-0  48808-4 0  4294",
+      "visible" : true
+    }
+  }
+}

=== added file 'swig/python/tests/test01.py'
--- swig/python/tests/test01.py	1970-01-01 00:00:00 +0000
+++ swig/python/tests/test01.py	2013-03-27 00:42:25 +0000
@@ -0,0 +1,26 @@
+# Copyright 2006-2011 The FLWOR Foundation.
+# 
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+# 
+# http://www.apache.org/licenses/LICENSE-2.0
+# 
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+import sys
+sys.path.insert(0, '@pythonPath@')
+import zorba_api
+
+print "Running: Get zorba instance and shutdown"
+
+store = zorba_api.InMemoryStore_getInstance()
+zorba = zorba_api.Zorba_getInstance(store)
+zorba.shutdown()
+zorba_api.InMemoryStore_shutdown(store)
+
+print "Success"

=== removed file 'swig/python/tests/test01.py.in'
--- swig/python/tests/test01.py.in	2013-02-07 17:24:36 +0000
+++ swig/python/tests/test01.py.in	1970-01-01 00:00:00 +0000
@@ -1,26 +0,0 @@
-# Copyright 2006-2011 The FLWOR Foundation.
-# 
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-# 
-# http://www.apache.org/licenses/LICENSE-2.0
-# 
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-import sys
-sys.path.insert(0, '@pythonPath@')
-import zorba_api
-
-print "Running: Get zorba instance and shutdown"
-
-store = zorba_api.InMemoryStore_getInstance()
-zorba = zorba_api.Zorba_getInstance(store)
-zorba.shutdown()
-zorba_api.InMemoryStore_shutdown(store)
-
-print "Success"

=== added file 'swig/python/tests/test02.py'
--- swig/python/tests/test02.py	1970-01-01 00:00:00 +0000
+++ swig/python/tests/test02.py	2013-03-27 00:42:25 +0000
@@ -0,0 +1,41 @@
+# Copyright 2006-2011 The FLWOR Foundation.
+# 
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+# 
+# http://www.apache.org/licenses/LICENSE-2.0
+# 
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+import sys
+sys.path.insert(0, '@pythonPath@')
+import zorba_api
+
+
+def test(zorba):
+  xquery = zorba.compileQuery("(1,2,3,4,5)")
+  iter = xquery.iterator()
+  iter.open()
+  item = zorba_api.Item_createEmptyItem()
+  while iter.next(item):
+    print item.getStringValue()
+  iter.close()
+  iter.destroy()
+  return
+
+
+store = zorba_api.InMemoryStore_getInstance()
+zorba = zorba_api.Zorba_getInstance(store)
+
+print "Running: Compile query string"
+test(zorba)
+print "Success"
+
+zorba.shutdown()
+zorba_api.InMemoryStore_shutdown(store)
+

=== removed file 'swig/python/tests/test02.py.in'
--- swig/python/tests/test02.py.in	2013-02-07 17:24:36 +0000
+++ swig/python/tests/test02.py.in	1970-01-01 00:00:00 +0000
@@ -1,41 +0,0 @@
-# Copyright 2006-2011 The FLWOR Foundation.
-# 
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-# 
-# http://www.apache.org/licenses/LICENSE-2.0
-# 
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-import sys
-sys.path.insert(0, '@pythonPath@')
-import zorba_api
-
-
-def test(zorba):
-  xquery = zorba.compileQuery("(1,2,3,4,5)")
-  iter = xquery.iterator()
-  iter.open()
-  item = zorba_api.Item_createEmptyItem()
-  while iter.next(item):
-    print item.getStringValue()
-  iter.close()
-  iter.destroy()
-  return
-
-
-store = zorba_api.InMemoryStore_getInstance()
-zorba = zorba_api.Zorba_getInstance(store)
-
-print "Running: Compile query string"
-test(zorba)
-print "Success"
-
-zorba.shutdown()
-zorba_api.InMemoryStore_shutdown(store)
-

=== added file 'swig/python/tests/test03.py'
--- swig/python/tests/test03.py	1970-01-01 00:00:00 +0000
+++ swig/python/tests/test03.py	2013-03-27 00:42:25 +0000
@@ -0,0 +1,43 @@
+# Copyright 2006-2011 The FLWOR Foundation.
+# 
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+# 
+# http://www.apache.org/licenses/LICENSE-2.0
+# 
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+import sys
+sys.path.insert(0, '@pythonPath@')
+import zorba_api
+
+class MyDiagnosticHandler(zorba_api.DiagnosticHandler): 
+  def error(self, *args):
+    print "Error args: ", args
+
+def test(zorba):
+  diagnosticHandler = MyDiagnosticHandler()
+  try:
+    print "Compiling 1 div 0"
+    xquery = zorba.compileQuery("1 div 0", diagnosticHandler)
+    print xquery.execute()
+  except Exception, e:
+    print "Caught error: ", e
+  return
+
+
+store = zorba_api.InMemoryStore_getInstance()
+zorba = zorba_api.Zorba_getInstance(store)
+
+print "Running: Compile query string using Diagnostic Handler"
+test(zorba)
+print "Success"
+
+
+zorba.shutdown()
+zorba_api.InMemoryStore_shutdown(store)

=== removed file 'swig/python/tests/test03.py.in'
--- swig/python/tests/test03.py.in	2013-02-07 17:24:36 +0000
+++ swig/python/tests/test03.py.in	1970-01-01 00:00:00 +0000
@@ -1,43 +0,0 @@
-# Copyright 2006-2011 The FLWOR Foundation.
-# 
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-# 
-# http://www.apache.org/licenses/LICENSE-2.0
-# 
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-import sys
-sys.path.insert(0, '@pythonPath@')
-import zorba_api
-
-class MyDiagnosticHandler(zorba_api.DiagnosticHandler): 
-  def error(self, *args):
-    print "Error args: ", args
-
-def test(zorba):
-  diagnosticHandler = MyDiagnosticHandler()
-  try:
-    print "Compiling 1 div 0"
-    xquery = zorba.compileQuery("1 div 0", diagnosticHandler)
-    print xquery.execute()
-  except Exception, e:
-    print "Cought error: ", e
-  return
-
-
-store = zorba_api.InMemoryStore_getInstance()
-zorba = zorba_api.Zorba_getInstance(store)
-
-print "Running: Compile query string using Diagnostic Handler"
-test(zorba)
-print "Success"
-
-
-zorba.shutdown()
-zorba_api.InMemoryStore_shutdown(store)

=== added file 'swig/python/tests/test04.py'
--- swig/python/tests/test04.py	1970-01-01 00:00:00 +0000
+++ swig/python/tests/test04.py	2013-03-27 00:42:25 +0000
@@ -0,0 +1,42 @@
+# Copyright 2006-2011 The FLWOR Foundation.
+# 
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+# 
+# http://www.apache.org/licenses/LICENSE-2.0
+# 
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+import sys
+sys.path.insert(0, '@pythonPath@')
+import zorba_api
+
+
+def test(zorba):
+  #Read and write result
+  print 'Executing: test04.xq'
+  f = open('test04.xq', 'r')
+  lines = f.read()
+  f.close()
+  xquery = zorba.compileQuery(lines)
+  result = xquery.execute()
+  print result
+  return
+
+
+store = zorba_api.InMemoryStore_getInstance()
+zorba = zorba_api.Zorba_getInstance(store)
+
+print "Running: XQuery execute"
+test(zorba)
+print "Success"
+
+
+zorba.shutdown()
+zorba_api.InMemoryStore_shutdown(store)
+

=== removed file 'swig/python/tests/test04.py.in'
--- swig/python/tests/test04.py.in	2013-02-07 17:24:36 +0000
+++ swig/python/tests/test04.py.in	1970-01-01 00:00:00 +0000
@@ -1,42 +0,0 @@
-# Copyright 2006-2011 The FLWOR Foundation.
-# 
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-# 
-# http://www.apache.org/licenses/LICENSE-2.0
-# 
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-import sys
-sys.path.insert(0, '@pythonPath@')
-import zorba_api
-
-
-def test(zorba):
-  #Read and write result
-  print 'Executing: test04.xq'
-  f = open('test04.xq', 'r')
-  lines = f.read()
-  f.close()
-  xquery = zorba.compileQuery(lines)
-  result = xquery.execute()
-  print result
-  return
-
-
-store = zorba_api.InMemoryStore_getInstance()
-zorba = zorba_api.Zorba_getInstance(store)
-
-print "Running: XQuery execute"
-test(zorba)
-print "Success"
-
-
-zorba.shutdown()
-zorba_api.InMemoryStore_shutdown(store)
-

=== added file 'swig/python/tests/test04.xq'
--- swig/python/tests/test04.xq	1970-01-01 00:00:00 +0000
+++ swig/python/tests/test04.xq	2013-03-27 00:42:25 +0000
@@ -0,0 +1,4 @@
+for tumbling window $w in (2, 4, 6, 8, 10, 12, 14)
+    start at $s when fn:true()
+    only end at $e when $e - $s eq 2
+return avg($w)

=== removed file 'swig/python/tests/test04.xq.in'
--- swig/python/tests/test04.xq.in	2013-02-07 17:24:36 +0000
+++ swig/python/tests/test04.xq.in	1970-01-01 00:00:00 +0000
@@ -1,4 +0,0 @@
-for tumbling window $w in (2, 4, 6, 8, 10, 12, 14)
-    start at $s when fn:true()
-    only end at $e when $e - $s eq 2
-return avg($w)

=== added file 'swig/python/tests/test05.py'
--- swig/python/tests/test05.py	1970-01-01 00:00:00 +0000
+++ swig/python/tests/test05.py	2013-03-27 00:42:25 +0000
@@ -0,0 +1,42 @@
+# Copyright 2006-2011 The FLWOR Foundation.
+# 
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+# 
+# http://www.apache.org/licenses/LICENSE-2.0
+# 
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+import sys
+sys.path.insert(0, '@pythonPath@')
+import zorba_api
+
+
+def test(zorba):
+  #Read and write result
+  print 'Executing: test05.xq'
+  f = open('test05.xq', 'r')
+  lines = f.read()
+  f.close()
+  xquery = zorba.compileQuery(lines)
+  result = xquery.printPlanAsXML()
+  print result
+  return
+
+
+store = zorba_api.InMemoryStore_getInstance()
+zorba = zorba_api.Zorba_getInstance(store)
+
+print "Running: XQuery execute - printPlanAsXML"
+test(zorba)
+print "Success"
+
+
+zorba.shutdown()
+zorba_api.InMemoryStore_shutdown(store)
+

=== removed file 'swig/python/tests/test05.py.in'
--- swig/python/tests/test05.py.in	2013-02-07 17:24:36 +0000
+++ swig/python/tests/test05.py.in	1970-01-01 00:00:00 +0000
@@ -1,42 +0,0 @@
-# Copyright 2006-2011 The FLWOR Foundation.
-# 
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-# 
-# http://www.apache.org/licenses/LICENSE-2.0
-# 
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-import sys
-sys.path.insert(0, '@pythonPath@')
-import zorba_api
-
-
-def test(zorba):
-  #Read and write result
-  print 'Executing: test05.xq'
-  f = open('test05.xq', 'r')
-  lines = f.read()
-  f.close()
-  xquery = zorba.compileQuery(lines)
-  result = xquery.printPlanAsXML()
-  print result
-  return
-
-
-store = zorba_api.InMemoryStore_getInstance()
-zorba = zorba_api.Zorba_getInstance(store)
-
-print "Running: XQuery execute - printPlanAsXML"
-test(zorba)
-print "Success"
-
-
-zorba.shutdown()
-zorba_api.InMemoryStore_shutdown(store)
-

=== added file 'swig/python/tests/test05.xq'
--- swig/python/tests/test05.xq	1970-01-01 00:00:00 +0000
+++ swig/python/tests/test05.xq	2013-03-27 00:42:25 +0000
@@ -0,0 +1,7 @@
+for $x in (5,6,7,1,2,3,4)
+where $x < 4
+for $y in (4,9,6,8,2)
+let $z := $x * $y
+where $z > 20
+return
+<value x="{$x}" y="{$y}">{$z}</value>
\ No newline at end of file

=== removed file 'swig/python/tests/test05.xq.in'
--- swig/python/tests/test05.xq.in	2013-02-07 17:24:36 +0000
+++ swig/python/tests/test05.xq.in	1970-01-01 00:00:00 +0000
@@ -1,7 +0,0 @@
-for $x in (5,6,7,1,2,3,4)
-where $x < 4
-for $y in (4,9,6,8,2)
-let $z := $x * $y
-where $z > 20
-return
-<value x="{$x}" y="{$y}">{$z}</value>
\ No newline at end of file

=== added file 'swig/python/tests/test06.py'
--- swig/python/tests/test06.py	1970-01-01 00:00:00 +0000
+++ swig/python/tests/test06.py	2013-03-27 00:42:25 +0000
@@ -0,0 +1,42 @@
+# Copyright 2006-2011 The FLWOR Foundation.
+# 
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+# 
+# http://www.apache.org/licenses/LICENSE-2.0
+# 
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+import sys
+sys.path.insert(0, '@pythonPath@')
+import zorba_api
+
+
+def test(zorba):
+  #Read and write result
+  print 'Executing: test06.xq'
+  f = open('test06.xq', 'r')
+  lines = f.read()
+  f.close()
+  xquery = zorba.compileQuery(lines)
+  result = xquery.printPlanAsDOT()
+  print result
+  return
+
+
+store = zorba_api.InMemoryStore_getInstance()
+zorba = zorba_api.Zorba_getInstance(store)
+
+print "Running: XQuery execute - printPlanAsXML"
+test(zorba)
+print "Success"
+
+
+zorba.shutdown()
+zorba_api.InMemoryStore_shutdown(store)
+

=== removed file 'swig/python/tests/test06.py.in'
--- swig/python/tests/test06.py.in	2013-02-07 17:24:36 +0000
+++ swig/python/tests/test06.py.in	1970-01-01 00:00:00 +0000
@@ -1,42 +0,0 @@
-# Copyright 2006-2011 The FLWOR Foundation.
-# 
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-# 
-# http://www.apache.org/licenses/LICENSE-2.0
-# 
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-import sys
-sys.path.insert(0, '@pythonPath@')
-import zorba_api
-
-
-def test(zorba):
-  #Read and write result
-  print 'Executing: test06.xq'
-  f = open('test06.xq', 'r')
-  lines = f.read()
-  f.close()
-  xquery = zorba.compileQuery(lines)
-  result = xquery.printPlanAsDOT()
-  print result
-  return
-
-
-store = zorba_api.InMemoryStore_getInstance()
-zorba = zorba_api.Zorba_getInstance(store)
-
-print "Running: XQuery execute - printPlanAsXML"
-test(zorba)
-print "Success"
-
-
-zorba.shutdown()
-zorba_api.InMemoryStore_shutdown(store)
-

=== added file 'swig/python/tests/test06.xq'
--- swig/python/tests/test06.xq	1970-01-01 00:00:00 +0000
+++ swig/python/tests/test06.xq	2013-03-27 00:42:25 +0000
@@ -0,0 +1,7 @@
+for $x in (5,6,7,1,2,3,4)
+where $x < 4
+for $y in (4,9,6,8,2)
+let $z := $x * $y
+where $z > 20
+return
+<value x="{$x}" y="{$y}">{$z}</value>
\ No newline at end of file

=== removed file 'swig/python/tests/test06.xq.in'
--- swig/python/tests/test06.xq.in	2013-02-07 17:24:36 +0000
+++ swig/python/tests/test06.xq.in	1970-01-01 00:00:00 +0000
@@ -1,7 +0,0 @@
-for $x in (5,6,7,1,2,3,4)
-where $x < 4
-for $y in (4,9,6,8,2)
-let $z := $x * $y
-where $z > 20
-return
-<value x="{$x}" y="{$y}">{$z}</value>
\ No newline at end of file

=== added file 'swig/python/tests/test07.1.py'
--- swig/python/tests/test07.1.py	1970-01-01 00:00:00 +0000
+++ swig/python/tests/test07.1.py	2013-03-27 00:42:25 +0000
@@ -0,0 +1,54 @@
+# Copyright 2006-2011 The FLWOR Foundation.
+# 
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+# 
+# http://www.apache.org/licenses/LICENSE-2.0
+# 
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+import sys
+sys.path.insert(0, '@pythonPath@')
+import zorba_api
+
+
+def test(zorba): 
+  f = open('books.xml', 'r') 
+  lines = f.read() 
+  f.close() 
+   
+  dataManager = zorba.getXmlDataManager() 
+  docIter = dataManager.parseXML(lines) 
+  docIter.open(); 
+ 
+  doc = zorba_api.Item_createEmptyItem() 
+  docIter.next(doc) 
+ 
+  docIter.close() 
+  docIter.destroy() 
+ 
+  docManager = dataManager.getDocumentManager() 
+  docManager.put("my_fake_books.xml", doc) 
+  xquery = zorba.compileQuery("doc('my_fake_books.xml')") 
+   
+  result = xquery.execute() 
+  print result
+ 
+  return
+  
+store = zorba_api.InMemoryStore_getInstance()
+zorba = zorba_api.Zorba_getInstance(store)
+
+print "Running: XQuery execute - parsing XML"
+test(zorba)
+print "Success"
+
+
+zorba.shutdown()
+zorba_api.InMemoryStore_shutdown(store)
+

=== removed file 'swig/python/tests/test07.1.py.in'
--- swig/python/tests/test07.1.py.in	2013-02-07 17:24:36 +0000
+++ swig/python/tests/test07.1.py.in	1970-01-01 00:00:00 +0000
@@ -1,54 +0,0 @@
-# Copyright 2006-2011 The FLWOR Foundation.
-# 
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-# 
-# http://www.apache.org/licenses/LICENSE-2.0
-# 
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-import sys
-sys.path.insert(0, '@pythonPath@')
-import zorba_api
-
-
-def test(zorba): 
-  f = open('books.xml', 'r') 
-  lines = f.read() 
-  f.close() 
-   
-  dataManager = zorba.getXmlDataManager() 
-  docIter = dataManager.parseXML(lines) 
-  docIter.open(); 
- 
-  doc = zorba_api.Item_createEmptyItem() 
-  docIter.next(doc) 
- 
-  docIter.close() 
-  docIter.destroy() 
- 
-  docManager = dataManager.getDocumentManager() 
-  docManager.put("my_fake_books.xml", doc) 
-  xquery = zorba.compileQuery("doc('my_fake_books.xml')") 
-   
-  result = xquery.execute() 
-  print result
- 
-  return
-  
-store = zorba_api.InMemoryStore_getInstance()
-zorba = zorba_api.Zorba_getInstance(store)
-
-print "Running: XQuery execute - parsing XML"
-test(zorba)
-print "Success"
-
-
-zorba.shutdown()
-zorba_api.InMemoryStore_shutdown(store)
-

=== added file 'swig/python/tests/test07.2.py'
--- swig/python/tests/test07.2.py	1970-01-01 00:00:00 +0000
+++ swig/python/tests/test07.2.py	2013-03-27 00:42:25 +0000
@@ -0,0 +1,81 @@
+# Copyright 2006-2011 The FLWOR Foundation.
+# 
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+# 
+# http://www.apache.org/licenses/LICENSE-2.0
+# 
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+import sys
+sys.path.insert(0, '@pythonPath@')
+import zorba_api
+
+
+def test(zorba):
+  xquery = zorba.compileQuery("<a>text-a1<b at1='att1' at2='{1+2}'>text-b1</b>text-a2</a>") 
+   
+  saxHandler = zorba_api.SAX2ContentHandlerProxy()
+  saxHandler.setStartDocumentHandler(startDocumentHandler);
+  saxHandler.setEndDocumentHandler(endDocumentHandler);
+  saxHandler.setStartElementHandler(startElementHandler);
+  saxHandler.setEndElementHandler(endElementHandler);
+  saxHandler.setCharactersHandler(charactersHandler);
+  saxHandler.setProcessingInstructionHandler(processingInstructionHandler);
+  saxHandler.setIgnorableWhitespaceHandler(ignorableWhitespaceHandler);
+  saxHandler.setStartPrefixMappingHandler(startPrefixMappingHandler);
+  saxHandler.setEndPrefixMappingHandler(endPrefixMappingHandler);
+  saxHandler.setSkippedEntityHandler(skippedEntityHandler);
+  xquery.executeSAX(saxHandler)
+
+  return
+
+
+def startDocumentHandler():
+  print "Start Document"
+  return
+def endDocumentHandler():
+  print "End Document"
+  return
+def startElementHandler(URI, localName, QName, SAXAttributes):
+  print "Start Element - ", QName
+  return
+def endElementHandler(URI, localName, QName):
+  print "End Element - ", QName
+  return
+def charactersHandler(text):
+  print "Characters - ", text
+  return
+def processingInstructionHandler(target, data):
+  print "Processing Instruction"
+  return
+def ignorableWhitespaceHandler(text):
+  print "Ignorable Whitespace - ", text
+  return
+def startPrefixMappingHandler(prefix, URI):
+  print "Start Prefix Mapping - ", prefix
+  return
+def endPrefixMappingHandler(prefix):
+  print "End Prefix Mapping - ", prefix
+  return
+def skippedEntityHandler(name):
+  print "Skipped Entity - ", name
+  return
+
+
+store = zorba_api.InMemoryStore_getInstance()
+zorba = zorba_api.Zorba_getInstance(store)
+
+print "Running: XQuery execute - executeSAX"
+test(zorba)
+print "Success"
+
+
+zorba.shutdown()
+zorba_api.InMemoryStore_shutdown(store)
+

=== removed file 'swig/python/tests/test07.2.py.in'
--- swig/python/tests/test07.2.py.in	2013-02-07 17:24:36 +0000
+++ swig/python/tests/test07.2.py.in	1970-01-01 00:00:00 +0000
@@ -1,81 +0,0 @@
-# Copyright 2006-2011 The FLWOR Foundation.
-# 
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-# 
-# http://www.apache.org/licenses/LICENSE-2.0
-# 
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-import sys
-sys.path.insert(0, '@pythonPath@')
-import zorba_api
-
-
-def test(zorba):
-  xquery = zorba.compileQuery("<a>text-a1<b at1='att1' at2='{1+2}'>text-b1</b>text-a2</a>") 
-   
-  saxHandler = zorba_api.SAX2ContentHandlerProxy()
-  saxHandler.setStartDocumentHandler(startDocumentHandler);
-  saxHandler.setEndDocumentHandler(endDocumentHandler);
-  saxHandler.setStartElementHandler(startElementHandler);
-  saxHandler.setEndElementHandler(endElementHandler);
-  saxHandler.setCharactersHandler(charactersHandler);
-  saxHandler.setProcessingInstructionHandler(processingInstructionHandler);
-  saxHandler.setIgnorableWhitespaceHandler(ignorableWhitespaceHandler);
-  saxHandler.setStartPrefixMappingHandler(startPrefixMappingHandler);
-  saxHandler.setEndPrefixMappingHandler(endPrefixMappingHandler);
-  saxHandler.setSkippedEntityHandler(skippedEntityHandler);
-  xquery.executeSAX(saxHandler)
-
-  return
-
-
-def startDocumentHandler():
-  print "Start Document"
-  return
-def endDocumentHandler():
-  print "End Document"
-  return
-def startElementHandler(URI, localName, QName, SAXAttributes):
-  print "Start Element - ", QName
-  return
-def endElementHandler(URI, localName, QName):
-  print "End Element - ", QName
-  return
-def charactersHandler(text):
-  print "Characters - ", text
-  return
-def processingInstructionHandler(target, data):
-  print "Processing Instruction"
-  return
-def ignorableWhitespaceHandler(text):
-  print "Ignorable Whitespace - ", text
-  return
-def startPrefixMappingHandler(prefix, URI):
-  print "Start Prefix Mapping - ", prefix
-  return
-def endPrefixMappingHandler(prefix):
-  print "End Prefix Mapping - ", prefix
-  return
-def skippedEntityHandler(name):
-  print "Skipped Entity - ", name
-  return
-
-
-store = zorba_api.InMemoryStore_getInstance()
-zorba = zorba_api.Zorba_getInstance(store)
-
-print "Running: XQuery execute - executeSAX"
-test(zorba)
-print "Success"
-
-
-zorba.shutdown()
-zorba_api.InMemoryStore_shutdown(store)
-

=== added file 'swig/python/tests/test08.py'
--- swig/python/tests/test08.py	1970-01-01 00:00:00 +0000
+++ swig/python/tests/test08.py	2013-03-27 00:42:25 +0000
@@ -0,0 +1,112 @@
+# Copyright 2006-2011 The FLWOR Foundation.
+# 
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+# 
+# http://www.apache.org/licenses/LICENSE-2.0
+# 
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+import sys
+sys.path.insert(0, '@pythonPath@')
+import zorba_api
+
+ 
+def test(zorba): 
+  #Read and write result 
+  print 'Executing: test08.xq' 
+  lines = '(1, xs:int(2),"bla", <a><b att="{(3, xs:int(4),"foo", "bar")}"/>text<!--a comment--><?pi?></a>)' 
+  xquery = zorba.compileQuery(lines) 
+  result = xquery.execute() 
+  print result 
+ 
+  print "Iterator:" 
+  iterator = xquery.iterator() 
+
+  printIterator(iterator, "")
+ 
+  f = open('test8_result.xml', 'w') 
+  f.write(result) 
+  f.close() 
+  return 
+
+
+def printIterator(iterator, pre):
+  item = zorba_api.Item() 
+  iterator.open() 
+  while iterator.next(item):
+    printItem(item, pre)
+  iterator.close()
+
+ 
+def printItem(item, pre):
+  if item.isAtomic():
+    typeItem = item.getType()
+    print pre + "Leaf Atomic: '" + item.getStringValue() + "' \ttype:", typeItem.getStringValue()   
+    return
+
+  if item.isNode():
+    kind = item.getNodeKind()
+  
+    if kind ==  0: # anyNode
+      print pre + 'Any node'
+      print pre + "  Children:"
+      printIterator(item.getChildren(), pre+"    ")
+
+    if kind ==  1: # doc
+      print pre + 'Doc'
+      print pre + "  Children:"
+      printIterator(item.getChildren(), pre+"    ")
+
+    if kind == 2: # element
+      nodeName = zorba_api.Item()
+      item.getNodeName(nodeName)
+      typeItem = item.getType()              
+      print pre + "Start Element: ", nodeName.getStringValue(), " \ttype:", typeItem.getStringValue()
+      print pre + "  Attributes:"
+      printIterator(item.getAttributes(), pre+"    ")
+      print pre + "  Children:"
+      printIterator(item.getChildren(), pre+"    ")
+      print pre + "End  Element: ", nodeName.getStringValue()        
+    
+    if kind == 3: # attribute
+      nodeName = zorba_api.Item()
+      item.getNodeName(nodeName)
+      typeItem = item.getType()              
+      print pre + "Attribute: ", nodeName.getStringValue(), "= '" + item.getStringValue() + "'"" \ttype:", typeItem.getStringValue()
+      print pre+"  Atomization value:"
+      printIterator(item.getAtomizationValue(), pre+"    ")
+    
+    if kind == 4: # text
+      typeItem = item.getType()              
+      print pre + "Text: ", item.getStringValue(), " \ttype:", typeItem.getStringValue()
+      print pre+"  Atomization value:"
+      printIterator(item.getAtomizationValue(), pre+"    ")
+
+    if kind == 5: # pi
+      nodeName = zorba_api.Item()
+      item.getNodeName(nodeName)
+      print pre + "Pi: ", nodeName.getStringValue()
+    
+    if kind == 6: # comment
+      print pre + "Comment: ", item.getStringValue()
+  else:
+    print pre+"Item not Node, not Atomic"
+
+
+ 
+store = zorba_api.InMemoryStore_getInstance() 
+zorba = zorba_api.Zorba_getInstance(store) 
+ 
+print "Running: XQuery execute - Get Iterator and print info from its items" 
+test(zorba) 
+print "Success" 
+ 
+ 
+zorba.shutdown() 
+zorba_api.InMemoryStore_shutdown(store) 
\ No newline at end of file

=== removed file 'swig/python/tests/test08.py.in'
--- swig/python/tests/test08.py.in	2013-02-07 17:24:36 +0000
+++ swig/python/tests/test08.py.in	1970-01-01 00:00:00 +0000
@@ -1,112 +0,0 @@
-# Copyright 2006-2011 The FLWOR Foundation.
-# 
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-# 
-# http://www.apache.org/licenses/LICENSE-2.0
-# 
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-import sys
-sys.path.insert(0, '@pythonPath@')
-import zorba_api
-
- 
-def test(zorba): 
-  #Read and write result 
-  print 'Executing: test08.xq' 
-  lines = '(1, xs:int(2),"bla", <a><b att="{(3, xs:int(4),"foo", "bar")}"/>text<!--a comment--><?pi?></a>)' 
-  xquery = zorba.compileQuery(lines) 
-  result = xquery.execute() 
-  print result 
- 
-  print "Iterator:" 
-  iterator = xquery.iterator() 
-
-  printIterator(iterator, "")
- 
-  f = open('test8_result.xml', 'w') 
-  f.write(result) 
-  f.close() 
-  return 
-
-
-def printIterator(iterator, pre):
-  item = zorba_api.Item() 
-  iterator.open() 
-  while iterator.next(item):
-    printItem(item, pre)
-  iterator.close()
-
- 
-def printItem(item, pre):
-  if item.isAtomic():
-    typeItem = item.getType()
-    print pre + "Leaf Atomic: '" + item.getStringValue() + "' \ttype:", typeItem.getStringValue()   
-    return
-
-  if item.isNode():
-    kind = item.getNodeKind()
-  
-    if kind ==  0: # anyNode
-      print pre + 'Any node'
-      print pre + "  Children:"
-      printIterator(item.getChildren(), pre+"    ")
-
-    if kind ==  1: # doc
-      print pre + 'Doc'
-      print pre + "  Children:"
-      printIterator(item.getChildren(), pre+"    ")
-
-    if kind == 2: # element
-      nodeName = zorba_api.Item()
-      item.getNodeName(nodeName)
-      typeItem = item.getType()              
-      print pre + "Start Element: ", nodeName.getStringValue(), " \ttype:", typeItem.getStringValue()
-      print pre + "  Attributes:"
-      printIterator(item.getAttributes(), pre+"    ")
-      print pre + "  Children:"
-      printIterator(item.getChildren(), pre+"    ")
-      print pre + "End  Element: ", nodeName.getStringValue()        
-    
-    if kind == 3: # attribute
-      nodeName = zorba_api.Item()
-      item.getNodeName(nodeName)
-      typeItem = item.getType()              
-      print pre + "Attribute: ", nodeName.getStringValue(), "= '" + item.getStringValue() + "'"" \ttype:", typeItem.getStringValue()
-      print pre+"  Atomization value:"
-      printIterator(item.getAtomizationValue(), pre+"    ")
-    
-    if kind == 4: # text
-      typeItem = item.getType()              
-      print pre + "Text: ", item.getStringValue(), " \ttype:", typeItem.getStringValue()
-      print pre+"  Atomization value:"
-      printIterator(item.getAtomizationValue(), pre+"    ")
-
-    if kind == 5: # pi
-      nodeName = zorba_api.Item()
-      item.getNodeName(nodeName)
-      print pre + "Pi: ", nodeName.getStringValue()
-    
-    if kind == 6: # comment
-      print pre + "Comment: ", item.getStringValue()
-  else:
-    print pre+"Item not Node, not Atomic"
-
-
- 
-store = zorba_api.InMemoryStore_getInstance() 
-zorba = zorba_api.Zorba_getInstance(store) 
- 
-print "Running: XQuery execute - Get Iterator and print info from its items" 
-test(zorba) 
-print "Success" 
- 
- 
-zorba.shutdown() 
-zorba_api.InMemoryStore_shutdown(store) 
\ No newline at end of file

=== added file 'swig/python/tests/test10.py'
--- swig/python/tests/test10.py	1970-01-01 00:00:00 +0000
+++ swig/python/tests/test10.py	2013-03-27 00:42:25 +0000
@@ -0,0 +1,51 @@
+# Copyright 2006-2011 The FLWOR Foundation.
+# 
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+# 
+# http://www.apache.org/licenses/LICENSE-2.0
+# 
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+import sys
+sys.path.insert(0, '@pythonPath@')
+import zorba_api
+
+def test(zorba):
+  f = open('books.xml', 'r')
+  lines = f.read()
+  f.close()
+
+  dataManager = zorba.getXmlDataManager()
+  docIter = dataManager.parseXML(lines)
+  docIter.open();
+
+  doc = zorba_api.Item_createEmptyItem()
+  docIter.next(doc)
+
+  docIter.close()
+  docIter.destroy()
+
+  xquery = zorba.compileQuery(".")
+  dynCtx = xquery.getDynamicContext();
+  dynCtx.setContextItem(doc);
+  print xquery.execute()
+  
+  return
+
+store = zorba_api.InMemoryStore_getInstance()
+zorba = zorba_api.Zorba_getInstance(store)
+
+print "Running: XQuery execute - Get Iterator and print info from its items"
+test(zorba)
+print "Success"
+
+
+zorba.shutdown()
+zorba_api.InMemoryStore_shutdown(store)
+

=== removed file 'swig/python/tests/test10.py.in'
--- swig/python/tests/test10.py.in	2013-02-07 17:24:36 +0000
+++ swig/python/tests/test10.py.in	1970-01-01 00:00:00 +0000
@@ -1,51 +0,0 @@
-# Copyright 2006-2011 The FLWOR Foundation.
-# 
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-# 
-# http://www.apache.org/licenses/LICENSE-2.0
-# 
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-import sys
-sys.path.insert(0, '@pythonPath@')
-import zorba_api
-
-def test(zorba):
-  f = open('books.xml', 'r')
-  lines = f.read()
-  f.close()
-
-  dataManager = zorba.getXmlDataManager()
-  docIter = dataManager.parseXML(lines)
-  docIter.open();
-
-  doc = zorba_api.Item_createEmptyItem()
-  docIter.next(doc)
-
-  docIter.close()
-  docIter.destroy()
-
-  xquery = zorba.compileQuery(".")
-  dynCtx = xquery.getDynamicContext();
-  dynCtx.setContextItem(doc);
-  print xquery.execute()
-  
-  return
-
-store = zorba_api.InMemoryStore_getInstance()
-zorba = zorba_api.Zorba_getInstance(store)
-
-print "Running: XQuery execute - Get Iterator and print info from its items"
-test(zorba)
-print "Success"
-
-
-zorba.shutdown()
-zorba_api.InMemoryStore_shutdown(store)
-

=== added file 'swig/python/tests/test11.py'
--- swig/python/tests/test11.py	1970-01-01 00:00:00 +0000
+++ swig/python/tests/test11.py	2013-03-27 00:42:25 +0000
@@ -0,0 +1,42 @@
+# Copyright 2006-2011 The FLWOR Foundation.
+# 
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+# 
+# http://www.apache.org/licenses/LICENSE-2.0
+# 
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+import sys
+sys.path.insert(0, '@pythonPath@')
+import zorba_api
+
+store = zorba_api.InMemoryStore_getInstance()
+zorba = zorba_api.Zorba_getInstance(store)
+
+print "Running: CompileQuery CollectionManager"
+
+xmlManager = zorba.getXmlDataManager()
+collectionManager = xmlManager.getCollectionManager()
+itemFactory = zorba.getItemFactory()
+name = itemFactory.createQName("http://www.zorba-xquery.com/";, "aaa")
+collectionManager.createCollection(name)
+isAdded = collectionManager.isAvailableCollection(name)
+
+if isAdded :
+  collection = collectionManager.getCollection(name);
+  data = xmlManager.parseXMLtoItem("<books><book>Book 1</book><book>Book 2</book></books>");
+  itemSequence = zorba_api.ItemSequence(data)
+  collection.insertNodesLast(itemSequence)
+
+print "Success"
+
+
+zorba.shutdown()
+zorba_api.InMemoryStore_shutdown(store)
+

=== removed file 'swig/python/tests/test11.py.in'
--- swig/python/tests/test11.py.in	2013-02-07 17:24:36 +0000
+++ swig/python/tests/test11.py.in	1970-01-01 00:00:00 +0000
@@ -1,42 +0,0 @@
-# Copyright 2006-2011 The FLWOR Foundation.
-# 
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-# 
-# http://www.apache.org/licenses/LICENSE-2.0
-# 
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-import sys
-sys.path.insert(0, '@pythonPath@')
-import zorba_api
-
-store = zorba_api.InMemoryStore_getInstance()
-zorba = zorba_api.Zorba_getInstance(store)
-
-print "Running: CompileQuery CollectionManager"
-
-xmlManager = zorba.getXmlDataManager()
-collectionManager = xmlManager.getCollectionManager()
-itemFactory = zorba.getItemFactory()
-name = itemFactory.createQName("http://www.zorba-xquery.com/";, "aaa")
-collectionManager.createCollection(name)
-isAdded = collectionManager.isAvailableCollection(name)
-
-if isAdded :
-  collection = collectionManager.getCollection(name);
-  data = xmlManager.parseXMLtoItem("<books><book>Book 1</book><book>Book 2</book></books>");
-  itemSequence = zorba_api.ItemSequence(data)
-  collection.insertNodesLast(itemSequence)
-
-print "Success"
-
-
-zorba.shutdown()
-zorba_api.InMemoryStore_shutdown(store)
-

=== added file 'swig/python/tests/test12.py'
--- swig/python/tests/test12.py	1970-01-01 00:00:00 +0000
+++ swig/python/tests/test12.py	2013-03-27 00:42:25 +0000
@@ -0,0 +1,51 @@
+# Copyright 2006-2013 The FLWOR Foundation.
+# 
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+# 
+# http://www.apache.org/licenses/LICENSE-2.0
+# 
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+import sys
+sys.path.insert(0, '@pythonPath@')
+import zorba_api
+
+def test(zorba):
+  try:
+    query = (
+              " let $sats := jn:json-doc('@pythonPath@/tests/satellites.json')('satellites') "
+              " return { "
+              "   'visible' : [ "
+              "      for $sat in jn:keys($sats) "
+              "      where $sats($sat)('visible') "
+              "      return $sat "
+              "   ], "
+              "   'invisible' : [ "
+              "      for $sat in jn:keys($sats) "
+              "      where not($sats($sat)('visible')) "
+              "      return $sat "
+              "   ] "
+              " } " )
+
+    xquery = zorba.compileQuery(query)
+    print xquery.execute()
+    print "Success"
+  except Exception, e:
+    print "Caught error: ", e
+  return
+
+store = zorba_api.InMemoryStore_getInstance()
+zorba = zorba_api.Zorba_getInstance(store)
+
+print "Running: Compile query string using JSONiq"
+test(zorba)
+
+
+zorba.shutdown()
+zorba_api.InMemoryStore_shutdown(store)

=== removed file 'swig/python/tests/test12.py.in'
--- swig/python/tests/test12.py.in	2013-02-07 17:24:36 +0000
+++ swig/python/tests/test12.py.in	1970-01-01 00:00:00 +0000
@@ -1,49 +0,0 @@
-# Copyright 2006-2011 The FLWOR Foundation.
-# 
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-# 
-# http://www.apache.org/licenses/LICENSE-2.0
-# 
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-import sys
-sys.path.insert(0, '@pythonPath@')
-import zorba_api
-
-class MyDiagnosticHandler(zorba_api.DiagnosticHandler): 
-  def error(self, *args):
-    print "Error args: ", args
-
-def test(zorba):
-  #Read and write result
-  print 'Executing: compilerHints.xq'
-  f = open('compilerHints.xq', 'r')
-  lines = f.read()
-  f.close()
-  diagnosticHandler = MyDiagnosticHandler()
-  compilerHints = zorba_api.CompilerHints()
-  compilerHints.setOptimizationLevel(1)
-  xquery = zorba.compileQuery(lines, compilerHints, diagnosticHandler)
-  
-  result = xquery.execute()
-  print result
-  return
-
-
-store = zorba_api.InMemoryStore_getInstance()
-zorba = zorba_api.Zorba_getInstance(store)
-
-print "Running: CompileQuery string + Dignostinc handler + CompilerHint - with optimization 1"
-test(zorba)
-print "Success"
-
-
-zorba.shutdown()
-zorba_api.InMemoryStore_shutdown(store)
-

=== added file 'swig/python/tests/test13.py'
--- swig/python/tests/test13.py	1970-01-01 00:00:00 +0000
+++ swig/python/tests/test13.py	2013-03-27 00:42:25 +0000
@@ -0,0 +1,43 @@
+# Copyright 2006-2013 The FLWOR Foundation.
+# 
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+# 
+# http://www.apache.org/licenses/LICENSE-2.0
+# 
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+import sys
+sys.path.insert(0, '@pythonPath@')
+import zorba_api
+
+def test(zorba):
+  try:
+    itemFactory = zorba.getItemFactory()
+    print "Creating JSON Item null:  ", itemFactory.createJSONNull().serialize()
+    print "Creating JSON Item null:  ", itemFactory.createJSONNumber("5").serialize()
+    sv = zorba_api.StringVector(4)
+    sv[0]="Hello"
+    sv[1]="Zorba"
+    sv[2]="Hello"
+    sv[3]="Zorba"
+    print "Creating JSON Item null:  ", itemFactory.createJSONArray(sv).serialize()
+    print "Success"
+  except Exception, e:
+    print "Caught error: ", e
+  return
+
+store = zorba_api.InMemoryStore_getInstance()
+zorba = zorba_api.Zorba_getInstance(store)
+
+print "Running: Creating JSON objects using the API"
+test(zorba)
+
+
+zorba.shutdown()
+zorba_api.InMemoryStore_shutdown(store)

=== removed file 'swig/python/tests/test13.py.in'
--- swig/python/tests/test13.py.in	2013-02-07 17:24:36 +0000
+++ swig/python/tests/test13.py.in	1970-01-01 00:00:00 +0000
@@ -1,50 +0,0 @@
-# Copyright 2006-2011 The FLWOR Foundation.
-# 
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-# 
-# http://www.apache.org/licenses/LICENSE-2.0
-# 
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-import sys
-sys.path.insert(0, '@pythonPath@')
-import zorba_api
-
-class MyDiagnosticHandler(zorba_api.DiagnosticHandler): 
-  def error(self, *args):
-    print "Error args: ", args
-
-def test(zorba):
-  #Read and write result
-  print 'Executing: compilerHints.xq'
-  f = open('compilerHints.xq', 'r')
-  lines = f.read()
-  f.close()
-  diagnosticHandler = MyDiagnosticHandler()
-  compilerHints = zorba_api.CompilerHints()
-  compilerHints.setLibModule(True)
-  compilerHints.setOptimizationLevel(0)
-  xquery = zorba.compileQuery(lines, compilerHints, diagnosticHandler)
-  
-  result = xquery.execute()
-  print result
-  return
-
-
-store = zorba_api.InMemoryStore_getInstance()
-zorba = zorba_api.Zorba_getInstance(store)
-
-print "Running: CompileQuery string + Dignostinc handler + CompilerHint - with optimization 0 - setLibModule(True)"
-test(zorba)
-print "Success"
-
-
-zorba.shutdown()
-zorba_api.InMemoryStore_shutdown(store)
-

=== added file 'swig/python/tests/test14.py'
--- swig/python/tests/test14.py	1970-01-01 00:00:00 +0000
+++ swig/python/tests/test14.py	2013-03-27 00:42:25 +0000
@@ -0,0 +1,50 @@
+# Copyright 2006-2011 The FLWOR Foundation.
+# 
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+# 
+# http://www.apache.org/licenses/LICENSE-2.0
+# 
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+import sys
+sys.path.insert(0, '@pythonPath@')
+import zorba_api
+
+class MyDiagnosticHandler(zorba_api.DiagnosticHandler): 
+  def error(self, *args):
+    print "Error args: ", args
+
+def test(zorba):
+  #Read and write result
+  print 'Executing: compilerHints.xq'
+  f = open('compilerHints.xq', 'r')
+  lines = f.read()
+  f.close()
+  diagnosticHandler = MyDiagnosticHandler()
+  compilerHints = zorba_api.CompilerHints()
+  compilerHints.setLibModule(True)
+  compilerHints.setOptimizationLevel(1)
+  xquery = zorba.compileQuery(lines, compilerHints, diagnosticHandler)
+  
+  result = xquery.execute()
+  print result
+  return
+
+
+store = zorba_api.InMemoryStore_getInstance()
+zorba = zorba_api.Zorba_getInstance(store)
+
+print "Running: CompileQuery string + Dignostinc handler + CompilerHint - with optimization 1 - setLibModule(True)"
+test(zorba)
+print "Success"
+
+
+zorba.shutdown()
+zorba_api.InMemoryStore_shutdown(store)
+

=== removed file 'swig/python/tests/test14.py.in'
--- swig/python/tests/test14.py.in	2013-02-07 17:24:36 +0000
+++ swig/python/tests/test14.py.in	1970-01-01 00:00:00 +0000
@@ -1,50 +0,0 @@
-# Copyright 2006-2011 The FLWOR Foundation.
-# 
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-# 
-# http://www.apache.org/licenses/LICENSE-2.0
-# 
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-import sys
-sys.path.insert(0, '@pythonPath@')
-import zorba_api
-
-class MyDiagnosticHandler(zorba_api.DiagnosticHandler): 
-  def error(self, *args):
-    print "Error args: ", args
-
-def test(zorba):
-  #Read and write result
-  print 'Executing: compilerHints.xq'
-  f = open('compilerHints.xq', 'r')
-  lines = f.read()
-  f.close()
-  diagnosticHandler = MyDiagnosticHandler()
-  compilerHints = zorba_api.CompilerHints()
-  compilerHints.setLibModule(True)
-  compilerHints.setOptimizationLevel(1)
-  xquery = zorba.compileQuery(lines, compilerHints, diagnosticHandler)
-  
-  result = xquery.execute()
-  print result
-  return
-
-
-store = zorba_api.InMemoryStore_getInstance()
-zorba = zorba_api.Zorba_getInstance(store)
-
-print "Running: CompileQuery string + Dignostinc handler + CompilerHint - with optimization 1 - setLibModule(True)"
-test(zorba)
-print "Success"
-
-
-zorba.shutdown()
-zorba_api.InMemoryStore_shutdown(store)
-

=== modified file 'swig/ruby/tests/CMakeLists.txt'
--- swig/ruby/tests/CMakeLists.txt	2013-02-07 17:24:36 +0000
+++ swig/ruby/tests/CMakeLists.txt	2013-03-27 00:42:25 +0000
@@ -68,13 +68,14 @@
 ADD_TEST("ruby_test11" ${RUBY_EXECUTABLE} test11.rb)
 SET_TESTS_PROPERTIES("ruby_test11" PROPERTIES PASS_REGULAR_EXPRESSION "Success")
 
-#CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/test12.rb ${CMAKE_CURRENT_BINARY_DIR}/test12.rb)
-#ADD_TEST("ruby_test12" ${RUBY_EXECUTABLE} test12.rb)
-#SET_TESTS_PROPERTIES("ruby_test12" PROPERTIES PASS_REGULAR_EXPRESSION "Success")
+CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/satellites.json ${CMAKE_CURRENT_BINARY_DIR}/satellites.json COPYONLY)
+CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/test12.rb ${CMAKE_CURRENT_BINARY_DIR}/test12.rb)
+ADD_TEST("ruby_test12" ${RUBY_EXECUTABLE} test12.rb)
+SET_TESTS_PROPERTIES("ruby_test12" PROPERTIES PASS_REGULAR_EXPRESSION "Success")
 
-#CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/test13.rb ${CMAKE_CURRENT_BINARY_DIR}/test13.rb)
-#ADD_TEST("ruby_test13" ${RUBY_EXECUTABLE} test13.rb)
-#SET_TESTS_PROPERTIES("ruby_test13" PROPERTIES PASS_REGULAR_EXPRESSION "Success")
+# CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/test13.rb ${CMAKE_CURRENT_BINARY_DIR}/test13.rb)
+# ADD_TEST("ruby_test13" ${RUBY_EXECUTABLE} test13.rb)
+# SET_TESTS_PROPERTIES("ruby_test13" PROPERTIES PASS_REGULAR_EXPRESSION "Success")
 
 #CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/test14.rb ${CMAKE_CURRENT_BINARY_DIR}/test14.rb)
 #ADD_TEST("ruby_test14" ${RUBY_EXECUTABLE} test14.rb)

=== added file 'swig/ruby/tests/satellites.json'
--- swig/ruby/tests/satellites.json	1970-01-01 00:00:00 +0000
+++ swig/ruby/tests/satellites.json	2013-03-27 00:42:25 +0000
@@ -0,0 +1,17 @@
+{
+  "creator" : "Satellites plugin version 0.6.4",
+  "satellites" : {
+    "AAU CUBESAT" : {
+      "tle1" : "1 27846U 03031G 10322.04074654  .00000056  00000-0  45693-4 0  8768",
+      "visible" : false
+    },
+    "AJISAI (EGS)" : {
+      "tle1" : "1 16908U 86061A 10321.84797408 -.00000083  00000-0  10000-3 0  3696",
+      "visible" : true
+    },
+    "AKARI (ASTRO-F)" : {
+      "tle1" : "1 28939U 06005A 10321.96319841  .00000176  00000-0  48808-4 0  4294",
+      "visible" : true
+    }
+  }
+}

=== modified file 'swig/ruby/tests/test12.rb'
--- swig/ruby/tests/test12.rb	2012-03-27 00:56:11 +0000
+++ swig/ruby/tests/test12.rb	2013-03-27 00:42:25 +0000
@@ -1,4 +1,4 @@
-# Copyright 2006-2011 The FLWOR Foundation.
+# Copyright 2006-2012 The FLWOR Foundation.
 # 
 # Licensed under the Apache License, Version 2.0 (the "License");
 # you may not use this file except in compliance with the License.
@@ -12,38 +12,41 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-import sys
-sys.path.insert(0, '@pythonPath@')
-import zorba_api
-
-class MyDiagnosticHandler(zorba_api.DiagnosticHandler): 
-  def error(self, *args):
-    print "Error args: ", args
-
-def test(zorba):
-  #Read and write result
-  print 'Executing: compilerHints.xq'
-  f = open('compilerHints.xq', 'r')
-  lines = f.read()
-  f.close()
-  diagnosticHandler = MyDiagnosticHandler()
-  compilerHints = zorba_api.CompilerHints()
-  compilerHints.setOptimizationLevel(1)
-  xquery = zorba.compileQuery(lines, compilerHints, diagnosticHandler)
-  
-  result = xquery.execute()
-  print result
-  return
-
-
-store = zorba_api.InMemoryStore_getInstance()
-zorba = zorba_api.Zorba_getInstance(store)
-
-print "Running: CompileQuery string + Dignostinc handler + CompilerHint - with optimization 1"
-test(zorba)
-print "Success"
-
+require '@rubyPath@/zorba_api'
+
+def test(zorba, query)
+  begin
+    xquery = zorba.compileQuery(query)
+    print xquery.execute()
+    print "Success"
+  rescue => e
+    print "Caught error: " + e.message
+  ensure
+    xquery.destroy()
+  end
+end
+
+store = Zorba_api::InMemoryStore.getInstance()
+zorba = Zorba_api::Zorba.getInstance(store)
+
+print "Running: Compile query string using JSONiq \n"
+query = <<-eoquery
+ let $sats := jn:json-doc("@rubyPath@/../tests/satellites.json")('satellites') 
+ return { 
+   'visible' : [ 
+      for $sat in jn:keys($sats) 
+      where $sats($sat)('visible') 
+      return $sat 
+   ], 
+   'invisible' : [ 
+      for $sat in jn:keys($sats) 
+      where not($sats($sat)('visible')) 
+      return $sat 
+   ] 
+ } 
+eoquery
+
+test(zorba, query)
 
 zorba.shutdown()
-zorba_api.InMemoryStore_shutdown(store)
-
+Zorba_api::InMemoryStore.shutdown(store)
\ No newline at end of file

=== modified file 'swig/ruby/tests/test13.rb'
--- swig/ruby/tests/test13.rb	2012-03-27 00:56:11 +0000
+++ swig/ruby/tests/test13.rb	2013-03-27 00:42:25 +0000
@@ -1,4 +1,4 @@
-# Copyright 2006-2011 The FLWOR Foundation.
+# Copyright 2006-2012 The FLWOR Foundation.
 # 
 # Licensed under the Apache License, Version 2.0 (the "License");
 # you may not use this file except in compliance with the License.
@@ -12,39 +12,30 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-import sys
-sys.path.insert(0, '@pythonPath@')
-import zorba_api
-
-class MyDiagnosticHandler(zorba_api.DiagnosticHandler): 
-  def error(self, *args):
-    print "Error args: ", args
-
-def test(zorba):
-  #Read and write result
-  print 'Executing: compilerHints.xq'
-  f = open('compilerHints.xq', 'r')
-  lines = f.read()
-  f.close()
-  diagnosticHandler = MyDiagnosticHandler()
-  compilerHints = zorba_api.CompilerHints()
-  compilerHints.setLibModule(True)
-  compilerHints.setOptimizationLevel(0)
-  xquery = zorba.compileQuery(lines, compilerHints, diagnosticHandler)
-  
-  result = xquery.execute()
-  print result
-  return
-
-
-store = zorba_api.InMemoryStore_getInstance()
-zorba = zorba_api.Zorba_getInstance(store)
-
-print "Running: CompileQuery string + Dignostinc handler + CompilerHint - with optimization 0 - setLibModule(True)"
+require '@rubyPath@/zorba_api'
+
+def test(zorba)
+  begin
+    itemFactory = zorba.getItemFactory()
+    print "Creating JSON Item null:  ", itemFactory.createJSONNull().serialize()
+    print "Creating JSON Item number:  ", itemFactory.createJSONNumber("5").serialize()
+    sv = Zorba_api.StringVector(4)
+    sv[0]="Hello"
+    sv[1]="Zorba"
+    sv[2]="Hello"
+    sv[3]="Zorba"
+    print "Creating JSON Item array:  ", itemFactory.createJSONArray(sv).serialize()
+    print "Success"
+  rescue => e
+    print "Caught error: " + e.message
+  end
+end
+
+store = Zorba_api::InMemoryStore.getInstance()
+zorba = Zorba_api::Zorba.getInstance(store)
+
+print "Running: Creating JSON objects using the API"
 test(zorba)
-print "Success"
-
 
 zorba.shutdown()
-zorba_api.InMemoryStore_shutdown(store)
-
+Zorba_api::InMemoryStore.shutdown(store)
\ No newline at end of file

=== modified file 'swig/ruby/tests/test14.rb'
--- swig/ruby/tests/test14.rb	2012-03-27 00:56:11 +0000
+++ swig/ruby/tests/test14.rb	2013-03-27 00:42:25 +0000
@@ -1,4 +1,4 @@
-# Copyright 2006-2011 The FLWOR Foundation.
+# Copyright 2006-2012 The FLWOR Foundation.
 # 
 # Licensed under the Apache License, Version 2.0 (the "License");
 # you may not use this file except in compliance with the License.
@@ -12,39 +12,32 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-import sys
-sys.path.insert(0, '@pythonPath@')
-import zorba_api
-
-class MyDiagnosticHandler(zorba_api.DiagnosticHandler): 
-  def error(self, *args):
-    print "Error args: ", args
-
-def test(zorba):
-  #Read and write result
-  print 'Executing: compilerHints.xq'
-  f = open('compilerHints.xq', 'r')
-  lines = f.read()
-  f.close()
-  diagnosticHandler = MyDiagnosticHandler()
-  compilerHints = zorba_api.CompilerHints()
-  compilerHints.setLibModule(True)
-  compilerHints.setOptimizationLevel(1)
-  xquery = zorba.compileQuery(lines, compilerHints, diagnosticHandler)
-  
-  result = xquery.execute()
-  print result
-  return
-
-
-store = zorba_api.InMemoryStore_getInstance()
-zorba = zorba_api.Zorba_getInstance(store)
-
-print "Running: CompileQuery string + Dignostinc handler + CompilerHint - with optimization 1 - setLibModule(True)"
+require '@rubyPath@/zorba_api'
+
+class MyDiagnosticHandler < Zorba_api::DiagnosticHandler
+  def error(args)
+    print "Error args: " + args.getDescription() + "\n"
+  end
+end
+
+def test(zorba)
+  diagnosticHandler = MyDiagnosticHandler.new
+  begin
+    xquery = zorba.compileQuery("1 div 0", diagnosticHandler)
+    print xquery.execute()
+  rescue => e
+    print "Caught error: " + e.message
+  ensure
+    xquery.destroy()
+  end
+end
+
+store = Zorba_api::InMemoryStore.getInstance()
+zorba = Zorba_api::Zorba.getInstance(store)
+
+print "Running: Capturing error with DiagnosticHandler\n"
 test(zorba)
 print "Success"
 
-
 zorba.shutdown()
-zorba_api.InMemoryStore_shutdown(store)
-
+Zorba_api::InMemoryStore.shutdown(store)
\ No newline at end of file

=== modified file 'swig/ruby/zorba_api.i'
--- swig/ruby/zorba_api.i	2013-02-07 17:24:36 +0000
+++ swig/ruby/zorba_api.i	2013-03-27 00:42:25 +0000
@@ -13,9 +13,12 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-%include "std_string.i"
+
+%rename (IteratorImpl) swig::Iterator;
+
 %include ../zorba_api.i
 
+
 %runtime %{
 #ifdef WIN32
 #ifdef shutdown

=== modified file 'swig/xqj/CMakeLists.txt'
--- swig/xqj/CMakeLists.txt	2013-02-07 17:24:36 +0000
+++ swig/xqj/CMakeLists.txt	2013-03-27 00:42:25 +0000
@@ -87,7 +87,7 @@
     INCLUDE (UseJava)
     SET(CMAKE_JAVA_INCLUDE_PATH  ${CMAKE_JAVA_INCLUDE_PATH} ${ZORBA_JAVA_JAR} "${CMAKE_CURRENT_BINARY_DIR}/tck/xqjapi.jar") # JAVA_SWIG_FILES is predefined in Java binding
     ADD_JAR(zorba_xqj ${XQJ_SWIG_FILES})
-    ADD_DEPENDENCIES(zorba_xqj lib_zorba_java_api)
+    ADD_DEPENDENCIES(zorba_xqj zorba_api_java)
     SET_TARGET_PROPERTIES (zorba_xqj PROPERTIES FOLDER "APIs" OUTPUT_NAME "zorba_xqj" PROJECT_LABEL "XQJ")
   ELSE (${RESULT} GREATER -1)
     IF (WIN32)
@@ -100,7 +100,7 @@
     MESSAGE(STATUS "XQJ CLASSPATH " ${XQJ_CLASSPATH})
     ADD_LIBRARY(XQJ dummy.c)
     SET_TARGET_PROPERTIES (XQJ PROPERTIES FOLDER "APIs" OUTPUT_NAME "zorba_xqj" PROJECT_LABEL "XQJ")
-    ADD_DEPENDENCIES(XQJ lib_zorba_java_api)
+    ADD_DEPENDENCIES(XQJ zorba_api_java)
     ADD_CUSTOM_COMMAND(TARGET XQJ
                      POST_BUILD
                      COMMAND cmake -E echo "Compiling XQJ files..."

=== modified file 'swig/xqj/ZorbaXQDataSource.java'
--- swig/xqj/ZorbaXQDataSource.java	2013-02-07 17:24:36 +0000
+++ swig/xqj/ZorbaXQDataSource.java	2013-03-27 00:42:25 +0000
@@ -130,8 +130,8 @@
    * 
    * Implementations that support user name and password must recognize the user name and password properties listed below. 
    * 
-   * user	the user name to use for creating a connection
-   * password	the password to use for creating a connection
+   * user the user name to use for creating a connection
+   * password the password to use for creating a connection
    * 
    * Any additional properties are implementation-defined.
    * 

=== modified file 'swig/xqj/ZorbaXQSequenceType.java'
--- swig/xqj/ZorbaXQSequenceType.java	2013-02-07 17:24:36 +0000
+++ swig/xqj/ZorbaXQSequenceType.java	2013-03-27 00:42:25 +0000
@@ -44,12 +44,12 @@
    * 
    * One of:
    * 
-   * Description	Value
-   * Zero or one	OCC_ZERO_OR_ONE
-   * Exactly one	OCC_EXACTLY_ONE
-   * Zero or more	OCC_ZERO_OR_MORE
-   * One or more	OCC_ONE_OR_MORE
-   * Empty	      OCC_EMPTY
+   * Description  Value
+   * Zero or one  OCC_ZERO_OR_ONE
+   * Exactly one  OCC_EXACTLY_ONE
+   * Zero or more OCC_ZERO_OR_MORE
+   * One or more  OCC_ONE_OR_MORE
+   * Empty        OCC_EMPTY
    * 
    * @return int indicating the occurrence indicator
    */

=== modified file 'swig/xqj/ZorbaXQStaticCollectionManager.java'
--- swig/xqj/ZorbaXQStaticCollectionManager.java	2013-02-07 17:24:36 +0000
+++ swig/xqj/ZorbaXQStaticCollectionManager.java	2013-03-27 00:42:25 +0000
@@ -68,7 +68,7 @@
 
   /** \brief This function creates the collection with the given name.
    * 
-   * @param aName	The name of the collection to create.
+   * @param aName The name of the collection to create.
    * @throw XQException- if a collection with the given name already exists.
    */
     public void createCollection(XQItem aName ) throws XQException {
@@ -78,7 +78,7 @@
 
   /** \brief This function removes the collection with the given name.
    * 
-   * @param aName	- The name of the collection to delete.
+   * @param aName - The name of the collection to delete.
    * @throw XQException - if the collection does not exist.
    */
     public void deleteCollection(XQItem aName ) throws XQException {
@@ -88,7 +88,7 @@
 
   /** \brief Returns a instance of the Collection class which can be used to modify and retrieve the contents of the collection identified by the given name.
    * 
-   * @param aName	- The name of the collection to retrieve.
+   * @param aName - The name of the collection to retrieve.
    * @return ZorbaXQCollection - The collection if available.
    * @throw XQException - if the collection does not exist.
    */

=== modified file 'swig/zorba_api.i'
--- swig/zorba_api.i	2013-02-07 17:24:36 +0000
+++ swig/zorba_api.i	2013-03-27 00:42:25 +0000
@@ -17,19 +17,15 @@
 %module zorba_api
 %module(directors="1") zorba_api
 
-
-TSRMLS_FETCH();
-
-//%include "std_string.i"
+%include "std_string.i"
+%include "cstring.i"
 %include "std_pair.i"
 %include "exception.i"
 %include "carrays.i"
 %apply (char *STRING, size_t LENGTH) { (const char aStream[], size_t aLen) }
 %rename(opEquals) operator=;
 
-#ifndef SWIGRUBY
 %include "std_vector.i"
-#endif
 
 %exception {
   try {
@@ -47,18 +43,20 @@
   }
 }
 
-#ifndef SWIGRUBY
 namespace std {
-  %template(StringPairVector) vector< pair<string, string> >;
-  %template(StringPair) pair<string, string>;
-  %template(StringVector) vector< string >;
+  %template(StringPairVector) std::vector< pair<std::string, std::string> >;
+  %template(StringPair) std::pair<std::string, std::string>;
+  %template(StringVector) std::vector< std::string >;
 }
-#endif
+
+
+
 
 %{  // Implementations
 
+
+
 #include "Config.h"
-
 #include <string>
 #include <sstream>
 #include <zorba/zorba.h>
@@ -109,17 +107,18 @@
   #include "XmlDataManager.h"
   #include "DiagnosticHandler.h"
   #include "Store.h"
-  
+
 %}
 
-#ifndef SWIGRUBY
+
 namespace std {
-  %template(ItemVector) vector<Item>; 
+%template(ItemVector) std::vector<Item>;
+%template(ItemPair) std::pair<Item, Item>;
 }
-#endif
 
 /* %include "various.i" required for mapping to Java byte[]*/
 
+
 %include "ZorbaIOStream.i"
 %include "ZorbaStreamBuffer.i"
 %include "SerializationOptions.i"
@@ -141,3 +140,4 @@
 %include "StaticCollectionManager.i"
 %include "DocumentManager.i"
 %include "XmlDataManager.i"
+


Follow ups