← Back to team overview

zorba-coders team mailing list archive

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

 

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

Requested reviews:
  Zorba Coders (zorba-coders)

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

This upgrade supply the required objects and methods for basic XQJ support.
-- 
https://code.launchpad.net/~zorba-coders/zorba/bug931580/+merge/92818
Your team Zorba Coders is requested to review the proposed merge of lp:~zorba-coders/zorba/bug931580 into lp:zorba.
=== added file 'swig/DynamicContext.h'
--- swig/DynamicContext.h	1970-01-01 00:00:00 +0000
+++ swig/DynamicContext.h	2012-02-13 18:16:44 +0000
@@ -0,0 +1,45 @@
+/*
+ * Copyright 2006-2008 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.
+ */
+#ifndef API_DYNAMIC_CONTEXT_H
+#define API_DYNAMIC_CONTEXT_H
+
+class DynamicContext
+{
+private:
+  zorba::DynamicContext* theContext;
+public:
+
+  DynamicContext():theContext(0) {}
+  DynamicContext(const DynamicContext& aCtx):theContext(aCtx.theContext) {}
+  DynamicContext(zorba::DynamicContext* aCtx):theContext(aCtx) {}
+
+  bool 	getContextItem (Item& aItem);
+  Item 	getCurrentDateTime ();
+  Item 	getDefaultCollection ();
+  int 	getImplicitTimezone ();
+  bool 	getVariable (const std::string& aNamespace, const std::string& aLocalname, Item& aItem, Iterator& aIterator);
+  
+  bool setContextItem (Item& aItem);
+  bool setCurrentDateTime (Item& aDateTimeItem);
+  bool setDefaultCollection (Item& aCollectionUri);
+  bool setImplicitTimezone (int aTimezone);
+  bool setVariable (const std::string& aNamespace, const std::string& aLocalname, Iterator& aIter);
+  bool setVariable (const std::string& aQName, Item& aItem);
+  bool setVariable (const std::string& aQName, Iterator& aIterator);
+
+};
+
+#endif
\ No newline at end of file

=== added file 'swig/DynamicContext.i'
--- swig/DynamicContext.i	1970-01-01 00:00:00 +0000
+++ swig/DynamicContext.i	2012-02-13 18:16:44 +0000
@@ -0,0 +1,59 @@
+/*
+ * Copyright 2006-2008 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.
+ */
+
+%{  // start Implementation
+
+  bool DynamicContext::getContextItem (Item& aItem) {
+    return theContext->getContextItem(aItem.theItem);
+  }
+  Item DynamicContext::getCurrentDateTime (){
+    return Item(theContext->getCurrentDateTime());
+  }
+  Item DynamicContext::getDefaultCollection () {
+    return Item(theContext->getDefaultCollection());
+  }
+  int 	DynamicContext::getImplicitTimezone (){
+    return theContext->getImplicitTimezone();
+  }
+  bool 	DynamicContext::getVariable (const std::string& aNamespace, const std::string& aLocalname, Item& aItem, Iterator& aIterator) {
+    return theContext->getVariable(aNamespace, aLocalname, aItem.theItem, aIterator.theIterator);
+  }
+
+  bool DynamicContext::setContextItem (Item& aItem) {
+    return theContext->setContextItem(aItem.theItem);
+  }
+  bool DynamicContext::setCurrentDateTime (Item& aDateTimeItem) {
+    return theContext->setCurrentDateTime(aDateTimeItem.theItem);
+  }
+  bool DynamicContext::setDefaultCollection (Item& aCollectionUri) {
+    return theContext->setDefaultCollection(aCollectionUri.theItem);
+  }
+  bool DynamicContext::setImplicitTimezone (int aTimezone) {
+    return theContext->setImplicitTimezone(aTimezone);
+  }
+  bool DynamicContext::setVariable(const std::string& aNamespace, const std::string& aLocalname, Iterator& aIter) {
+    return theContext->setVariable(aNamespace, aLocalname, aIter.theIterator);
+  }
+  bool DynamicContext::setVariable (const std::string& aQName, Item& aItem) {
+    return theContext->setVariable (aQName, aItem.theItem);
+  }
+  bool DynamicContext::setVariable (const std::string& aQName, Iterator& aIterator) {
+    return theContext->setVariable (aQName, aIterator.theIterator);
+  }
+
+%}  // end   Implementation
+
+%include "DynamicContext.h"

=== added file 'swig/Item.h'
--- swig/Item.h	1970-01-01 00:00:00 +0000
+++ swig/Item.h	2012-02-13 18:16:44 +0000
@@ -0,0 +1,66 @@
+/*
+ * Copyright 2006-2008 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.
+ */
+
+#ifndef API_ITEM_H
+#define API_ITEM_H
+
+class Item 
+{
+  friend class Iterator;
+  friend class StaticContext;
+  friend class DocumentManager; 
+  friend class SingletonIterator;
+  friend class DynamicContext;
+  friend class ItemFactory;
+private:
+  zorba::Item theItem;
+
+public: 
+  Item() {}
+  Item(const Item& aItem) : theItem(aItem.theItem) {}
+  Item(const zorba::Item& aZItem) : theItem(aZItem) {}
+
+  static Item createEmptyItem();
+  std::string getStringValue() const;
+  std::string serialize() const;
+  std::string Item::serialize(SerializationOptions serOptions) const;
+  Iterator getAtomizationValue () const;
+  Iterator getAttributes () const;
+  bool getBooleanValue () const;
+  Iterator getChildren () const;
+  Item getEBV () const;
+  int getIntValue () const;
+  double 	getDoubleValue () const;
+  long long getLongValue () const;
+  std::string getLocalName () const;
+  std::string getNamespace () const;
+  bool getNodeName (Item &aNodeName) const;
+  Item 	getParent () const;
+  std::string getPrefix () const;
+  Item getType () const;
+  unsigned int getUnsignedIntValue () const;
+
+  int getNodeKind() const;
+  bool isAtomic () const;
+  bool isNaN () const;
+  bool isNode () const;
+  bool isNull () const;
+  bool isPosOrNegInf () const;
+  
+  void close();
+}; // class Item
+
+#endif

=== added file 'swig/Item.i'
--- swig/Item.i	1970-01-01 00:00:00 +0000
+++ swig/Item.i	2012-02-13 18:16:44 +0000
@@ -0,0 +1,114 @@
+/*
+ * Copyright 2006-2008 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.
+ */
+
+%{  // start Implementation
+
+  Item Item::createEmptyItem()
+  {  return Item();  }
+
+  std::string Item::getStringValue() const 
+  {  return std::string(theItem.getStringValue().c_str());  }
+
+  std::string Item::serialize() const 
+  {
+    std::stringstream lStream;
+    Zorba_SerializerOptions_t lOptions;
+    lOptions.omit_xml_declaration = ZORBA_OMIT_XML_DECLARATION_YES;
+    zorba::Serializer_t lSerializer = zorba::Serializer::createSerializer(lOptions);
+    zorba::SingletonItemSequence lSequence(theItem);
+    lSerializer->serialize(&lSequence, lStream);
+    return lStream.str();
+  }
+  std::string Item::serialize(SerializationOptions serOptions) const 
+  {
+    std::stringstream lStream;
+    serOptions.lOptions.omit_xml_declaration = ZORBA_OMIT_XML_DECLARATION_YES;
+    zorba::Serializer_t lSerializer = zorba::Serializer::createSerializer(serOptions.lOptions);
+    zorba::SingletonItemSequence lSequence(theItem);
+    lSerializer->serialize(&lSequence, lStream);
+    return lStream.str();
+  }
+
+  Iterator Item::getAtomizationValue () const
+  { return Iterator(theItem.getAtomizationValue()); }
+
+  Iterator Item::getAttributes () const
+  { return Iterator(theItem.getAttributes()); }
+
+  bool Item::getBooleanValue () const
+  { return theItem.getBooleanValue(); }
+
+  Iterator Item::getChildren () const
+  { return Iterator(theItem.getChildren()); }
+
+  Item Item::getEBV () const
+  { return Item(theItem.getEBV()); }
+
+  int Item::getIntValue () const
+  { return theItem.getIntValue(); }
+
+  double 	Item::getDoubleValue () const
+  { return theItem.getDoubleValue(); }
+
+  long long Item::getLongValue () const
+  { return theItem.getLongValue(); }
+
+  std::string Item::getLocalName () const
+  { return std::string(theItem.getLocalName().c_str()); }
+
+  std::string Item::getNamespace () const
+  { return std::string(theItem.getNamespace().c_str()); }
+
+  bool Item::getNodeName (Item &aNodeName) const
+  { return theItem.getNodeName( aNodeName.theItem ); }
+
+  Item 	Item::getParent () const
+  { return theItem.getParent(); }
+
+  std::string Item::getPrefix () const
+  { return std::string(theItem.getPrefix().c_str()); }
+
+  Item Item::getType () const
+  { return Item( theItem.getType() ); }
+
+  unsigned int Item::getUnsignedIntValue () const
+  { return theItem.getUnsignedIntValue(); }
+
+  bool Item::isAtomic () const
+  { return theItem.isAtomic(); }
+
+  bool Item::isNaN () const
+  { return theItem.isNaN(); }
+
+  bool Item::isNode () const
+  { return theItem.isNode(); }
+
+  bool Item::isNull () const
+  { return theItem.isNull(); }
+
+  bool Item::isPosOrNegInf () const
+  { return theItem.isPosOrNegInf(); }
+
+  int Item::getNodeKind () const
+  { return theItem.getNodeKind(); }
+  
+  void Item::close()
+  { theItem.close(); }
+
+%}  // end   Implementation
+
+
+%include "Item.h"

=== modified file 'swig/ItemFactory.h'
--- swig/ItemFactory.h	2011-10-27 18:01:22 +0000
+++ swig/ItemFactory.h	2012-02-13 18:16:44 +0000
@@ -1,4 +1,21 @@
-// Interface
+/*
+ * Copyright 2006-2008 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.
+ */
+
+#ifndef API_ITEM_FACTORY_H
+#define API_ITEM_FACTORY_H
 
 class ItemFactory
 {
@@ -11,13 +28,16 @@
     ItemFactory(const ItemFactory& aItemFactory) : theItemFactory(aItemFactory.theItemFactory) {}
 
     Item 	createAnyURI (const std::string &aURI);
-    Item 	createAttributeNode (Item aParent, Item aNodeName, Item aTypeName, Item aTypedValue);
-    Item 	createAttributeNode (Item aParent, Item aNodeName, Item aTypeName, std::vector< Item > aTypedValue);
+    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 	createBase64Binary (const char *aBinData, size_t aLength);
     Item 	createBase64Binary (std::istream &aStream);
     Item 	createBase64Binary (const unsigned char *aBinData, size_t aLength);
     Item 	createBoolean (bool aValue);
     Item 	createByte (char aByte);
+    Item 	createCommentNode (Item &aParent, const std::string &aContent);
     Item 	createDate (const std::string &aDate);
     Item 	createDate (short aYear, short aMonth, short aDay);
     Item 	createDateTime (const std::string &aDateTimeValue);
@@ -29,7 +49,13 @@
     Item 	createDouble (double aValue);
     Item 	createDuration (const std::string &aValue);
     Item 	createDuration (short aYear, short aMonths, short aDays, short aHours, short aMinutes, double aSeconds);
-    //Item 	createElementNode (Item &aParent, Item aNodeName, Item aTypeName, bool aHasTypedValue, bool aHasEmptyValue, std::vector< std::pair< std::string, std::string > > aNsBindings);
+    Item 	createDayTimeDuration (const std::string &aValue);
+    Item 	createYearMonthDuration (const std::string &aValue);
+    Item 	createDocumentNode (const std::string &aBaseUri, const std::string &aDocUri);
+#ifndef SWIGRUBY
+    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);
     Item 	createFloat (const std::string &aValue);
     Item 	createFloat (float aValue);
     Item 	createGDay (const std::string &aValue);
@@ -51,6 +77,7 @@
     Item 	createNegativeInteger (long long aValue);
     Item 	createNonNegativeInteger (unsigned long long aValue);
     Item 	createNonPositiveInteger (long long aValue);
+    Item 	createPiNode (Item &aParent, const std::string &aTarget, const std::string &aContent, const std::string &aBaseUri);
     Item 	createPositiveInteger (unsigned long long aValue);
     Item 	createQName (const std::string &aNamespace, const std::string &aPrefix, const std::string &aLocalname);
     Item 	createQName (const std::string &aNamespace, const std::string &aLocalname);
@@ -58,7 +85,7 @@
     Item 	createShort (short aShort);
     //Item 	createStreamableString (std::istream &stream, StreamReleaser streamReleaser, bool seekable=false);
     Item 	createString (const std::string &aString);
-    Item 	createTextNode (Item parent, std::string content);
+    Item 	createTextNode (Item &aParent, const std::string &aContent);
     Item 	createTime (short aHour, short aMinute, double aSecond, short aTimeZone_hours);
     Item 	createTime (short aHour, short aMinute, double aSecond);
     Item 	createTime (const std::string &aValue);
@@ -67,3 +94,5 @@
     Item 	createUnsignedLong (unsigned long long aValue);
     Item 	createUnsignedShort (unsigned short aValue);
 }; // class ItemFactory
+
+#endif
\ No newline at end of file

=== modified file 'swig/ItemFactory.i'
--- swig/ItemFactory.i	2011-10-27 18:01:22 +0000
+++ swig/ItemFactory.i	2012-02-13 18:16:44 +0000
@@ -1,5 +1,5 @@
 
-%{  // start Implementation
+%{  // start Implementation3
 
 
  
@@ -7,11 +7,12 @@
     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 ));
   }
   
-  Item 	ItemFactory::createAttributeNode (Item aParent, Item aNodeName, Item aTypeName, std::vector< Item > aTypedValue){
+#ifndef SWIGRUBY
+  Item 	ItemFactory::createAttributeNode (Item& aParent, Item& aNodeName, Item& aTypeName, std::vector< Item > aTypedValue){
 
     std::vector< zorba::Item > typedValue;
     typedValue.reserve(aTypedValue.size());
@@ -21,6 +22,7 @@
     }
     return Item( theItemFactory->createAttributeNode (aParent.theItem, aNodeName.theItem, aTypeName.theItem, typedValue ));
   }
+#endif
   
   Item 	ItemFactory::createBase64Binary (const char *aBinData, size_t aLength){
     return Item( theItemFactory->createBase64Binary(aBinData, aLength));
@@ -37,6 +39,10 @@
   Item 	ItemFactory::createByte (char aByte){
     return Item( theItemFactory->createByte(aByte));
   }
+  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){
     return Item( theItemFactory->createDate(aDate));
   }
@@ -70,11 +76,32 @@
   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::createElementNode (Item &aParent, Item aNodeName, Item aTypeName, bool aHasTypedValue, bool aHasEmptyValue, std::vector< std::pair< std::string, std::string > > aNsBindings){
-    return Item( theItemFactory->createElementNode (aParent.theItem, aNodeName.theItem, aTypeName.theItem, aHasTypedValue, aHasEmptyValue, aNsBindings));
-  }
-  */
+  Item 	ItemFactory::createDayTimeDuration (const std::string &aValue){
+    return Item( theItemFactory->createDayTimeDuration (aValue));
+  }
+  Item 	ItemFactory::createYearMonthDuration (const std::string &aValue){
+    return Item( theItemFactory->createYearMonthDuration (aValue));
+  }
+  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){
+    std::vector< std::pair< zorba::String, zorba::String > > items;
+    items.reserve(aNsBindings.size());
+    std::vector< std::pair< std::string, std::string > >::iterator iter;
+    for(iter = aNsBindings.begin(); iter != aNsBindings.end(); iter++) {
+      std::pair< zorba::String, zorba::String > pair;
+      pair.first = (*iter).first;
+      pair.second = (*iter).second;
+      items.push_back(pair);
+    }
+    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){
+    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));
   }
@@ -138,6 +165,12 @@
   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){
+    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){
     return Item( theItemFactory->createPositiveInteger (aValue));
   }
@@ -161,8 +194,9 @@
   Item 	ItemFactory::createString (const std::string &aString){
     return Item( theItemFactory->createString (aString));
   }
-  Item 	ItemFactory::createTextNode (Item parent, std::string content){
-    return Item( theItemFactory->createTextNode (parent.theItem, content));
+  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){
     return Item( theItemFactory->createTime (aHour, aMinute, aSecond, aTimeZone_hours));
@@ -189,4 +223,4 @@
 
 %}  // end Implementation
 
-%include "ItemFactory.h"
\ No newline at end of file
+%include "ItemFactory.h"

=== added file 'swig/Iterator.h'
--- swig/Iterator.h	1970-01-01 00:00:00 +0000
+++ swig/Iterator.h	2012-02-13 18:16:44 +0000
@@ -0,0 +1,53 @@
+/*
+ * Copyright 2006-2008 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.
+ */
+#ifndef API_ITERATOR_H
+#define API_ITERATOR_H
+
+class Iterator 
+{
+protected:
+  friend class DynamicContext;
+  friend class StaticContext;
+  friend class XQuery;
+  zorba::Iterator_t theIterator;
+  zorba::Item theItem;
+  bool theConsumed;
+public:
+  // constructors
+  Iterator() {}
+  Iterator(const Iterator& anIterator)
+    : theIterator(anIterator.theIterator),
+      theItem(anIterator.theItem),
+      theConsumed(false)
+  {}
+  Iterator(zorba::Iterator_t anIterator)
+    : theIterator(anIterator),
+      theConsumed(false)
+  {}
+  Iterator(zorba::Item& aItem)
+    : theIterator(0),
+      theItem(aItem),
+      theConsumed(false)
+  {}
+
+  void open();
+  bool isOpen();
+  bool next(Item&);
+  void close();
+  void destroy();
+}; // class Iterator
+
+#endif
\ No newline at end of file

=== added file 'swig/Iterator.i'
--- swig/Iterator.i	1970-01-01 00:00:00 +0000
+++ swig/Iterator.i	2012-02-13 18:16:44 +0000
@@ -0,0 +1,69 @@
+/*
+ * Copyright 2006-2008 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.
+ */
+
+%{  // start Implementation
+
+  void Iterator::open()
+  {
+    if (theIterator)
+      theIterator->open();
+    theConsumed = false;
+  }
+
+  bool Iterator::isOpen()
+  {
+    if (theIterator)
+      return theIterator->isOpen();
+    else 
+      return !theConsumed;
+  }
+
+  void Iterator::close()
+  {
+    if (theIterator)
+      theIterator->close();
+    theConsumed = true;
+  }
+
+  void Iterator::destroy()
+  {
+    theIterator = 0;
+  }
+
+  bool Iterator::next(Item& aItem)
+  {
+    if (theIterator)
+    {
+      return theIterator->next(aItem.theItem);
+    }
+    else
+    {
+      if (!theConsumed)
+      {
+        aItem = theItem;
+        return true;
+      }
+      else
+      {
+        return false;
+      }
+    }
+  }
+
+
+%}  // end   Implementation
+
+%include "Iterator.h"

=== added file 'swig/SerializationOptions.h'
--- swig/SerializationOptions.h	1970-01-01 00:00:00 +0000
+++ swig/SerializationOptions.h	2012-02-13 18:16:44 +0000
@@ -0,0 +1,114 @@
+/*
+ * Copyright 2006-2008 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.
+ */
+
+#ifndef API_SERIALIZATION_OPTIONS_H
+#define API_SERIALIZATION_OPTIONS_H
+
+class SerializationOptions
+{
+friend class Item;
+
+public:
+  typedef enum 
+  {
+    ZORBA_SERIALIZATION_METHOD_XML,
+    ZORBA_SERIALIZATION_METHOD_HTML,
+    ZORBA_SERIALIZATION_METHOD_XHTML,
+    ZORBA_SERIALIZATION_METHOD_TEXT,
+    ZORBA_SERIALIZATION_METHOD_BINARY
+  } SerializationMethod;
+
+  typedef enum 
+  {
+    ZORBA_BYTE_ORDER_MARK_YES,
+    ZORBA_BYTE_ORDER_MARK_NO
+  } ByteOrderMark;
+
+
+  typedef enum 
+  {
+    ZORBA_ESCAPE_URI_ATTRIBUTES_YES,
+    ZORBA_ESCAPE_URI_ATTRIBUTES_NO
+  } EscapeUriAttributes;
+
+  typedef enum {
+    ZORBA_INCLUDE_CONTENT_TYPE_YES,
+    ZORBA_INCLUDE_CONTENT_TYPE_NO
+  } IncludeContentType;
+
+  typedef enum {
+    ZORBA_INDENT_YES,
+    ZORBA_INDENT_NO
+  } Indent;
+
+  typedef enum {
+    ZORBA_NORMALIZATION_FORM_NFC,
+    ZORBA_NORMALIZATION_FORM_NFD,
+    ZORBA_NORMALIZATION_FORM_NFKC,
+    ZORBA_NORMALIZATION_FORM_NFKD,
+    ZORBA_NORMALIZATION_FORM_FULLY_normalized,
+    ZORBA_NORMALIZATION_FORM_NONE
+  } NormalizationForm;
+
+  typedef enum {
+    ZORBA_OMIT_XML_DECLARATION_YES,
+    ZORBA_OMIT_XML_DECLARATION_NO
+  } OmitXMLDeclaration;
+
+  typedef enum {
+    ZORBA_STANDALONE_YES,
+    ZORBA_STANDALONE_NO,
+    ZORBA_STANDALONE_OMIT
+  } Standalone;
+
+  typedef enum {
+    ZORBA_UNDECLARE_PREFIXES_YES,
+    ZORBA_UNDECLARE_PREFIXES_NO
+  } UndeclarePrefixes;
+
+
+private:
+  Zorba_SerializerOptions_t lOptions;
+  
+public:
+  /*
+   * Default values:
+   *   - serialization method: XML
+   *   - byte order mark: NO
+   *   - esacpe uri attributes: NO
+   *   - include content type: NO
+   *   - indent: NO
+   *   - normalization form: none
+   *   - omit xml declaration: NO
+   *   - standalone: omit
+   *   - undeclare prefixes: NO
+   */
+
+
+  void setSerializationMethod ( SerializationMethod aSerializationMethod );
+  void setByteOrderMark ( ByteOrderMark aByteOrderMark );
+  void setEscapeUriAttributes ( EscapeUriAttributes aEscapeUriAttributes );
+  void setIncludeContentType ( IncludeContentType aIncludeContentType );
+  void setIndent ( Indent aIndent );
+  void setNormalizationForm ( NormalizationForm aNormalizationForm );
+  void setOmitXMLDeclaration ( OmitXMLDeclaration aOmitXMLDeclaration );
+  void setStandalone ( Standalone aStandalone );
+  void setUndeclarePrefixes ( UndeclarePrefixes aUndeclarePrefixes );
+  void setSerializerOption(const std::string &parameter, const std::string &value);
+
+}; // class SerializationOptions
+
+#endif

=== added file 'swig/SerializationOptions.i'
--- swig/SerializationOptions.i	1970-01-01 00:00:00 +0000
+++ swig/SerializationOptions.i	2012-02-13 18:16:44 +0000
@@ -0,0 +1,125 @@
+/*
+ * Copyright 2006-2008 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.
+ */
+
+%{  // start Implementation
+
+  void SerializationOptions::setSerializationMethod ( SerializationMethod aSerializationMethod ) {
+    switch (aSerializationMethod) {
+      case SerializationMethod::ZORBA_SERIALIZATION_METHOD_HTML:
+        lOptions.ser_method = Zorba_serialization_method_t::ZORBA_SERIALIZATION_METHOD_HTML;
+        break;
+      case SerializationMethod::ZORBA_SERIALIZATION_METHOD_XHTML:
+        lOptions.ser_method = Zorba_serialization_method_t::ZORBA_SERIALIZATION_METHOD_XHTML;
+        break;
+      case SerializationMethod::ZORBA_SERIALIZATION_METHOD_TEXT:
+        lOptions.ser_method = Zorba_serialization_method_t::ZORBA_SERIALIZATION_METHOD_TEXT;
+        break;
+      case SerializationMethod::ZORBA_SERIALIZATION_METHOD_BINARY:
+        lOptions.ser_method = Zorba_serialization_method_t::ZORBA_SERIALIZATION_METHOD_BINARY;
+        break;
+      case SerializationMethod::ZORBA_SERIALIZATION_METHOD_XML:
+      default:
+        lOptions.ser_method = Zorba_serialization_method_t::ZORBA_SERIALIZATION_METHOD_XML;
+        break;
+    }
+  }
+  void SerializationOptions::setByteOrderMark ( ByteOrderMark aByteOrderMark ) {
+    if (aByteOrderMark == ByteOrderMark::ZORBA_BYTE_ORDER_MARK_YES) {
+      lOptions.byte_order_mark = Zorba_byte_order_mark_t::ZORBA_BYTE_ORDER_MARK_YES;
+    } else {
+      lOptions.byte_order_mark = Zorba_byte_order_mark_t::ZORBA_BYTE_ORDER_MARK_NO;
+    }
+  }
+  void SerializationOptions::setEscapeUriAttributes ( EscapeUriAttributes aEscapeUriAttributes ) {
+    if (aEscapeUriAttributes == EscapeUriAttributes::ZORBA_ESCAPE_URI_ATTRIBUTES_YES) {
+      lOptions.escape_uri_attributes = Zorba_escape_uri_attributes_t::ZORBA_ESCAPE_URI_ATTRIBUTES_YES;
+    } else {
+      lOptions.escape_uri_attributes = Zorba_escape_uri_attributes_t::ZORBA_ESCAPE_URI_ATTRIBUTES_NO;
+    }
+  }
+  void SerializationOptions::setIncludeContentType ( IncludeContentType aIncludeContentType ) {
+    if (aIncludeContentType == IncludeContentType::ZORBA_INCLUDE_CONTENT_TYPE_YES) {
+      lOptions.include_content_type = Zorba_include_content_type_t::ZORBA_INCLUDE_CONTENT_TYPE_YES;
+    } else {
+      lOptions.include_content_type = Zorba_include_content_type_t::ZORBA_INCLUDE_CONTENT_TYPE_NO;
+    }
+  }
+  void SerializationOptions::setIndent ( Indent aIndent ) {
+    if (aIndent == Indent::ZORBA_INDENT_YES) {
+      lOptions.indent = Zorba_indent_t::ZORBA_INDENT_YES;
+    } else {
+      lOptions.indent = Zorba_indent_t::ZORBA_INDENT_NO;
+    }
+  }
+  void SerializationOptions::setNormalizationForm ( NormalizationForm aNormalizationForm ) {
+    switch (aNormalizationForm) {
+      case NormalizationForm::ZORBA_NORMALIZATION_FORM_NFC:
+        lOptions.normalization_form = Zorba_normalization_form_t::ZORBA_NORMALIZATION_FORM_NFC;
+        break;
+      case NormalizationForm::ZORBA_NORMALIZATION_FORM_NFD:
+        lOptions.normalization_form = Zorba_normalization_form_t::ZORBA_NORMALIZATION_FORM_NFD;
+        break;
+      case NormalizationForm::ZORBA_NORMALIZATION_FORM_NFKC:
+        lOptions.normalization_form = Zorba_normalization_form_t::ZORBA_NORMALIZATION_FORM_NFKC;
+        break;
+      case NormalizationForm::ZORBA_NORMALIZATION_FORM_NFKD:
+        lOptions.normalization_form = Zorba_normalization_form_t::ZORBA_NORMALIZATION_FORM_NFKD;
+        break;
+      case NormalizationForm::ZORBA_NORMALIZATION_FORM_FULLY_normalized:
+        lOptions.normalization_form = Zorba_normalization_form_t::ZORBA_NORMALIZATION_FORM_FULLY_normalized;
+        break;
+      case NormalizationForm::ZORBA_NORMALIZATION_FORM_NONE:
+      default:
+        lOptions.normalization_form = Zorba_normalization_form_t::ZORBA_NORMALIZATION_FORM_NONE;
+        break;
+    }
+  }
+  void SerializationOptions::setOmitXMLDeclaration ( OmitXMLDeclaration aOmitXMLDeclaration ) {
+    if (aOmitXMLDeclaration == OmitXMLDeclaration::ZORBA_OMIT_XML_DECLARATION_YES) {
+      lOptions.omit_xml_declaration = Zorba_omit_xml_declaration_t::ZORBA_OMIT_XML_DECLARATION_YES;
+    } else {
+      lOptions.omit_xml_declaration = Zorba_omit_xml_declaration_t::ZORBA_OMIT_XML_DECLARATION_NO;
+    }
+  }
+  void SerializationOptions::setStandalone ( Standalone aStandalone ) {
+    switch (aStandalone) {
+      case Standalone::ZORBA_STANDALONE_YES:
+        lOptions.standalone = Zorba_standalone_t::ZORBA_STANDALONE_YES;
+        break;
+      case Standalone::ZORBA_STANDALONE_NO:
+        lOptions.standalone = Zorba_standalone_t::ZORBA_STANDALONE_NO;
+        break;
+      case Standalone::ZORBA_STANDALONE_OMIT:
+      default:
+        lOptions.standalone = Zorba_standalone_t::ZORBA_STANDALONE_OMIT;
+        break;
+    }
+  }
+  void SerializationOptions::setUndeclarePrefixes ( UndeclarePrefixes aUndeclarePrefixes ) {
+    if (aUndeclarePrefixes == UndeclarePrefixes::ZORBA_UNDECLARE_PREFIXES_YES) {
+      lOptions.undeclare_prefixes = Zorba_undeclare_prefixes_t::ZORBA_UNDECLARE_PREFIXES_YES;
+    } else {
+      lOptions.undeclare_prefixes = Zorba_undeclare_prefixes_t::ZORBA_UNDECLARE_PREFIXES_NO;
+    }
+  }
+
+  void SerializationOptions::setSerializerOption(const std::string &parameter, const std::string &value) {
+    lOptions.SetSerializerOption(parameter.c_str(), value.c_str());
+  }
+  
+%}  // end Implementation
+
+%include "SerializationOptions.h"

=== modified file 'swig/StaticContext.h'
--- swig/StaticContext.h	2011-10-27 18:01:22 +0000
+++ swig/StaticContext.h	2012-02-13 18:16:44 +0000
@@ -1,5 +1,69 @@
+/*
+ * Copyright 2006-2008 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.
+ */
+#ifndef API_STATIC_CONTEXT_H
+#define API_STATIC_CONTEXT_H
+
 #include <zorba/static_context_consts.h>
 
+class ZorbaConstants
+{
+public:
+  typedef enum {
+    PRESERVE,
+    NO_PRESERVE
+  } PreserveMode;
+
+  typedef enum {
+    INHERIT,
+    NO_INHERIT
+  } InheritMode;
+
+  typedef enum {
+    PRESERVE_SPACE,
+    STRIP_SPACE
+  } BoundarySpaceMode;
+
+  typedef enum {
+    PRESERVE_CONSTRUCTION,
+    STRIP_CONSTRUCTION
+  } ConstructionMode;
+
+  typedef enum {
+    EMPTY_GREATEST,
+    EMPTY_LEAST
+  } OrderEmptyMode;
+
+  typedef enum {
+    ORDERED,
+    UNORDERED
+  } OrderingMode;
+
+  typedef enum {
+    VALIDATE_SKIP,
+    VALIDATE_LAX,
+    VALIDATE_STRICT
+  } RevalidationMode;
+
+  typedef enum {
+    XPATH2_0,
+    XPATH1_0
+  } XPath1_0CompatibleMode;
+
+}; // ZorbaConstants
+
 class StaticContext 
 {
 friend class Zorba;
@@ -8,62 +72,70 @@
 private:
   zorba::StaticContext_t theStaticContext;
 public:
+
   StaticContext();
   StaticContext(const StaticContext& aStaticContext);
   StaticContext(zorba::StaticContext_t aStaticContext);
   
-  virtual void addColation(const std::string& aURI); 
-  virtual bool addNamespace(const std::string& aPrefix,
+  void addColation(const std::string& aURI); 
+  bool addNamespace(const std::string& aPrefix,
                             const std::string& aURI);
-  void addReference() const;
-  virtual bool containsFunction(const std::string &aFnNameUri, 
+
+  bool containsFunction(const std::string &aFnNameUri, 
                                 const std::string &aFnNameLocal, 
                                 int arity) const;
 
-  virtual StaticContext createChildContext() const;
-  virtual void declareOption(const Item &aQName, 
+  StaticContext createChildContext() const;
+  void declareOption(const Item &aQName, 
                              const std::string &aOptionVal);
-  virtual void disableFunction(const Item &aQName, int arity);
-
-  virtual void free ();
-  virtual std::string getBaseURI () const;
-  virtual zorba::boundary_space_mode_t getBoundarySpacePolicy () const;
-
-  virtual zorba::construction_mode_t getConstructionMode () const;
-  virtual void getCopyNamespacesMode (zorba::preserve_mode_t &aPreserve, zorba::inherit_mode_t &aInherit) const;
-  virtual std::string getDefaultCollation () const;
-  virtual std::string getDefaultElementAndTypeNamespace () const;
-  virtual std::string getDefaultFunctionNamespace () const;
-  virtual zorba::order_empty_mode_t getDefaultOrderForEmptySequences () const;
-
-  virtual std::string getNamespaceURIByPrefix(const std::string &aPrefix) const;
-  virtual bool getOption(const Item &aQName, std::string &aOptionValue) const;
-  virtual zorba::ordering_mode_t getOrderingMode() const;
-  long getRefCount() const;
-  virtual zorba::validation_mode_t getRevalidationMode();
-  virtual zorba::xpath1_0compatib_mode_t getXPath1_0CompatibMode () const;
-  virtual void loadProlog (const std::string & aProlog, 
-                           const CompilerHints &hints);
-
-  void removeReference ();
-  virtual void resetTraceStream ();
-  virtual bool setBaseURI (const std::string &aBaseURI);
-  virtual bool setBoundarySpacePolicy (zorba::boundary_space_mode_t aMode);
-
-  virtual bool setConstructionMode (zorba::construction_mode_t aMode);
-
-  virtual bool setCopyNamespacesMode (zorba::preserve_mode_t aPreserve, 
-                                      zorba::inherit_mode_t aInherit);
-  virtual void setDefaultCollation (const std::string &aURI);
-  virtual bool setDefaultElementAndTypeNamespace (const std::string &aURI);
-  virtual bool setDefaultFunctionNamespace (const std::string &aURI);
-  virtual bool setDefaultOrderForEmptySequences (zorba::order_empty_mode_t aMode);
-
-  virtual bool setOrderingMode (zorba::ordering_mode_t aMode);
-  virtual void setRevalidationMode (zorba::validation_mode_t aMode);
-
-  virtual bool setXPath1_0CompatibMode (zorba::xpath1_0compatib_mode_t aMode);
+  void disableFunction(const Item &aQName, int arity);
+
+  std::string getBaseURI () const;
+
+  ZorbaConstants::BoundarySpaceMode getBoundarySpacePolicy ();
+  ZorbaConstants::ConstructionMode  getConstructionMode();
+  ZorbaConstants::PreserveMode getCopyNamespacesModePreserve();
+  ZorbaConstants::InheritMode  getCopyNamespacesModeInherit();
+  ZorbaConstants::OrderEmptyMode getDefaultOrderForEmptySequences();
+  ZorbaConstants::OrderingMode getOrderingMode();
+  ZorbaConstants::RevalidationMode getRevalidationMode();
+  ZorbaConstants::XPath1_0CompatibleMode getXPath1_0CompatibMode();
+
+  std::string getDefaultCollation () const;
+  std::string getDefaultElementAndTypeNamespace () const;
+  std::string getDefaultFunctionNamespace () const;
+  
+  std::vector< std::pair< std::string, std::string > > getNamespaceBindings ();
+
+  std::string getNamespaceURIByPrefix(const std::string &aPrefix) const;
+  bool getOption(const Item &aQName, std::string &aOptionValue) const;
+  void loadProlog (const std::string & aProlog, const CompilerHints &hints);
+
+  void getExternalVariables(Iterator& vars) const;
+  
+  TypeIdentifier getCollectionType(const std::string &aCollectionUri);
+  TypeIdentifier getDocumentType(const std::string &aDocUri);
+  TypeIdentifier getContextItemStaticType();
+
+  void setContextItemStaticType(const TypeIdentifier &aType);
+  
+  void resetTraceStream ();
+  bool setBaseURI (const std::string &aBaseURI);
+
+  bool setBoundarySpacePolicy (ZorbaConstants::BoundarySpaceMode aMode);
+  bool setConstructionMode (ZorbaConstants::ConstructionMode aMode);
+  bool setCopyNamespacesMode (ZorbaConstants::PreserveMode aPreserve, ZorbaConstants::InheritMode aInherit);
+  bool setDefaultOrderForEmptySequences (ZorbaConstants::OrderEmptyMode aMode);
+  bool setOrderingMode (ZorbaConstants::OrderingMode aMode);
+  void setRevalidationMode (ZorbaConstants::RevalidationMode aMode);
+  void setURIPath(std::vector< std::string > &aURIPath );
+  bool setXPath1_0CompatibMode (ZorbaConstants::XPath1_0CompatibleMode aMode);
+  
+  void setDefaultCollation (const std::string &aURI);
+  bool setDefaultElementAndTypeNamespace (const std::string &aURI);
+  bool setDefaultFunctionNamespace (const std::string &aURI);
 
   void destroy();
 }; // class StaticContext
 
+#endif
\ No newline at end of file

=== modified file 'swig/StaticContext.i'
--- swig/StaticContext.i	2011-10-12 20:56:27 +0000
+++ swig/StaticContext.i	2012-02-13 18:16:44 +0000
@@ -31,65 +31,94 @@
 void StaticContext::addColation(const std::string& aURI)
   { theStaticContext->addCollation(aURI); }
 
-bool StaticContext::addNamespace(const std::string& aPrefix, 
-                            const std::string& aURI)
+bool StaticContext::addNamespace(const std::string& aPrefix, const std::string& aURI)
   { return theStaticContext->addNamespace(aPrefix, aURI); }
 
-void StaticContext::addReference() const
-  { theStaticContext->addReference(); }
-  
-bool StaticContext::containsFunction(const std::string &aFnNameUri, 
-                                const std::string &aFnNameLocal, 
-                                int arity) const 
-  { return theStaticContext->containsFunction(aFnNameUri, aFnNameLocal,
-                                              arity); }
+bool StaticContext::containsFunction(const std::string &aFnNameUri, const std::string &aFnNameLocal, int arity) const 
+  { return theStaticContext->containsFunction(aFnNameUri, aFnNameLocal, arity); }
 
 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)
   { theStaticContext->disableFunction( aQName.theItem, arity); }
 
-void 	StaticContext::free ()
-  { theStaticContext->free(); }
-
 std::string StaticContext::getBaseURI () const
   { return std::string(theStaticContext->getBaseURI().c_str()); }
 
-zorba::boundary_space_mode_t StaticContext::getBoundarySpacePolicy() const
-  { return theStaticContext->getBoundarySpacePolicy(); }
-
-zorba::construction_mode_t StaticContext::getConstructionMode () const 
-  { return theStaticContext->getConstructionMode(); }		
-
-void 	StaticContext::getCopyNamespacesMode (zorba::preserve_mode_t &aPreserve, zorba::inherit_mode_t &aInherit) const
-  { return theStaticContext->getCopyNamespacesMode(aPreserve, aInherit); }		
+ZorbaConstants::BoundarySpaceMode StaticContext::getBoundarySpacePolicy()
+  { 
+    ZorbaConstants::BoundarySpaceMode result = ZorbaConstants::PRESERVE_SPACE;
+    zorba::boundary_space_mode_t boundary = theStaticContext->getBoundarySpacePolicy();
+    if (boundary == zorba::strip_space) {
+      result = ZorbaConstants::STRIP_SPACE;
+    }
+    return result;
+  }
+
+ZorbaConstants::ConstructionMode StaticContext::getConstructionMode() 
+  { 
+    ZorbaConstants::ConstructionMode result = ZorbaConstants::STRIP_CONSTRUCTION;
+    zorba::construction_mode_t construction = theStaticContext->getConstructionMode();
+    if (construction == zorba::preserve_cons) {
+      result = ZorbaConstants::PRESERVE_CONSTRUCTION;
+    }
+    return result;
+  }		
+
+ZorbaConstants::PreserveMode StaticContext::getCopyNamespacesModePreserve()
+  { 
+    zorba::preserve_mode_t lPreserve;
+    zorba::inherit_mode_t lInherit;
+    ZorbaConstants::PreserveMode aPreserve = ZorbaConstants::NO_PRESERVE;
+    theStaticContext->getCopyNamespacesMode(lPreserve, lInherit); 
+    if (lPreserve==zorba::preserve_ns) {
+      aPreserve = ZorbaConstants::PRESERVE;
+    }
+    return aPreserve;
+  }
+
+ZorbaConstants::InheritMode StaticContext::getCopyNamespacesModeInherit()
+  { 
+    zorba::preserve_mode_t lPreserve;
+    zorba::inherit_mode_t lInherit;
+    ZorbaConstants::InheritMode aInherit = ZorbaConstants::NO_INHERIT;
+    theStaticContext->getCopyNamespacesMode(lPreserve, lInherit); 
+    if (lInherit==zorba::inherit_ns) {
+      aInherit = ZorbaConstants::INHERIT;
+    }
+    return aInherit;
+  }
 
 std::string StaticContext::getDefaultCollation () const 
   { return std::string(theStaticContext->getDefaultCollation().c_str()); }
 
 std::string StaticContext::getDefaultElementAndTypeNamespace () const 
   { 
-    return std::string(theStaticContext->getDefaultElementAndTypeNamespace().
-                       c_str()); 
+    return std::string( theStaticContext->getDefaultElementAndTypeNamespace().c_str() ); 
   }
 
 std::string StaticContext::getDefaultFunctionNamespace () const 
   { 
-    return std::string(theStaticContext->getDefaultFunctionNamespace().c_str());
+    return std::string( theStaticContext->getDefaultFunctionNamespace().c_str() );
   }
 
-zorba::order_empty_mode_t StaticContext::getDefaultOrderForEmptySequences() const
-  { return theStaticContext->getDefaultOrderForEmptySequences(); }
+ZorbaConstants::OrderEmptyMode StaticContext::getDefaultOrderForEmptySequences()
+  { 
+    ZorbaConstants::OrderEmptyMode result = ZorbaConstants::EMPTY_GREATEST;
+    zorba::order_empty_mode_t order = theStaticContext->getDefaultOrderForEmptySequences();
+    if (order == zorba::empty_least) {
+      result = ZorbaConstants::EMPTY_LEAST;
+    }
+    return result;
+  }
 
 std::string StaticContext::getNamespaceURIByPrefix(const std::string &aPrefix) const
   {
-    return std::string(theStaticContext->getNamespaceURIByPrefix(aPrefix).
-                       c_str());
+    return std::string( theStaticContext->getNamespaceURIByPrefix(aPrefix).c_str() );
   }
 
 bool StaticContext::getOption(const Item &aQName, std::string &aOptionValue) const
@@ -98,40 +127,108 @@
     return theStaticContext->getOption(aQName.theItem, optVal); 
   }
 
-zorba::ordering_mode_t StaticContext::getOrderingMode () const
-  { return theStaticContext->getOrderingMode(); }
-
-long StaticContext::getRefCount () const
-  { return theStaticContext->getRefCount(); }
-
-zorba::validation_mode_t StaticContext::getRevalidationMode ()
-  { return theStaticContext->getRevalidationMode(); }
-
-zorba::xpath1_0compatib_mode_t StaticContext::getXPath1_0CompatibMode () const
-  { return theStaticContext->getXPath1_0CompatibMode(); } 
-
-void StaticContext::loadProlog (const std::string & aProlog, 
-                           const CompilerHints &hints)
+ZorbaConstants::OrderingMode StaticContext::getOrderingMode ()
+  { 
+    ZorbaConstants::OrderingMode result = ZorbaConstants::ORDERED;
+    zorba::ordering_mode_t order = theStaticContext->getOrderingMode();
+    if (order == zorba::unordered) {
+      result = ZorbaConstants::UNORDERED;
+    }
+    return result;
+  }
+
+ZorbaConstants::RevalidationMode StaticContext::getRevalidationMode ()
+  { 
+    ZorbaConstants::RevalidationMode result = ZorbaConstants::VALIDATE_SKIP;
+    zorba::validation_mode_t revalidation = theStaticContext->getRevalidationMode();
+    if (revalidation == zorba::validate_lax) {
+      result = ZorbaConstants::VALIDATE_LAX;
+    } else if (revalidation == zorba::validate_strict) {
+      result = ZorbaConstants::VALIDATE_STRICT;
+    }
+    return result;
+  }
+
+ZorbaConstants::XPath1_0CompatibleMode StaticContext::getXPath1_0CompatibMode ()
+  { 
+    ZorbaConstants::XPath1_0CompatibleMode result = ZorbaConstants::XPATH2_0;
+    zorba::xpath1_0compatib_mode_t comp = theStaticContext->getXPath1_0CompatibMode();
+    if (comp == zorba::xpath1_0) {
+      result = ZorbaConstants::XPATH1_0;
+    }
+    return result;
+  }
+
+void StaticContext::loadProlog (const std::string & aProlog, const CompilerHints &hints)
   { theStaticContext->loadProlog( aProlog, hints.theCompilerHints); }
 
-void StaticContext::removeReference ()
-  { theStaticContext->removeReference(); }
-
+void StaticContext::getExternalVariables(Iterator& vars) const 
+  { theStaticContext->getExternalVariables( vars.theIterator ); }
+
+TypeIdentifier StaticContext::getCollectionType(const std::string & aCollectionUri)
+  { return TypeIdentifier(theStaticContext->getCollectionType(aCollectionUri)); }
+  
+TypeIdentifier StaticContext::getDocumentType(const std::string &aDocUri)
+  { return TypeIdentifier(theStaticContext->getDocumentType(aDocUri)); }
+  
+TypeIdentifier StaticContext::getContextItemStaticType()
+  { return TypeIdentifier(theStaticContext->getContextItemStaticType()); }
+
+std::vector< std::pair< std::string, std::string > > StaticContext::getNamespaceBindings () {
+  std::vector< std::pair< zorba::String, zorba::String > > items;
+  std::vector< std::pair< std::string, std::string > > result;
+  theStaticContext->getNamespaceBindings(items);
+  std::vector< std::pair< zorba::String, zorba::String > >::iterator iter;
+  for(iter = items.begin(); iter != items.end(); iter++) {
+    std::pair< std::string, std::string > pair;
+    pair.first = (*iter).first.c_str();
+    pair.second = (*iter).second.c_str();
+    result.push_back(pair);
+  }
+  return result;
+}
+  
+  
+  
+void StaticContext::setContextItemStaticType(const TypeIdentifier &aType)
+  { theStaticContext->setContextItemStaticType(aType.theTypeIdentifier); }
+  
 void StaticContext::resetTraceStream ()
   { theStaticContext->resetTraceStream(); }
 
 bool StaticContext::setBaseURI (const std::string &aBaseURI)
   { return theStaticContext->setBaseURI(aBaseURI); }
 
-bool StaticContext::setBoundarySpacePolicy (zorba::boundary_space_mode_t aMode)
-  { return theStaticContext->setBoundarySpacePolicy(aMode); } 
-
-bool StaticContext::setConstructionMode (zorba::construction_mode_t aMode)
-  { return theStaticContext->setConstructionMode(aMode); } 
-
-bool StaticContext::setCopyNamespacesMode (zorba::preserve_mode_t aPreserve, 
-    zorba::inherit_mode_t aInherit)
-  { return theStaticContext->setCopyNamespacesMode(aPreserve, aInherit); }   
+bool StaticContext::setBoundarySpacePolicy (ZorbaConstants::BoundarySpaceMode aMode)
+  {
+    zorba::boundary_space_mode_t lMode = zorba::strip_space;
+    if (aMode == ZorbaConstants::PRESERVE_SPACE) {
+      lMode = zorba::preserve_space;
+    }
+    return theStaticContext->setBoundarySpacePolicy(lMode);
+  }
+
+bool StaticContext::setConstructionMode (ZorbaConstants::ConstructionMode aMode)
+  {
+    zorba::construction_mode_t lMode = zorba::preserve_cons;
+    if (aMode == ZorbaConstants::STRIP_CONSTRUCTION) {
+      lMode = zorba::strip_cons;
+    }
+    return theStaticContext->setConstructionMode(lMode);
+  }
+
+bool StaticContext::setCopyNamespacesMode (ZorbaConstants::PreserveMode aPreserve, ZorbaConstants::InheritMode aInherit)
+  {
+    zorba::preserve_mode_t lPreserve = zorba::no_preserve_ns;
+    zorba::inherit_mode_t lInherit = zorba::no_inherit_ns;
+    if (aPreserve == ZorbaConstants::PRESERVE) {
+      lPreserve = zorba::preserve_ns;
+    }
+    if (aInherit == ZorbaConstants::INHERIT) {
+      lInherit = zorba::inherit_ns;
+    }
+    return theStaticContext->setCopyNamespacesMode(lPreserve, lInherit);
+  }   
 
 void StaticContext::setDefaultCollation (const std::string &aURI)
   { theStaticContext->setDefaultCollation(aURI); }
@@ -142,17 +239,54 @@
 bool StaticContext::setDefaultFunctionNamespace (const std::string &aURI)
   { return theStaticContext->setDefaultFunctionNamespace(aURI); }
 
-bool StaticContext::setDefaultOrderForEmptySequences (zorba::order_empty_mode_t aMode)
-  { return theStaticContext->setDefaultOrderForEmptySequences(aMode); } 
-
-bool StaticContext::setOrderingMode (zorba::ordering_mode_t aMode)
-  { return theStaticContext->setOrderingMode(aMode); } 
-
-void StaticContext::setRevalidationMode (zorba::validation_mode_t aMode)
-  { return theStaticContext->setRevalidationMode(aMode); } 
-
-bool StaticContext::setXPath1_0CompatibMode (zorba::xpath1_0compatib_mode_t aMode)
-  { return theStaticContext->setXPath1_0CompatibMode(aMode); }
+bool StaticContext::setDefaultOrderForEmptySequences (ZorbaConstants::OrderEmptyMode aMode)
+  {
+    zorba::order_empty_mode_t lMode = zorba::empty_greatest;
+    if (aMode == ZorbaConstants::EMPTY_LEAST) {
+      lMode = zorba::empty_least;
+    }
+    return theStaticContext->setDefaultOrderForEmptySequences(lMode);
+  }
+
+bool StaticContext::setOrderingMode (ZorbaConstants::OrderingMode aMode)
+  {
+    zorba::ordering_mode_t lMode = zorba::ordered;
+    if (aMode == ZorbaConstants::UNORDERED) {
+      lMode = zorba::unordered;
+    }
+    return theStaticContext->setOrderingMode(lMode);
+  }
+
+void StaticContext::setRevalidationMode (ZorbaConstants::RevalidationMode aMode)
+  {
+    zorba::validation_mode_t lMode = zorba::validate_skip;
+    if (aMode == ZorbaConstants::VALIDATE_LAX) {
+      lMode = zorba::validate_lax;
+    } else if (aMode == ZorbaConstants::VALIDATE_STRICT) {
+      lMode = zorba::validate_strict;
+    }
+    return theStaticContext->setRevalidationMode(lMode);
+  }
+
+void StaticContext::setURIPath(std::vector< std::string > &aURIPath )
+  {
+    std::vector< zorba::String > lURIPath;
+    lURIPath.reserve(aURIPath.size());
+    std::vector< std::string >::iterator iter;
+    for(iter = aURIPath.begin(); iter != aURIPath.end(); iter++) {
+      lURIPath.push_back((*iter));
+    }    
+    theStaticContext->setURIPath(lURIPath);
+  }
+
+bool StaticContext::setXPath1_0CompatibMode (ZorbaConstants::XPath1_0CompatibleMode aMode)
+  {
+    zorba::xpath1_0compatib_mode_t lMode = zorba::xpath2_0;
+    if (aMode == ZorbaConstants::XPATH1_0) {
+      lMode = zorba::xpath1_0;
+    }
+    return theStaticContext->setXPath1_0CompatibMode(lMode);
+  }
 
 void StaticContext::destroy() 
   { theStaticContext = 0; }
@@ -165,7 +299,7 @@
 %}  // end Implementation
 
 
-    // Interface
+// Interface
 
 %rename(XPath1_0CompatibModeEnum) zorba::xpath1_0compatib_mode_t;
 %rename(XPATH2_0) xpath2_0;

=== modified file 'swig/Store.i'
--- swig/Store.i	2010-03-23 05:30:50 +0000
+++ swig/Store.i	2012-02-13 18:16:44 +0000
@@ -15,6 +15,8 @@
  */
 
 %{  // start Implementation
+
+#include <zorba/store_consts.h>
  
 class Store 
 {

=== added file 'swig/TypeIdentifier.h'
--- swig/TypeIdentifier.h	1970-01-01 00:00:00 +0000
+++ swig/TypeIdentifier.h	2012-02-13 18:16:44 +0000
@@ -0,0 +1,98 @@
+/*
+ * Copyright 2006-2008 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.
+ */
+
+#ifndef API_TYPE_IDENTIFIER_H
+#define API_TYPE_IDENTIFIER_H
+
+class IdentTypes {
+public:
+  typedef enum {
+    NAMED_TYPE,
+    ELEMENT_TYPE,
+    ATTRIBUTE_TYPE,
+    DOCUMENT_TYPE,
+    PI_TYPE,
+    TEXT_TYPE,
+    COMMENT_TYPE,
+    ANY_NODE_TYPE,
+    ITEM_TYPE,
+    EMPTY_TYPE,
+    INVALID_TYPE,
+  } Kind;
+
+  typedef enum {
+    QUANT_ONE,
+    QUANT_QUESTION,
+    QUANT_PLUS,
+    QUANT_STAR,
+  } Quantifier;
+};
+
+class TypeIdentifier 
+{
+  friend class StaticContext;
+private:
+  zorba::TypeIdentifier_t theTypeIdentifier;
+  static zorba::IdentTypes::quantifier_t convertQuantifier(IdentTypes::Quantifier quantifier);
+
+public: 
+  TypeIdentifier() {}
+  TypeIdentifier (const TypeIdentifier& aTypeIdentifier) : theTypeIdentifier(aTypeIdentifier.theTypeIdentifier) {}
+  TypeIdentifier (const zorba::TypeIdentifier_t& aZTypeIdentifier) : theTypeIdentifier(aZTypeIdentifier) {}
+
+  TypeIdentifier getContentType();
+  IdentTypes::Kind getKind();
+  const std::string getLocalName();
+  IdentTypes::Quantifier getQuantifier();
+  long getRefCount();
+  const std::string getUri();
+  bool isLocalNameWildcard();
+  bool isUriWildcard();
+
+  static TypeIdentifier 
+  createAnyNodeType (IdentTypes::Quantifier quantifier=IdentTypes::QUANT_ONE);
+  
+  static TypeIdentifier 
+  createAttributeType (const std::string &uri, bool uriWildcard, const std::string &localNameName, bool localNameWildcard, TypeIdentifier contentType, IdentTypes::Quantifier quantifier=IdentTypes::QUANT_ONE);
+  
+  static TypeIdentifier 
+  createCommentType (IdentTypes::Quantifier quantifier=IdentTypes::QUANT_ONE);
+  
+  static TypeIdentifier 
+  createDocumentType (TypeIdentifier contentType, IdentTypes::Quantifier quantifier=IdentTypes::QUANT_ONE);
+  
+  static TypeIdentifier 
+  createElementType (const std::string &uri, bool uriWildcard, const std::string &localName, bool localNameWildcard, TypeIdentifier contentType, IdentTypes::Quantifier quantifier=IdentTypes::QUANT_ONE);
+  
+  static TypeIdentifier 
+  createEmptyType();
+  
+  static TypeIdentifier 
+  createItemType (IdentTypes::Quantifier quantifier=IdentTypes::QUANT_ONE);
+  
+  static TypeIdentifier 
+  createNamedType (const std::string &uri, const std::string &localName, IdentTypes::Quantifier quantifier=IdentTypes::QUANT_ONE);
+  
+  static TypeIdentifier 
+  createPIType (IdentTypes::Quantifier quantifier=IdentTypes::QUANT_ONE);
+  
+  static TypeIdentifier 
+  createTextType (IdentTypes::Quantifier quantifier=IdentTypes::QUANT_ONE);
+  
+}; // class TypeIdentifier
+
+
+#endif
\ No newline at end of file

=== added file 'swig/TypeIdentifier.i'
--- swig/TypeIdentifier.i	1970-01-01 00:00:00 +0000
+++ swig/TypeIdentifier.i	2012-02-13 18:16:44 +0000
@@ -0,0 +1,197 @@
+/*
+ * Copyright 2006-2008 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.
+ */
+
+%{  // start Implementation
+
+  zorba::IdentTypes::quantifier_t 
+  TypeIdentifier::convertQuantifier(IdentTypes::Quantifier quantifier)
+  {
+    zorba::IdentTypes::quantifier_t result;
+    switch (quantifier) {
+      case IdentTypes::QUANT_ONE:
+        result = zorba::IdentTypes::QUANT_ONE;
+        break;
+      case IdentTypes::QUANT_QUESTION:
+        result = zorba::IdentTypes::QUANT_QUESTION;
+        break;
+      case IdentTypes::QUANT_PLUS:
+        result = zorba::IdentTypes::QUANT_PLUS;
+        break;
+      case IdentTypes::QUANT_STAR:
+        result = zorba::IdentTypes::QUANT_STAR;
+        break;
+    }
+    return result;
+  }
+
+  TypeIdentifier TypeIdentifier::getContentType()
+  {
+    return TypeIdentifier(theTypeIdentifier->getContentType());
+  }
+  IdentTypes::Kind TypeIdentifier::getKind()
+  {
+    zorba::IdentTypes::kind_t lKind = theTypeIdentifier->getKind();
+    IdentTypes::Kind result;
+    switch (lKind) {
+      case zorba::IdentTypes::NAMED_TYPE:
+        result = IdentTypes::NAMED_TYPE;
+        break;
+      case zorba::IdentTypes::ELEMENT_TYPE:
+        result = IdentTypes::ELEMENT_TYPE;
+        break;
+      case zorba::IdentTypes::ATTRIBUTE_TYPE:
+        result = IdentTypes::ATTRIBUTE_TYPE;
+        break;
+      case zorba::IdentTypes::DOCUMENT_TYPE:
+        result = IdentTypes::DOCUMENT_TYPE;
+        break;
+      case zorba::IdentTypes::PI_TYPE:
+        result = IdentTypes::PI_TYPE;
+        break;
+      case zorba::IdentTypes::TEXT_TYPE:
+        result = IdentTypes::TEXT_TYPE;
+        break;
+      case zorba::IdentTypes::COMMENT_TYPE:
+        result = IdentTypes::COMMENT_TYPE;
+        break;
+      case zorba::IdentTypes::ANY_NODE_TYPE:
+        result = IdentTypes::ANY_NODE_TYPE;
+        break;
+      case zorba::IdentTypes::ITEM_TYPE:
+        result = IdentTypes::ITEM_TYPE;
+        break;
+      case zorba::IdentTypes::EMPTY_TYPE:
+        result = IdentTypes::EMPTY_TYPE;
+        break;
+      case zorba::IdentTypes::INVALID_TYPE:
+        result = IdentTypes::INVALID_TYPE;
+        break;
+      default:
+        result = IdentTypes::ANY_NODE_TYPE;
+        break;
+    }
+    return result;
+  }
+  const std::string TypeIdentifier::getLocalName()
+  {
+    return std::string(theTypeIdentifier->getLocalName().c_str());
+  }
+  IdentTypes::Quantifier TypeIdentifier::getQuantifier()
+  {
+    zorba::IdentTypes::quantifier_t lQuantifier = theTypeIdentifier->getQuantifier();
+    IdentTypes::Quantifier result;
+    switch (lQuantifier) {
+      case zorba::IdentTypes::QUANT_ONE:
+        result = IdentTypes::QUANT_ONE;
+        break;
+      case zorba::IdentTypes::QUANT_QUESTION:
+        result = IdentTypes::QUANT_QUESTION;
+        break;
+      case zorba::IdentTypes::QUANT_PLUS:
+        result = IdentTypes::QUANT_PLUS;
+        break;
+      case zorba::IdentTypes::QUANT_STAR:
+        result = IdentTypes::QUANT_STAR;
+        break;
+    }
+    return result;
+  }
+  long TypeIdentifier::getRefCount()
+  {
+    return theTypeIdentifier->getRefCount();
+  }
+  const std::string TypeIdentifier::getUri()
+  {
+    return std::string(theTypeIdentifier->getUri().c_str());
+  }
+  bool TypeIdentifier::isLocalNameWildcard()
+  {
+    return theTypeIdentifier->isLocalNameWildcard();
+  }
+  bool TypeIdentifier::isUriWildcard()
+  {
+    return theTypeIdentifier->isUriWildcard();
+  }
+  
+
+  //  STATIC METHODS
+  TypeIdentifier 
+  TypeIdentifier::createAnyNodeType (IdentTypes::Quantifier quantifier)
+  {
+    return TypeIdentifier( zorba::TypeIdentifier::createAnyNodeType ( convertQuantifier(quantifier) ) );
+  }
+
+  TypeIdentifier 
+  TypeIdentifier::createAttributeType (const std::string &uri, bool uriWildcard, const std::string &localNameName, bool localNameWildcard, TypeIdentifier contentType, IdentTypes::Quantifier quantifier)
+  {
+    return TypeIdentifier( zorba::TypeIdentifier::createAttributeType( uri, uriWildcard, localNameName, localNameWildcard, contentType.theTypeIdentifier,  convertQuantifier(quantifier) ) );
+  }
+
+  TypeIdentifier 
+  TypeIdentifier::createCommentType (IdentTypes::Quantifier quantifier)
+  {
+    return TypeIdentifier( zorba::TypeIdentifier::createCommentType ( convertQuantifier(quantifier) ) );
+  }
+
+  TypeIdentifier 
+  TypeIdentifier::createDocumentType (TypeIdentifier contentType, IdentTypes::Quantifier quantifier)
+  {
+    return TypeIdentifier( zorba::TypeIdentifier::createDocumentType(contentType.theTypeIdentifier, convertQuantifier(quantifier) ) );
+  }
+
+  TypeIdentifier 
+  TypeIdentifier::createElementType (const std::string &uri, bool uriWildcard, const std::string &localName, bool localNameWildcard, TypeIdentifier contentType, IdentTypes::Quantifier quantifier)
+  {
+    return TypeIdentifier( zorba::TypeIdentifier::createElementType(uri, uriWildcard, localName, localNameWildcard, contentType.theTypeIdentifier, convertQuantifier(quantifier) ) );
+  }
+
+  TypeIdentifier
+  TypeIdentifier::createEmptyType()
+  {
+    return TypeIdentifier( zorba::TypeIdentifier::createEmptyType() );
+  }
+
+  TypeIdentifier 
+  TypeIdentifier::createItemType (IdentTypes::Quantifier quantifier)
+  {
+    return TypeIdentifier( zorba::TypeIdentifier::createItemType( convertQuantifier(quantifier) ) );
+  }
+
+  TypeIdentifier 
+  TypeIdentifier::createNamedType (const std::string &uri, const std::string &localName, IdentTypes::Quantifier quantifier)
+  {
+    return TypeIdentifier( zorba::TypeIdentifier::createNamedType( uri, localName, convertQuantifier(quantifier) ) );
+  }
+
+  TypeIdentifier 
+  TypeIdentifier::createPIType (IdentTypes::Quantifier quantifier)
+  {
+    return TypeIdentifier( zorba::TypeIdentifier::createPIType( convertQuantifier(quantifier) ) );
+  }
+
+  TypeIdentifier 
+  TypeIdentifier::createTextType (IdentTypes::Quantifier quantifier)
+  {
+    return TypeIdentifier( zorba::TypeIdentifier::createTextType( convertQuantifier(quantifier) ) );
+  }
+  
+  // END OF STATIC METHODS
+
+
+%}  // end   Implementation
+
+
+%include "TypeIdentifier.h"

=== added file 'swig/XQuery.h'
--- swig/XQuery.h	1970-01-01 00:00:00 +0000
+++ swig/XQuery.h	2012-02-13 18:16:44 +0000
@@ -0,0 +1,47 @@
+/*
+ * Copyright 2006-2008 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.
+ */
+#ifndef API_XQUERY_H
+#define API_XQUERY_H
+
+class XQuery 
+{
+private:
+  zorba::XQuery_t theQuery;
+  bool closed;
+
+public:
+  XQuery():closed(false) {}
+  XQuery(const XQuery& aXQuery) : theQuery(aXQuery.theQuery), closed(aXQuery.closed) {}
+  XQuery(zorba::XQuery_t aQuery) : theQuery(aQuery), closed(false) {}
+
+  std::string execute();
+  std::string printPlanAsXML();
+  std::string printPlanAsDOT();
+  void compile (const std::string &aQuery);
+  void compile (const std::string &aQuery, StaticContext &aStaticContext);
+
+#ifdef SWIGPYTHON
+  void executeSAX(SAX2ContentHandlerProxy* contentHandlerProxy);
+#endif
+
+  void destroy();
+  Iterator iterator();
+  DynamicContext getDynamicContext();
+  StaticContext getStaticContext();
+  void getExternalVariables(Iterator& vars) const;
+}; // class XQuery
+
+#endif
\ No newline at end of file

=== modified file 'swig/XQuery.i'
--- swig/XQuery.i	2011-10-17 22:42:10 +0000
+++ swig/XQuery.i	2012-02-13 18:16:44 +0000
@@ -16,332 +16,60 @@
 
 %{  // start Implementation
 
-class Iterator 
-{
-protected:
-  friend class DynamicContext;
-  zorba::Iterator_t theIterator;
-  zorba::Item theItem;
-  bool theConsumed;
-
-public:
-  Iterator() {}
-  Iterator(const Iterator& anIterator)
-    : theIterator(anIterator.theIterator),
-      theItem(anIterator.theItem),
-      theConsumed(false)
-  {}
-
-  Iterator(zorba::Iterator_t anIterator)
-    : theIterator(anIterator),
-      theConsumed(false)
-  {}
-
-  Iterator(zorba::Item& aItem)
-    : theIterator(0),
-      theItem(aItem),
-      theConsumed(false)
-  {}
-
-  void open()
-  {
-    if (theIterator)
-      theIterator->open();
-    theConsumed = false;
-  }
-
-  bool next(Item& aItem);
-
-  void close()
-  {
-    if (theIterator)
-      theIterator->close();
-    theConsumed = true;
-  }
-
-  void destroy()
-  {
-    theIterator = 0;
-  }
-
-}; // class Iterator
-
-
-class Item 
-{
-  friend class Iterator;
-  friend class StaticContext;
-  friend class DocumentManager; 
-  friend class SingletonIterator;
-  friend class DynamicContext;
-  friend class ItemFactory;
-
-private:
-  zorba::Item theItem;
-
-public:
-  Item() {}
-  Item(const Item& aItem) : theItem(aItem.theItem) {}
-  Item(const zorba::Item& aZItem) : theItem(aZItem) {}
-
-  static Item createEmptyItem() 
-  { return Item(); }
-
-  std::string getStringValue() const 
-  { return std::string(theItem.getStringValue().c_str()); }
-  
-  std::string serialize() const 
-  {
-    std::stringstream lStream; 
-    Zorba_SerializerOptions_t lOptions; 
-    zorba::Serializer_t lSerializer = zorba::Serializer::createSerializer(lOptions); 
-    zorba::SingletonItemSequence lSequence(theItem); 
-    lSerializer->serialize(&lSequence, lStream); 
-    return lStream.str();
-  }
-  
-  Iterator getAtomizationValue () const
-  { return Iterator(theItem.getAtomizationValue()); }
-  
-  Iterator getAttributes () const
-  { return Iterator(theItem.getAttributes()); }
-  
-  bool getBooleanValue () const
-  { return theItem.getBooleanValue(); }
-
-  Iterator getChildren () const
-  { return Iterator(theItem.getChildren()); }
-
-  Item getEBV () const
-  { return Item(theItem.getEBV()); }
-
-  int getIntValue () const
-  { return theItem.getIntValue(); }
-  
-  std::string getLocalName () const
-  { return std::string(theItem.getLocalName().c_str()); }
-
-  std::string getNamespace () const
-  { return std::string(theItem.getNamespace().c_str()); }
-
-  bool getNodeName (Item &aNodeName) const
-  { return theItem.getNodeName( aNodeName.theItem ); }
-
-  std::string getPrefix () const
-  { return std::string(theItem.getPrefix().c_str()); }
-
-  Item getType () const
-  { return Item( theItem.getType() ); }
-
-  unsigned int getUnsignedIntValue () const
-  { return theItem.getUnsignedIntValue(); }
-
-  bool isAtomic () const
-  { return theItem.isAtomic(); }
-
-  bool isNaN () const
-  { return theItem.isNaN(); }
-
-  bool isNode () const
-  { return theItem.isNode(); }
-
-  bool isNull () const
-  { return theItem.isNull(); }
-
-  bool isPosOrNegInf () const
-  { return theItem.isPosOrNegInf(); }
-  
-  int getNodeKind () const
-  { return theItem.getNodeKind(); }
-
-}; // class Item
-
-class DynamicContext
-{
-private:
-  zorba::DynamicContext* theContext;
-
-public:
-  DynamicContext()
-    : theContext(0)
-  {
-  }
-
-  DynamicContext(const DynamicContext& aCtx)
-    : theContext(aCtx.theContext)
-  {
-  }
-
-  DynamicContext(zorba::DynamicContext* aCtx)
-    : theContext(aCtx)
-  {
-  }
-
-  void
-  setVariable(
-    const std::string& aNamespace,
-    const std::string& aLocalname,
-    Iterator aIter)
-  {
-    theContext->setVariable(aNamespace, aLocalname, aIter.theIterator);
-  }
-
-  void
-  setContextItem(Item aItem)
-  {
-    theContext->setContextItem(aItem.theItem);
-  }
-};
-
-class XQuery 
-{
-private:
-  zorba::XQuery_t theQuery;
-
-public:
-  XQuery() {}
-  XQuery(const XQuery& aXQuery) : theQuery(aXQuery.theQuery) {}
-  XQuery(zorba::XQuery_t aQuery) : theQuery(aQuery) {}
-
-  std::string execute()
+  std::string XQuery::execute()
   {
     std::stringstream lStream;
     lStream << theQuery;
-    return lStream.str();
+    std::string str = lStream.str();
+    return str;
   }
-
-  void compile (const std::string &aQuery)
+  
+  void XQuery::compile (const std::string &aQuery)
   {
     theQuery->compile(aQuery);
   }
 
-  void compile (const std::string &aQuery, StaticContext &aStaticContext )
+  void XQuery::compile (const std::string &aQuery, StaticContext &aStaticContext )
   {
     Zorba_CompilerHints_t hints;
     theQuery->compile(aQuery, aStaticContext.theStaticContext, hints);
   }
-
-  std::string printPlanAsXML()
+  
+  std::string XQuery::printPlanAsXML()
   {
     std::ostringstream lStream;
     theQuery->printPlan(lStream);
     return lStream.str();
   }
 
-  std::string printPlanAsDOT()
+  std::string XQuery::printPlanAsDOT()
   {
     std::ostringstream lStream;
     theQuery->printPlan(lStream, true);
     return lStream.str();
   }
-
-  DynamicContext
-  getDynamicContext()
+  
+  DynamicContext XQuery::getDynamicContext()
   {
     return DynamicContext(theQuery->getDynamicContext());
   }
 
+  StaticContext XQuery::getStaticContext()
+  {
+    return StaticContext( zorba::StaticContext_t( const_cast<zorba::StaticContext *>(theQuery->getStaticContext()) ) );
+  }
+
+  void XQuery::getExternalVariables(Iterator& vars) const 
+  { theQuery->getExternalVariables( vars.theIterator ); }
+
 #ifdef SWIGPYTHON
-  void executeSAX(SAX2ContentHandlerProxy* contentHandlerProxy)
+  void XQuery::executeSAX(SAX2ContentHandlerProxy* contentHandlerProxy)
   { theQuery->executeSAX(contentHandlerProxy); }
 #endif
 
-  void destroy() { theQuery = 0; }
-  Iterator iterator() { return Iterator(theQuery->iterator()); }
-}; // class XQuery
-
-
-// remaining method definitions from Iterator
-bool
-Iterator::next(Item& aItem)
-{
-  if (theIterator)
-  {
-    return theIterator->next(aItem.theItem);
-  }
-  else
-  {
-    if (!theConsumed)
-    {
-      aItem = theItem;
-      return true;
-    }
-    else
-    {
-      return false;
-    }
-  }
-}
-
+  void XQuery::destroy() { theQuery = 0; }
+  Iterator XQuery::iterator() { return Iterator(theQuery->iterator()); }
 
 %}  // end   Implementation
 
-
-// Interfaces
-
-class DynamicContext
-{
-public:
-  void
-  setVariable(
-    const std::string& aNamespace,
-    const std::string& aLocalname,
-    Iterator);
-
-  void
-  setContextItem(Item);
-};
-
-class Item 
-{
-public: 
-  static Item createEmptyItem();
-  std::string getStringValue() const;
-  std::string serialize() const;
-  Iterator getAtomizationValue () const;
-  Iterator getAttributes () const;
-  bool getBooleanValue () const;
-  Iterator getChildren () const;
-  Item getEBV () const;
-  int getIntValue () const;
-  std::string getLocalName () const;
-  std::string getNamespace () const;
-  bool getNodeName (Item &aNodeName) const;
-  std::string getPrefix () const;
-  Item getType () const;
-  unsigned int getUnsignedIntValue () const;
-
-  int getNodeKind() const;
-  bool isAtomic () const;
-  bool isNaN () const;
-  bool isNode () const;
-  bool isNull () const;
-  bool isPosOrNegInf () const;
-}; // class Item
-
-class Iterator 
-{
-public:
-  void open();
-  bool next(Item&);
-  void close();
-  void destroy();
-}; // class Iterator
-
-class XQuery 
-{
-public:
-  std::string execute();
-  std::string printPlanAsXML();
-  std::string printPlanAsDOT();
-  void compile (const std::string &aQuery);
-  void compile (const std::string &aQuery, StaticContext &aStaticContext);
-
-#ifdef SWIGPYTHON
-  void executeSAX(SAX2ContentHandlerProxy* contentHandlerProxy);
-#endif
-
-  void destroy();
-  Iterator iterator();
-  DynamicContext getDynamicContext();
-}; // class XQuery
+%include "XQuery.h"
\ No newline at end of file

=== added file 'swig/XmlDataManager.h'
--- swig/XmlDataManager.h	1970-01-01 00:00:00 +0000
+++ swig/XmlDataManager.h	2012-02-13 18:16:44 +0000
@@ -0,0 +1,49 @@
+/*
+ * Copyright 2006-2008 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.
+ */
+#ifndef API_XML_DATA_MANAGER_H
+#define API_XML_DATA_MANAGER_H
+
+class DocumentManager
+{
+private:
+  zorba::DocumentManager* theManager;
+
+public:
+  DocumentManager() : theManager(0) {}
+  DocumentManager(const DocumentManager& aMgr) : theManager(aMgr.theManager) {}
+  DocumentManager(zorba::DocumentManager* aMgr) : theManager(aMgr) {}
+
+  void put(const std::string& aName, Item aDoc);
+  void remove(const std::string& aName);
+  Item document(const std::string& aName);
+  bool isAvailableDocument(const std::string& aName);
+};
+
+class XmlDataManager
+{
+private:
+  zorba::XmlDataManager* theManager;
+
+public:
+  XmlDataManager() : theManager(0) {}
+  XmlDataManager(const XmlDataManager& aMgr) : theManager(aMgr.theManager) {}
+  XmlDataManager(zorba::XmlDataManager* aMgr) : theManager(aMgr) {}
+
+  DocumentManager getDocumentManager();
+  Iterator parseXML(const std::string& aDoc);
+
+};
+#endif
\ No newline at end of file

=== modified file 'swig/XmlDataManager.i'
--- swig/XmlDataManager.i	2011-08-04 02:14:56 +0000
+++ swig/XmlDataManager.i	2012-02-13 18:16:44 +0000
@@ -15,55 +15,33 @@
  */
 
 %{  // start Implementation
-
-
-class DocumentManager
-{
-private:
-  zorba::DocumentManager* theManager;
-
-public:
-  DocumentManager() : theManager(0) {}
-  DocumentManager(const DocumentManager& aMgr) : theManager(aMgr.theManager) {}
-  DocumentManager(zorba::DocumentManager* aMgr) : theManager(aMgr) {}
-
-  void put(const std::string& aName, Item aDoc)
+  void DocumentManager::put(const std::string& aName, Item aDoc)
   {
     theManager->put(aName, aDoc.theItem);
   }
 
-  void remove(const std::string& aName)
+  void DocumentManager::remove(const std::string& aName)
   {
     theManager->remove(aName);
   }
 
-  Item document(const std::string& aName)
+  Item DocumentManager::document(const std::string& aName)
   {
     return theManager->document(aName);
   }
 
-  bool isAvailableDocument(const std::string& aName)
+  bool DocumentManager::isAvailableDocument(const std::string& aName)
   {
     return theManager->isAvailableDocument(aName);
   }
-};
-
-class XmlDataManager
-{
-private:
-  zorba::XmlDataManager* theManager;
-
-public:
-  XmlDataManager() : theManager(0) {}
-  XmlDataManager(const XmlDataManager& aMgr) : theManager(aMgr.theManager) {}
-  XmlDataManager(zorba::XmlDataManager* aMgr) : theManager(aMgr) {}
-
-  DocumentManager getDocumentManager()
+
+  
+  DocumentManager XmlDataManager::getDocumentManager()
   {
     return DocumentManager(theManager->getDocumentManager()); 
   }
 
-  Iterator parseXML(const std::string& aDoc)
+  Iterator XmlDataManager::parseXML(const std::string& aDoc)
   {
     std::stringstream lDoc;
     lDoc << aDoc;
@@ -71,28 +49,7 @@
     return Iterator(lItem);
   }
 
-};
 
 %}  // end   Implementation
 
-class DocumentManager
-{
-public:
-  void put(const std::string& aName, Item aDoc);
-
-  void remove(const std::string& aName);
-
-  Item document(const std::string& aName);
-
-  bool isAvailableDocument(const std::string& aName);
-};
-
-
-class XmlDataManager 
-{
-public:
-  DocumentManager getDocumentManager();
-
-  Iterator parseXML(const std::string& aDoc);
-   
-}; // class XmlDataManager
+%include "XmlDataManager.h"

=== modified file 'swig/Zorba.i'
--- swig/Zorba.i	2011-10-17 22:42:10 +0000
+++ swig/Zorba.i	2012-02-13 18:16:44 +0000
@@ -15,27 +15,26 @@
   {
     return Zorba(zorba::Zorba::getInstance(aStore.getStore()));
   }
-  
   ItemFactory getItemFactory()
   {
     return ItemFactory(theZorba->getItemFactory());
   }
-
+  
   StaticContext createStaticContext()
   {
     return StaticContext(theZorba->createStaticContext());
   }
   
+  XQuery createQuery() 
+  {
+    return XQuery(theZorba->createQuery());
+  }
+
   XQuery compileQuery(const std::string& aStr) 
   {
     return XQuery(theZorba->compileQuery(aStr));
   }
 
-  XQuery createQuery() 
-  {
-    return XQuery(theZorba->createQuery());
-  }
-
   XQuery compileQuery(
     const std::string& aStr,
     StaticContext &aStaticContext )
@@ -47,6 +46,22 @@
       )
     );
   }
+/*
+  XQuery compileQuery(const ZIStreamHelper& aZorbaStream)
+  {
+    zorbabuffer *buffer = new zorbabuffer(&const_cast<ZIStreamHelper &> (aZorbaStream));
+    std::istream stream = std::istream(buffer);
+    //zistream stream = zistream(buffer);
+    return XQuery(theZorba->compileQuery(stream));
+  }
+
+  XQuery compileQuery(const ZIStreamHelper& aZorbaStream, StaticContext &aStaticContext )
+  { 
+    zorbabuffer *buffer = new zorbabuffer(&const_cast<ZIStreamHelper &> (aZorbaStream));
+    std::istream stream = std::istream(buffer);
+    return XQuery(theZorba->compileQuery(stream, aStaticContext.theStaticContext));
+  }
+*/
 
   /*
   //--->> DiagnosticHandler implementations are postponed
@@ -95,6 +110,18 @@
   {
     theZorba->shutdown();
   }
+  std::string getVersion() {
+    return zorba::Zorba::version().getVersion();
+  }
+  int getMajorVersion() {
+    return zorba::Zorba::version().getMajorVersion();
+  }
+  int getMinorVersion() {
+    return zorba::Zorba::version().getMinorVersion();
+  }
+  int getPatchVersion() {
+    return zorba::Zorba::version().getPatchVersion();
+  }
 
 }; // class Zorba
 
@@ -111,8 +138,9 @@
   XQuery createQuery();
   XQuery compileQuery(const std::string& aStr);
   XQuery compileQuery(const std::string& aStr, StaticContext &aStaticContext );
+  //XQuery compileQuery(const ZIStreamHelper& aZorbaStream);
+  //XQuery compileQuery(const ZIStreamHelper& aZorbaStream, StaticContext &aStaticContext );
   ItemFactory getItemFactory();
-  
   /*
   XQuery compileQuery(const std::string& aStr, DiagnosticHandler* aDiagnosticHandler);
   XQuery compileQuery(const std::string& aStr, StaticContext &aStaticContext, 
@@ -122,5 +150,9 @@
   */
   XmlDataManager getXmlDataManager();
   void shutdown();
+  std::string getVersion();
+  int getMajorVersion();
+  int getMinorVersion();
+  int getPatchVersion();
 
 }; // class Zorba

=== modified file 'swig/java/CMakeLists.txt'
--- swig/java/CMakeLists.txt	2011-10-12 20:56:27 +0000
+++ swig/java/CMakeLists.txt	2012-02-13 18:16:44 +0000
@@ -60,8 +60,17 @@
   MESSAGE(STATUS "Java module install path: " ${JAVA_SITEARCH_DIR})
 
   FILE(GLOB JAVA_SWIG_FILES "${CMAKE_CURRENT_BINARY_DIR}/*.java")
-  CONFIGURE_FILE("${CMAKE_CURRENT_SOURCE_DIR}/../StaticContext.h" "${CMAKE_CURRENT_BINARY_DIR}/StaticContext.h")
-  CONFIGURE_FILE("${CMAKE_CURRENT_SOURCE_DIR}/../ItemFactory.h" "${CMAKE_CURRENT_BINARY_DIR}/ItemFactory.h")
+  CONFIGURE_FILE("${CMAKE_CURRENT_SOURCE_DIR}/../StaticContext.h"  "${CMAKE_CURRENT_BINARY_DIR}/StaticContext.h" COPYONLY)
+  CONFIGURE_FILE("${CMAKE_CURRENT_SOURCE_DIR}/../ItemFactory.h"    "${CMAKE_CURRENT_BINARY_DIR}/ItemFactory.h" COPYONLY)
+  CONFIGURE_FILE("${CMAKE_CURRENT_SOURCE_DIR}/../Item.h"           "${CMAKE_CURRENT_BINARY_DIR}/Item.h" COPYONLY)
+  CONFIGURE_FILE("${CMAKE_CURRENT_SOURCE_DIR}/../Iterator.h"       "${CMAKE_CURRENT_BINARY_DIR}/Iterator.h" COPYONLY)
+  CONFIGURE_FILE("${CMAKE_CURRENT_SOURCE_DIR}/../XQuery.h"         "${CMAKE_CURRENT_BINARY_DIR}/XQuery.h" COPYONLY)
+  CONFIGURE_FILE("${CMAKE_CURRENT_SOURCE_DIR}/../DynamicContext.h" "${CMAKE_CURRENT_BINARY_DIR}/DynamicContext.h" COPYONLY)
+  CONFIGURE_FILE("${CMAKE_CURRENT_SOURCE_DIR}/../XmlDataManager.h" "${CMAKE_CURRENT_BINARY_DIR}/XmlDataManager.h" COPYONLY)
+  CONFIGURE_FILE("${CMAKE_CURRENT_SOURCE_DIR}/../TypeIdentifier.h" "${CMAKE_CURRENT_BINARY_DIR}/TypeIdentifier.h" COPYONLY)
+  CONFIGURE_FILE("${CMAKE_CURRENT_SOURCE_DIR}/../SerializationOptions.h" "${CMAKE_CURRENT_BINARY_DIR}/SerializationOptions.h" COPYONLY)
+#  CONFIGURE_FILE("${CMAKE_CURRENT_SOURCE_DIR}/ZInputStream.java"   "${CMAKE_CURRENT_BINARY_DIR}/ZInputStream.java" COPYONLY)
+#  CONFIGURE_FILE("${CMAKE_CURRENT_SOURCE_DIR}/zistream.java"       "${CMAKE_CURRENT_BINARY_DIR}/zistream.java" COPYONLY)
 
   IF ( APPLE )
     INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/${ZORBA_SWIG_LIB_PREFIX}libzorba_api.jnilib DESTINATION ${JAVA_SITEARCH_DIR})

=== modified file 'swig/java/zorba_api.i'
--- swig/java/zorba_api.i	2009-10-30 16:24:51 +0000
+++ swig/java/zorba_api.i	2012-02-13 18:16:44 +0000
@@ -20,5 +20,6 @@
 // don't do a JNI call for constants and enums.
 %javaconst(1);
 
+
+
 %include ../zorba_api.i
-

=== modified file 'swig/php/CMakeLists.txt'
--- swig/php/CMakeLists.txt	2012-02-02 15:40:27 +0000
+++ swig/php/CMakeLists.txt	2012-02-13 18:16:44 +0000
@@ -35,6 +35,8 @@
   ENDIF (APPLE)
 
   IF (WIN32)
+    STRING(REGEX REPLACE "\\\\" "/" PHP5_LIBRARY "${PHP5_LIBRARY}")
+    MESSAGE (STATUS "SWIG PHP: Link library: " ${PHP5_LIBRARY})
     SWIG_LINK_LIBRARIES (zorba_api ${PHP5_LIBRARY})
   ENDIF (WIN32)
 
@@ -47,6 +49,13 @@
 
   CONFIGURE_FILE("${CMAKE_CURRENT_SOURCE_DIR}/../StaticContext.h" "${CMAKE_CURRENT_BINARY_DIR}/StaticContext.h")
   CONFIGURE_FILE("${CMAKE_CURRENT_SOURCE_DIR}/../ItemFactory.h" "${CMAKE_CURRENT_BINARY_DIR}/ItemFactory.h")
+  CONFIGURE_FILE("${CMAKE_CURRENT_SOURCE_DIR}/../Item.h" "${CMAKE_CURRENT_BINARY_DIR}/Item.h")
+  CONFIGURE_FILE("${CMAKE_CURRENT_SOURCE_DIR}/../Iterator.h" "${CMAKE_CURRENT_BINARY_DIR}/Iterator.h")
+  CONFIGURE_FILE("${CMAKE_CURRENT_SOURCE_DIR}/../XQuery.h" "${CMAKE_CURRENT_BINARY_DIR}/XQuery.h")
+  CONFIGURE_FILE("${CMAKE_CURRENT_SOURCE_DIR}/../DynamicContext.h" "${CMAKE_CURRENT_BINARY_DIR}/DynamicContext.h")
+  CONFIGURE_FILE("${CMAKE_CURRENT_SOURCE_DIR}/../XmlDataManager.h" "${CMAKE_CURRENT_BINARY_DIR}/XmlDataManager.h")
+  CONFIGURE_FILE("${CMAKE_CURRENT_SOURCE_DIR}/../TypeIdentifier.h" "${CMAKE_CURRENT_BINARY_DIR}/TypeIdentifier.h")
+  CONFIGURE_FILE("${CMAKE_CURRENT_SOURCE_DIR}/../SerializationOptions.h" "${CMAKE_CURRENT_BINARY_DIR}/SerializationOptions.h" COPYONLY)
 
   # 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"

=== modified file 'swig/zorba_api.i'
--- swig/zorba_api.i	2011-10-12 20:56:27 +0000
+++ swig/zorba_api.i	2012-02-13 18:16:44 +0000
@@ -16,8 +16,13 @@
 
 %module zorba_api
 %include "std_string.i"
+%include "std_pair.i"
 %include "exception.i"
 
+#ifndef SWIGRUBY
+%include "std_vector.i"
+#endif
+
 %exception {
   try {
     $action
@@ -34,6 +39,14 @@
   }
 }
 
+#ifndef SWIGRUBY
+namespace std {
+  %template(StringPairVector) vector< pair<string, string> >;
+  %template(StringPair) pair<string, string>;
+  %template(StringVector) vector< string >;
+}
+#endif
+
 %{  // Implementations
 
 
@@ -49,11 +62,9 @@
 
   class CompilerHints;
   //class DiagnosticHandler;
-  class Item;
-  class Iterator;
-  class XQuery;
   class Store;
   class Zorba;
+  class Iterator;
 
   class DynamicException;
   class XQueryException;
@@ -64,21 +75,36 @@
   class UserException;
   class ZorbaException;
 
+  #include "SerializationOptions.h"
+  #include "TypeIdentifier.h"
+  #include "Item.h"
+  #include "Iterator.h"
+  #include "DynamicContext.h"
   #include "StaticContext.h"
+  #include "XQuery.h"
   #include "ItemFactory.h"
-
+  #include "XmlDataManager.h"
 %}
 
-
-
+#ifndef SWIGRUBY
+namespace std {
+  %template(ItemVector) vector<Item>; 
+}
+#endif
+
+//%include "ZorbaStreamProxy.i"
+%include "SerializationOptions.i"
+%include "TypeIdentifier.i"
+%include "Item.i"
+%include "Iterator.i"
+%include "DynamicContext.i"
+%include "CompilerHints.i"
+%include "StaticContext.i"
 %include "XQuery.i"
 %include "Store.i"
-%include "XmlDataManager.i"
 %include "Exceptions.i"
 //%include "DiagnosticHandler.i"
-%include "CompilerHints.i"
-%include "StaticContext.i"
 %include "Zorba.i"
 %include "ItemFactory.i"
-
+%include "XmlDataManager.i"
 


Follow ups