Cleaned up every thing, prepared to remove deprecated interface.
[SXSI/xpathcomp.git] / SXSIStorageInterface.cpp
index e5bd7cf..2594bd2 100644 (file)
 #include "SXSIStorageInterface.h"
 #include "Utils.h"
 
-
-SXSIStorageInterface::SXSIStorageInterface()
+SXSIStorageInterface::SXSIStorageInterface(int sf,bool iet,bool dtc)
 {
-  tree = new XMLTree();
-  tree->OpenDocument(false,64);
+  tree = NULL;
+  tb = new XMLTreeBuilder();
+  tb ->OpenDocument(iet,sf,dtc);
 }
 
 SXSIStorageInterface::~SXSIStorageInterface()
@@ -24,45 +24,38 @@ SXSIStorageInterface::~SXSIStorageInterface()
 
 void SXSIStorageInterface::newChild(string name)
 { 
-  _new_child++;
-  tree->NewOpenTag((unsigned char*) name.c_str());
+  tb->NewOpenTag(name);
 }
 
 
 void SXSIStorageInterface::newText(string text)
 {
 
-  if (text.empty()) {
-    _new_empty_text++;
-    tree->NewEmptyText();
-  }
-  else {
-    _new_text++;
-    _length_text += text.size();
-    tree->NewText((unsigned char*) text.c_str());  
-  }
+  tb->NewText(text);
 }
-       
 
 
 void SXSIStorageInterface::nodeFinished(string name)
 {  
-  tree->NewClosingTag((unsigned char*) name.c_str());
- }           
+  tb->NewClosingTag(name);
+
+}            
              
   void SXSIStorageInterface::parsingFinished()
 {
 
-  tree->CloseDocument();
+  tree = tb->CloseDocument();
        
 }
 
 void *SXSIStorageInterface::returnDocument(){
-
+#ifdef DEBUG
   printStats();
+#endif
   return ((void *) tree);
   
 }
+
 void SXSIStorageInterface::printStats(){
   std::cerr << "Parsing stats :  \n";
   std::cerr << _new_child << " calls to newOpenTag/newClosingTag\n";