← Back to team overview

zorba-coders team mailing list archive

[Merge] lp:~zorba-coders/zorba/markos-skinny into lp:zorba

 

Markos Zaharioudakis has proposed merging lp:~zorba-coders/zorba/markos-skinny into lp:zorba.

Requested reviews:
  Markos Zaharioudakis (markos-za)

For more details, see:
https://code.launchpad.net/~zorba-coders/zorba/markos-skinny/+merge/80756

moved base uri and doc uri from the XmlTree to the DocumentNode
-- 
https://code.launchpad.net/~zorba-coders/zorba/markos-skinny/+merge/80756
Your team Zorba Coders is subscribed to branch lp:zorba.
=== modified file 'src/store/naive/loader_dtd.cpp'
--- src/store/naive/loader_dtd.cpp	2011-07-15 16:39:51 +0000
+++ src/store/naive/loader_dtd.cpp	2011-10-30 15:52:25 +0000
@@ -104,10 +104,12 @@
   theSaxHandler.entityDecl = &FragmentXmlLoader::entityDecl;
 }
 
+
 FragmentXmlLoader::~FragmentXmlLoader()
 {
 }
 
+
 store::Item_t FragmentXmlLoader::loadXml(
     const zstring& baseUri,
     const zstring& docUri,
@@ -117,6 +119,8 @@
 
   xmlSubstituteEntitiesDefault(1);
 
+  theBaseUri = baseUri;
+
   if (docUri.empty())
   {
     std::ostringstream uristream;
@@ -130,9 +134,6 @@
 
   thePathStack.push(PathStepInfo(NULL, baseUri));
 
-  theTree->setDocUri(theDocUri);
-  theTree->setBaseUri(baseUri);
-
   try
   {
     theFragmentStream = static_cast<FragmentIStream*>(&stream);
@@ -147,17 +148,24 @@
       theFragmentStream->theBuffer = new char[static_cast<unsigned int>(fileSize+1)];
       theFragmentStream->theBuffer[fileSize] = 0;
 
-      std::streamsize numChars = readPacket(*theFragmentStream->theStream, theFragmentStream->theBuffer, fileSize);
+      std::streamsize numChars = readPacket(*theFragmentStream->theStream,
+                                            theFragmentStream->theBuffer,
+                                            fileSize);
       theFragmentStream->buffer_size = numChars;
       if (numChars < 0)
       {
-        theXQueryDiagnostics->add_error(NEW_ZORBA_EXCEPTION(zerr::ZSTR0020_LOADER_IO_ERROR));
+        theXQueryDiagnostics->
+        add_error(NEW_ZORBA_EXCEPTION(zerr::ZSTR0020_LOADER_IO_ERROR));
+
         abortload();
         return NULL;
       }
       else if (numChars == 0)
       {
-        theXQueryDiagnostics->add_error(NEW_ZORBA_EXCEPTION(zerr::ZSTR0020_LOADER_IO_ERROR, ERROR_PARAMS(ZED(NoInputData))));
+        theXQueryDiagnostics->
+        add_error(NEW_ZORBA_EXCEPTION(zerr::ZSTR0020_LOADER_IO_ERROR, 
+                  ERROR_PARAMS(ZED(NoInputData))));
+
         abortload();
         return NULL;
       }
@@ -168,7 +176,10 @@
     // ctxt = xmlCreate
     if (ctxt == NULL)
     {
-      theXQueryDiagnostics->add_error(NEW_ZORBA_EXCEPTION(zerr::ZSTR0021_LOADER_PARSING_ERROR, ERROR_PARAMS( ZED( ParserInitFailed ) )));
+      theXQueryDiagnostics->
+      add_error(NEW_ZORBA_EXCEPTION(zerr::ZSTR0021_LOADER_PARSING_ERROR, 
+                ERROR_PARAMS(ZED(ParserInitFailed))));
+
       abortload();
       return NULL;
     }
@@ -180,7 +191,10 @@
     xmlParserInputPtr input = xmlNewInputStream(ctxt);
     if (input == NULL)
     {
-      theXQueryDiagnostics->add_error(NEW_ZORBA_EXCEPTION(zerr::ZSTR0021_LOADER_PARSING_ERROR, ERROR_PARAMS( ZED( ParserInitFailed ) )));
+      theXQueryDiagnostics->
+      add_error(NEW_ZORBA_EXCEPTION(zerr::ZSTR0021_LOADER_PARSING_ERROR,
+                ERROR_PARAMS(ZED(ParserInitFailed))));
+
       abortload();
       return NULL;
     }
@@ -199,7 +213,10 @@
     // Finally call the parser
     if (xmlParseExtParsedEnt(ctxt)==-1)
     {
-      theXQueryDiagnostics->add_error(NEW_ZORBA_EXCEPTION(zerr::ZSTR0021_LOADER_PARSING_ERROR,ERROR_PARAMS( ZED( ParserNoCreateTree ) )));
+      theXQueryDiagnostics->
+      add_error(NEW_ZORBA_EXCEPTION(zerr::ZSTR0021_LOADER_PARSING_ERROR,
+                ERROR_PARAMS(ZED(ParserNoCreateTree))));
+
       abortload();
       return NULL;
     }
@@ -223,11 +240,15 @@
   {
     if (!theDocUri.empty())
     {
-      theXQueryDiagnostics->add_error(NEW_ZORBA_EXCEPTION(zerr::ZSTR0021_LOADER_PARSING_ERROR, ERROR_PARAMS( ZED( BadXMLDocument_2o ), theDocUri )));
+      theXQueryDiagnostics->
+      add_error(NEW_ZORBA_EXCEPTION(zerr::ZSTR0021_LOADER_PARSING_ERROR, 
+                ERROR_PARAMS(ZED(BadXMLDocument_2o), theDocUri)));
     }
     else
     {
-      theXQueryDiagnostics->add_error(NEW_ZORBA_EXCEPTION(zerr::ZSTR0021_LOADER_PARSING_ERROR, ERROR_PARAMS( ZED( BadXMLDocument_2o ) )));
+      theXQueryDiagnostics->
+      add_error(NEW_ZORBA_EXCEPTION(zerr::ZSTR0021_LOADER_PARSING_ERROR, 
+                ERROR_PARAMS(ZED(BadXMLDocument_2o))));
     }
     abortload();
     return NULL;
@@ -237,7 +258,10 @@
     if ( ctxt->lastError.code == XML_NS_ERR_UNDEFINED_NAMESPACE ||
         ctxt->lastError.code != XML_ERR_NO_DTD )
     {
-      theXQueryDiagnostics->add_error(NEW_ZORBA_EXCEPTION(zerr::ZSTR0021_LOADER_PARSING_ERROR, ERROR_PARAMS( ZED( BadXMLDocument_2o ) )));
+      theXQueryDiagnostics->
+      add_error(NEW_ZORBA_EXCEPTION(zerr::ZSTR0021_LOADER_PARSING_ERROR, 
+                ERROR_PARAMS(ZED(BadXMLDocument_2o))));
+
       abortload();
       return NULL;
     }
@@ -256,6 +280,7 @@
   return resultNode;
 }
 
+
 void FragmentXmlLoader::checkStopParsing(void* ctx)
 {
   FragmentXmlLoader& loader = *(static_cast<FragmentXmlLoader*>(ctx));
@@ -271,6 +296,8 @@
     xmlStopParser(loader.ctxt);
   }
 }
+
+
 void FragmentXmlLoader::startElement(
     void * ctx,
     const xmlChar * localname,
@@ -289,6 +316,7 @@
   loader.element_depth++;
 }
 
+
 void FragmentXmlLoader::endElement(
     void * ctx,
     const xmlChar * localname,
@@ -314,6 +342,7 @@
   checkStopParsing(ctx);
 }
 
+
 void FragmentXmlLoader::comment(
     void * ctx,
     const xmlChar * value)
@@ -322,6 +351,7 @@
   checkStopParsing(ctx);
 }
 
+
 void FragmentXmlLoader::cdataBlock(
     void * ctx,
     const xmlChar * value,
@@ -331,6 +361,7 @@
   checkStopParsing(ctx);
 }
 
+
 void FragmentXmlLoader::processingInstruction(
     void * ctx,
     const xmlChar * target,
@@ -480,7 +511,10 @@
   Return the number of bytes actually read, throw an exception if any I/O
   error occured.
 ********************************************************************************/
-std::streamsize DtdXmlLoader::readPacket(std::istream& stream, char* buf, std::streamoff size)
+std::streamsize DtdXmlLoader::readPacket(
+    std::istream& stream,
+    char* buf,
+    std::streamoff size)
 {
   try
   {
@@ -527,6 +561,8 @@
 
   xmlSubstituteEntitiesDefault(1);
 
+  theBaseUri = baseUri;
+
   if (docUri.empty())
   {
     std::ostringstream uristream;
@@ -541,9 +577,6 @@
 
   thePathStack.push(PathStepInfo(NULL, baseUri));
 
-  theTree->setDocUri(theDocUri);
-  theTree->setBaseUri(baseUri);
-
   try
   {
     stream.seekg(0, std::ios::end);
@@ -601,7 +634,9 @@
     if ( xmlParseDocument(ctxt)==-1 )
     {
       // std::cout << "  xmlParseDocument: Error: Unable to create tree: " << ctxt->lastError.message << std::endl;
-      theXQueryDiagnostics->add_error(NEW_ZORBA_EXCEPTION(zerr::ZSTR0021_LOADER_PARSING_ERROR,ERROR_PARAMS( ZED( ParserNoCreateTree ) )));
+      theXQueryDiagnostics->
+      add_error(NEW_ZORBA_EXCEPTION(zerr::ZSTR0021_LOADER_PARSING_ERROR,
+                ERROR_PARAMS(ZED(ParserNoCreateTree))));
       abortload();
       return NULL;
     }
@@ -626,21 +661,15 @@
   {
     if (!theDocUri.empty())
     {
-      theXQueryDiagnostics->add_error(
-        NEW_ZORBA_EXCEPTION(
-          zerr::ZSTR0021_LOADER_PARSING_ERROR,
-          ERROR_PARAMS( ZED( BadXMLDocument_2o ), theDocUri )
-        )
-      );
+      theXQueryDiagnostics->
+      add_error(NEW_ZORBA_EXCEPTION(zerr::ZSTR0021_LOADER_PARSING_ERROR,
+                ERROR_PARAMS(ZED(BadXMLDocument_2o), theDocUri)));
     }
     else
     {
-      theXQueryDiagnostics->add_error(
-        NEW_ZORBA_EXCEPTION(
-          zerr::ZSTR0021_LOADER_PARSING_ERROR,
-          ERROR_PARAMS( ZED( BadXMLDocument_2o ) )
-        )
-      );
+      theXQueryDiagnostics->
+      add_error(NEW_ZORBA_EXCEPTION(zerr::ZSTR0021_LOADER_PARSING_ERROR,
+                ERROR_PARAMS(ZED(BadXMLDocument_2o))));
     }
 
     abortload();
@@ -656,12 +685,9 @@
     if ( ctxt->lastError.code == XML_NS_ERR_UNDEFINED_NAMESPACE ||
         ctxt->lastError.code != XML_ERR_NO_DTD )
     {
-      theXQueryDiagnostics->add_error(
-        NEW_ZORBA_EXCEPTION(
-          zerr::ZSTR0021_LOADER_PARSING_ERROR,
-          ERROR_PARAMS( ZED( BadXMLDocument_2o ) )
-        )
-      );
+      theXQueryDiagnostics->
+      add_error(NEW_ZORBA_EXCEPTION(zerr::ZSTR0021_LOADER_PARSING_ERROR,
+                ERROR_PARAMS(ZED(BadXMLDocument_2o))));
       abortload();
       return NULL;
 
@@ -672,12 +698,10 @@
   xmlDoc *doc = ctxt->myDoc;
   if (doc == NULL)
   {
-    theXQueryDiagnostics->add_error(
-      NEW_ZORBA_EXCEPTION(
-        zerr::ZSTR0021_LOADER_PARSING_ERROR,
-        ERROR_PARAMS( ZED( ParserNoCreateTree ) )
-      )
-    );
+    theXQueryDiagnostics->
+    add_error(NEW_ZORBA_EXCEPTION(zerr::ZSTR0021_LOADER_PARSING_ERROR,
+              ERROR_PARAMS(ZED(ParserNoCreateTree))));
+
     abortload();
     return NULL;
   }
@@ -700,6 +724,7 @@
   return resultNode;
 }
 
+
 void DtdXmlLoader::loadDocument(xmlDoc *doc)
 {
   startDocument(this);
@@ -712,6 +737,7 @@
   endDocument(this);
 }
 
+
 void DtdXmlLoader::loadNode(xmlNode *a_node)
 {
   xmlNode *cur_node = NULL;
@@ -784,6 +810,8 @@
     }
   }
 }
+
+
 /*******************************************************************************
   SAX2 callback when the start of document has been detected by the parser.
 
@@ -796,7 +824,7 @@
 
   try
   {
-    XmlNode* docNode = GET_STORE().getNodeFactory().createDocumentNode();
+    DocumentNode* docNode = GET_STORE().getNodeFactory().createDocumentNode();
 
     loader.setRoot(docNode);
     loader.theNodeStack.push(docNode);
@@ -812,6 +840,8 @@
     }
 #endif
 
+    docNode->setBaseUri(loader.theBaseUri);
+    docNode->setDocUri(loader.theDocUri);
     docNode->setId(loader.theTree, &loader.theOrdPath);
     loader.theOrdPath.pushChild();
 
@@ -823,9 +853,8 @@
   }
   catch (...)
   {
-    loader.theXQueryDiagnostics->add_error(
-      NEW_ZORBA_EXCEPTION( zerr::ZXQP0003_INTERNAL_ERROR )
-    );
+    loader.theXQueryDiagnostics->
+    add_error(NEW_ZORBA_EXCEPTION(zerr::ZXQP0003_INTERNAL_ERROR));
   }
 }
 

=== modified file 'src/store/naive/loader_fast.cpp'
--- src/store/naive/loader_fast.cpp	2011-07-15 16:39:51 +0000
+++ src/store/naive/loader_fast.cpp	2011-10-30 15:52:25 +0000
@@ -257,6 +257,8 @@
 
   xmlSubstituteEntitiesDefault(1);
 
+  theBaseUri = baseUri;
+
   if (docUri.empty())
   {
     std::ostringstream uristream;
@@ -271,28 +273,23 @@
 
   thePathStack.push(PathStepInfo(NULL, baseUri));
 
-  theTree->setDocUri(theDocUri);
-  theTree->setBaseUri(baseUri);
-
   try
   {
     std::streamsize numChars = readPacket(stream, theBuffer, INPUT_CHUNK_SIZE);
 
     if (numChars < 0)
     {
-      theXQueryDiagnostics->add_error(
-      	NEW_ZORBA_EXCEPTION( zerr::ZSTR0020_LOADER_IO_ERROR )
-      );
+      theXQueryDiagnostics->
+      add_error(NEW_ZORBA_EXCEPTION(zerr::ZSTR0020_LOADER_IO_ERROR));
+
       abortload();
       return NULL;
     }
     else if (numChars == 0)
     {
-      theXQueryDiagnostics->add_error(
-      	NEW_ZORBA_EXCEPTION(
-          zerr::ZSTR0020_LOADER_IO_ERROR, ERROR_PARAMS( ZED( NoInputData ) )
-        )
-      );
+      theXQueryDiagnostics->
+      add_error(NEW_ZORBA_EXCEPTION(zerr::ZSTR0020_LOADER_IO_ERROR,
+                                    ERROR_PARAMS(ZED(NoInputData))));
       abortload();
       return NULL;
     }
@@ -305,8 +302,9 @@
 
     if (ctxt == NULL)
     {
-      theXQueryDiagnostics->add_error(
-        NEW_ZORBA_EXCEPTION(zerr::ZSTR0021_LOADER_PARSING_ERROR,ERROR_PARAMS( ZED( ParserInitFailed ) )));
+      theXQueryDiagnostics->
+      add_error(NEW_ZORBA_EXCEPTION(zerr::ZSTR0021_LOADER_PARSING_ERROR,
+                                    ERROR_PARAMS(ZED(ParserInitFailed))));
       abortload();
 			return NULL;
     }
@@ -324,7 +322,9 @@
 
     if (numChars < 0)
     {
-      theXQueryDiagnostics->add_error(NEW_ZORBA_EXCEPTION( zerr::ZSTR0020_LOADER_IO_ERROR ));
+      theXQueryDiagnostics->
+      add_error(NEW_ZORBA_EXCEPTION(zerr::ZSTR0020_LOADER_IO_ERROR));
+
       abortload();
       return NULL;
     }
@@ -356,20 +356,14 @@
     if (!theDocUri.empty())
     {
       theXQueryDiagnostics->add_error(
-        NEW_ZORBA_EXCEPTION(
-          zerr::ZSTR0021_LOADER_PARSING_ERROR,
-          ERROR_PARAMS( ZED( BadXMLDocument_2o ), theDocUri )
-        )
-      );
+      NEW_ZORBA_EXCEPTION(zerr::ZSTR0021_LOADER_PARSING_ERROR,
+                          ERROR_PARAMS(ZED(BadXMLDocument_2o), theDocUri)));
     }
     else
     {
       theXQueryDiagnostics->add_error(
-        NEW_ZORBA_EXCEPTION(
-          zerr::ZSTR0021_LOADER_PARSING_ERROR,
-          ERROR_PARAMS( ZED( BadXMLDocument_2o ) )
-        )
-      );
+      NEW_ZORBA_EXCEPTION(zerr::ZSTR0021_LOADER_PARSING_ERROR,
+                          ERROR_PARAMS(ZED(BadXMLDocument_2o))));
     }
     abortload();
     return NULL;
@@ -397,7 +391,7 @@
 
   try
   {
-    XmlNode* docNode = GET_STORE().getNodeFactory().createDocumentNode();
+    DocumentNode* docNode = GET_STORE().getNodeFactory().createDocumentNode();
 
     loader.setRoot(docNode);
     loader.theNodeStack.push(docNode);
@@ -413,6 +407,8 @@
     }
 #endif
 
+    docNode->setBaseUri(loader.theBaseUri);
+    docNode->setDocUri(loader.theDocUri);
     docNode->setId(loader.theTree, &loader.theOrdPath);
     loader.theOrdPath.pushChild();
 
@@ -424,9 +420,8 @@
   }
   catch (...)
   {
-    loader.theXQueryDiagnostics->add_error(
-      NEW_ZORBA_EXCEPTION( zerr::ZXQP0003_INTERNAL_ERROR )
-    );
+    loader.theXQueryDiagnostics->
+    add_error(NEW_ZORBA_EXCEPTION(zerr::ZXQP0003_INTERNAL_ERROR));
   }
 }
 

=== modified file 'src/store/naive/node_factory.cpp'
--- src/store/naive/node_factory.cpp	2011-06-14 17:26:33 +0000
+++ src/store/naive/node_factory.cpp	2011-10-30 15:52:25 +0000
@@ -57,8 +57,8 @@
 
 DocumentNode* NodeFactory::createDocumentNode(
     XmlTree* tree,
-    zstring& baseUri,
-    zstring& docUri)
+    const zstring& baseUri,
+    const zstring& docUri)
 {
   return new DocumentNode(tree, baseUri, docUri);
 }

=== modified file 'src/store/naive/node_factory.h'
--- src/store/naive/node_factory.h	2011-06-14 17:26:33 +0000
+++ src/store/naive/node_factory.h	2011-10-30 15:52:25 +0000
@@ -68,8 +68,8 @@
 
   virtual DocumentNode* createDocumentNode(
         XmlTree* tree,
-        zstring& baseUri,
-        zstring& docUri);
+        const zstring& baseUri,
+        const zstring& docUri);
 
   virtual ElementNode* createElementNode(
         store::Item_t&  nodeName,

=== modified file 'src/store/naive/node_items.cpp'
--- src/store/naive/node_items.cpp	2011-10-10 12:56:57 +0000
+++ src/store/naive/node_items.cpp	2011-10-30 15:52:25 +0000
@@ -68,7 +68,9 @@
   thePos(0),
   theCollection(NULL),
   theRootNode(NULL),
+#ifdef DATAGUIDE
   theDataGuideRootNode(NULL),
+#endif
   theIsValidated(false),
   theIsRecursive(false)
 #ifndef EMBEDED_TYPE
@@ -86,7 +88,9 @@
   thePos(0),
   theCollection(NULL),
   theRootNode(root),
+#ifdef DATAGUIDE
   theDataGuideRootNode(NULL),
+#endif
   theIsValidated(false),
   theIsRecursive(false)
 #ifndef EMBEDED_TYPE
@@ -137,11 +141,13 @@
     theRootNode = NULL;
   }
 
+#ifdef DATAGUIDE
   if (theDataGuideRootNode != NULL)
   {
     theDataGuideRootNode->deleteTree();
     theDataGuideRootNode = NULL;
   }
+#endif
 
 #ifndef EMBEDED_TYPE
   if (theTypesMap)
@@ -1331,16 +1337,13 @@
 ********************************************************************************/
 DocumentNode::DocumentNode(
     XmlTree* tree,
-    zstring& baseUri,
-    zstring& docUri)
+    const zstring& baseUri,
+    const zstring& docUri)
   :
-  InternalNode(tree, NULL, false, 0, store::StoreConsts::documentNode)
+  InternalNode(tree, NULL, false, 0, store::StoreConsts::documentNode),
+  theBaseUri(baseUri),
+  theDocUri(docUri)
 {
-  if (!baseUri.empty())
-    tree->setBaseUri(baseUri);
-
-  tree->setDocUri(docUri);
-
   NODE_TRACE1("{\nConstructing doc node " << this << " tree = "
               << getTree()->getId() << ":" << getTree()
               << " doc uri = " << docUri);
@@ -1366,10 +1369,7 @@
   {
     tree = NodeFactory::instance().createXmlTree();
 
-    zstring baseuri = getBaseUri();
-    zstring docuri = getDocUri();
-
-    copyNode = NodeFactory::instance().createDocumentNode(tree, baseuri, docuri);
+    copyNode = NodeFactory::instance().createDocumentNode(tree, theBaseUri, theDocUri);
 
     const_iterator ite = childrenBegin();
     const_iterator end = childrenEnd();
@@ -1403,7 +1403,7 @@
 void DocumentNode::getBaseURIInternal(zstring& uri, bool& local) const
 {
   local = true;
-  uri = getBaseUri();
+  uri = theBaseUri;
 }
 
 
@@ -1507,8 +1507,8 @@
 
   strStream << "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" << std::endl
             << "<document";
-  strStream << " baseUri = \"" << getBaseUri() << "\"";
-  strStream << " docUri = \"" << getDocUri();
+  strStream << " baseUri = \"" << theBaseUri << "\"";
+  strStream << " docUri = \"" << theDocUri;
   strStream << "\">" << std::endl;
 
   store::Iterator_t iter = getChildren();

=== modified file 'src/store/naive/node_items.h'
--- src/store/naive/node_items.h	2011-10-10 12:56:57 +0000
+++ src/store/naive/node_items.h	2011-10-30 15:52:25 +0000
@@ -180,14 +180,13 @@
   ulong                     theId;
   ulong                     thePos;
 
-  zstring                   theDocUri;
-  zstring                   theBaseUri;
-
   SimpleCollection        * theCollection;
 
   XmlNode                 * theRootNode;
 
+#ifdef DATAGUIDE
   GuideNode               * theDataGuideRootNode;
+#endif
 
   bool                      theIsValidated;
   bool                      theIsRecursive;
@@ -220,14 +219,6 @@
 
   ulong getId() const { return theId; }
 
-  const zstring& getDocUri() const { return theDocUri; }
-
-  void setDocUri(const zstring& uri) { theDocUri = uri; }
-
-  const zstring& getBaseUri() const { return theBaseUri; }
-
-  void setBaseUri(const zstring& uri) { theBaseUri = uri; }
-
   ulong getCollectionId() const;
 
   const SimpleCollection* getCollection() const { return theCollection; }
@@ -250,9 +241,11 @@
 
   bool isRecursive() const { return theIsRecursive; }
 
+#ifdef DATAGUIDE
   GuideNode* getDataGuide() const { return theDataGuideRootNode; }
 
   void setDataGuide(GuideNode* root) { theDataGuideRootNode = root; }
+#endif
 
 #ifndef EMBEDED_TYPE
   store::Item* getType(const XmlNode* n) const;
@@ -491,15 +484,9 @@
 
   void setParent(InternalNode* p) { theParent = p; }
 
+#ifdef DATAGUIDE
   GuideNode* getDataGuide() const { return getTree()->getDataGuide(); }
-
-  const zstring& getBaseUri() const { return getTree()->getBaseUri(); }
-
-  void setBaseUri(const zstring& uri) { getTree()->setBaseUri(uri); }
-
-  const zstring& getDocUri() const { return getTree()->getDocUri(); }
-
-  void setDocUri(const zstring& uri) { getTree()->setDocUri(uri); }
+#endif
 
   virtual XmlNode* copyInternal(
       InternalNode* rootParent,
@@ -793,10 +780,14 @@
   friend class NodeFactory;
 
 protected:
+  zstring  theBaseUri;
+  zstring  theDocUri;
+
+protected:
   DocumentNode(
       XmlTree* tree,
-      zstring& baseUri,
-      zstring& docUri);
+      const zstring& baseUri,
+      const zstring& docUri);
 
   DocumentNode();
 
@@ -807,7 +798,7 @@
 
   store::Item* getType() const;
 
-  void getDocumentURI(zstring& uri) const { uri = getDocUri(); }
+  void getDocumentURI(zstring& uri) const { uri = theDocUri; }
 
   store::Iterator_t getChildren() const;
 
@@ -838,6 +829,12 @@
         const XmlNode* rootCopy,
         const store::CopyMode& copyMode) const;
 
+  const zstring& getBaseUri() const { return theBaseUri; }
+
+  void setBaseUri(const zstring& uri) { theBaseUri = uri; }
+
+  void setDocUri(const zstring& uri) { theDocUri = uri; }
+
 protected:
   void getBaseURIInternal(zstring& uri, bool& local) const;
 };

=== modified file 'src/store/naive/simple_store.cpp'
--- src/store/naive/simple_store.cpp	2011-10-10 12:56:57 +0000
+++ src/store/naive/simple_store.cpp	2011-10-30 15:52:25 +0000
@@ -1120,9 +1120,7 @@
 
   if (node == NULL || !node->isNode())
   {
-    throw ZORBA_EXCEPTION(
-      zerr::ZAPI0021_ITEM_TO_LOAD_IS_NOT_NODE, ERROR_PARAMS( uri )
-    );
+    RAISE_ERROR_NO_LOC(zerr::ZAPI0021_ITEM_TO_LOAD_IS_NOT_NODE, ERROR_PARAMS(uri));
   }
 
   XmlNode_t root = reinterpret_cast<XmlNode*>(node.getp());
@@ -1134,13 +1132,7 @@
 
   if (!inserted && node.getp() != root.getp())
   {
-    throw ZORBA_EXCEPTION(
-      zerr::ZAPI0020_DOCUMENT_ALREADY_EXISTS, ERROR_PARAMS( uri )
-    );
-  }
-  else if (inserted)
-  {
-    root->setDocUri(uri);
+    RAISE_ERROR_NO_LOC(zerr::ZAPI0020_DOCUMENT_ALREADY_EXISTS, ERROR_PARAMS(uri));
   }
 
   ZORBA_FATAL(node.getp() == root.getp(), "");
@@ -1463,12 +1455,14 @@
   if (docRoot == NULL)
     return false;
 
+#ifdef DATAGUIDE
   GuideNode* guideRoot = docRoot->getDataGuide();
 
   if (!guideRoot)
     return false;
 
   guideRoot->getPathInfo(contextPath, relativePath, isAttrPath, found, unique);
+#endif
   return true;
 }
 


Follow ups